Record Class ControlPanelSecurityConfiguration

java.lang.Object
java.lang.Record
io.micronaut.controlpanel.core.security.ControlPanelSecurityConfiguration
Record Components:
access - the configured read access mode
role - role required when authorized read access is enabled
writeAccess - the configured write access mode
writeRole - role required when authorized write access is enabled

@ConfigurationProperties("micronaut.control-panel.security") public record ControlPanelSecurityConfiguration(io.micronaut.controlpanel.core.security.ControlPanelSecurityConfiguration.Access access, String role, io.micronaut.controlpanel.core.security.ControlPanelSecurityConfiguration.WriteAccess writeAccess, @Nullable String writeRole) extends Record
Security configuration for the control panel HTTP surface.
Since:
2.0.0
Author:
Álvaro Sánchez-Mariscal
  • Field Details

  • Constructor Details

    • ControlPanelSecurityConfiguration

      public ControlPanelSecurityConfiguration(io.micronaut.controlpanel.core.security.ControlPanelSecurityConfiguration.Access access)
      Creates configuration with the default control panel role.
      Parameters:
      access - the configured access mode
    • ControlPanelSecurityConfiguration

      public ControlPanelSecurityConfiguration(io.micronaut.controlpanel.core.security.ControlPanelSecurityConfiguration.Access access, String role)
      Creates configuration with inherited write access.
      Parameters:
      access - the configured read access mode
      role - the configured read role
    • ControlPanelSecurityConfiguration

      public ControlPanelSecurityConfiguration(@Bindable(defaultValue="AUTHORIZED") io.micronaut.controlpanel.core.security.ControlPanelSecurityConfiguration.Access access, @Bindable(defaultValue="ROLE_CONTROL_PANEL") String role, @Bindable(defaultValue="INHERITED") io.micronaut.controlpanel.core.security.ControlPanelSecurityConfiguration.WriteAccess writeAccess, @Nullable String writeRole)
      Creates an instance of a ControlPanelSecurityConfiguration record class.
      Parameters:
      access - the value for the access record component
      role - the value for the role record component
      writeAccess - the value for the writeAccess record component
      writeRole - the value for the writeRole record component
  • Method Details

    • effectiveWriteRole

      public String effectiveWriteRole()
      Resolve the effective write role.
      Returns:
      the write role, falling back to the read role when no write role is configured
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • access

      @Bindable(defaultValue="AUTHORIZED") public io.micronaut.controlpanel.core.security.ControlPanelSecurityConfiguration.Access access()
      Returns the value of the access record component.
      Returns:
      the value of the access record component
    • role

      @Bindable(defaultValue="ROLE_CONTROL_PANEL") public String role()
      Returns the value of the role record component.
      Returns:
      the value of the role record component
    • writeAccess

      @Bindable(defaultValue="INHERITED") public io.micronaut.controlpanel.core.security.ControlPanelSecurityConfiguration.WriteAccess writeAccess()
      Returns the value of the writeAccess record component.
      Returns:
      the value of the writeAccess record component
    • writeRole

      public @Nullable String writeRole()
      Returns the value of the writeRole record component.
      Returns:
      the value of the writeRole record component