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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the administrator's name.Gets the administrator's password.Gets the administrator's username.Gets the issuer for the token.Gets the secret key for token signing and verification.voidsetAdminName(String adminName) Sets the administrator's name.voidsetAdminPassword(String adminPassword) Sets the administrator's password.voidsetAdminUsername(String adminUsername) Sets the administrator's username.voidSets the issuer for the token.voidsetSecretKey(String secretKey) Sets the secret key for token signing and verification.
-
Constructor Details
-
BasicAuthProperties
public BasicAuthProperties()
-
-
Method Details
-
getIssuer
Gets the issuer for the token.- Returns:
- the issuer of the token.
-
setIssuer
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
Gets the secret key for token signing and verification.- Returns:
- the secret key.
-
setSecretKey
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
Gets the administrator's username.- Returns:
- the admin username.
-
setAdminUsername
Sets the administrator's username.- Parameters:
adminUsername- the admin username.
-
getAdminPassword
Gets the administrator's password.- Returns:
- the admin password.
-
setAdminPassword
Sets the administrator's password.- Parameters:
adminPassword- the admin password.
-
getAdminName
Gets the administrator's name.- Returns:
- the admin name.
-
setAdminName
Sets the administrator's name.- Parameters:
adminName- the admin name.
-