Class BasicAuthProperties

java.lang.Object
tech.lastbox.lastshield.basicauth.enviroment.BasicAuthProperties

@Component @ConfigurationProperties(prefix="lastshield.basicauth") @ConditionalOnProperty(name="lastshield.basicauth", havingValue="true") public class BasicAuthProperties extends Object
This class holds the configuration properties for Basic Authentication. The properties are loaded from the application's configuration (e.g., `application.yml` or `application.properties`) and are conditionally enabled when the `lastshield.basicauth` property is set to `true`.

It validates the issuer and secret key properties and throws custom exceptions if they are null or empty.

  • Constructor Details

    • BasicAuthProperties

      public BasicAuthProperties()
  • Method Details

    • getIssuer

      public String getIssuer()
      Gets the issuer for the token.
      Returns:
      the issuer of the token.
    • setIssuer

      public void setIssuer(String issuer)
      Sets the issuer for the token.

      Throws an exception if the issuer is null or empty.

      Parameters:
      issuer - the issuer of the token.
      Throws:
      tech.lastbox.lastshield.basicauth.enviroment.InvalidIssuerException - if the issuer is invalid.
    • getSecretKey

      public String getSecretKey()
      Gets the secret key for token signing and verification.
      Returns:
      the secret key.
    • setSecretKey

      public void setSecretKey(String secretKey)
      Sets the secret key for token signing and verification.

      Throws an exception if the secret key is null or empty.

      Parameters:
      secretKey - the secret key.
      Throws:
      tech.lastbox.lastshield.basicauth.enviroment.InvalidSecretKeyException - if the secret key is invalid.
    • getAdminUsername

      public String getAdminUsername()
      Gets the administrator's username.
      Returns:
      the admin username.
    • setAdminUsername

      public void setAdminUsername(String adminUsername)
      Sets the administrator's username.
      Parameters:
      adminUsername - the admin username.
    • getAdminPassword

      public String getAdminPassword()
      Gets the administrator's password.
      Returns:
      the admin password.
    • setAdminPassword

      public void setAdminPassword(String adminPassword)
      Sets the administrator's password.
      Parameters:
      adminPassword - the admin password.
    • getAdminName

      public String getAdminName()
      Gets the administrator's name.
      Returns:
      the admin name.
    • setAdminName

      public void setAdminName(String adminName)
      Sets the administrator's name.
      Parameters:
      adminName - the admin name.