Class TokenConfigurationProperties
java.lang.Object
io.micronaut.security.token.config.TokenConfigurationProperties
- All Implemented Interfaces:
io.micronaut.core.util.Toggleable,TokenConfiguration
@ConfigurationProperties("micronaut.security.token")
public class TokenConfigurationProperties
extends Object
implements TokenConfiguration
Defines Security Token Configuration.
- Since:
- 1.0
- Author:
- Sergio del Amo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe default enable value.static final StringFields inherited from interface io.micronaut.security.token.config.TokenConfiguration
DEFAULT_NAME_KEY, DEFAULT_ROLES_NAME, DEFAULT_ROLES_SEPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull StringKey which will be used in theAuthentication.getAttributes()for the User`s name.@NonNull StringKey which will be used in theAuthentication.getAttributes()for the User`s roles.@Nullable StringSeparator which will be used for splitting the roles before processing theAuthentication.booleanvoidsetEnabled(boolean enabled) Sets whether the configuration is enabled.voidsetNameKey(@NonNull String nameKey) Authenticationattributes map key for the user's name.voidsetRolesName(@NonNull String rolesName) Authenticationattributes map key for the user's roles.voidsetRolesSeparator(@Nullable String rolesSeparator) If the entry used for the roles in theAuthenticationattributes map is a String, you can use the separator to split its value into multiple roles.
-
Field Details
-
PREFIX
- See Also:
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLEDThe default enable value.- See Also:
-
-
Constructor Details
-
TokenConfigurationProperties
public TokenConfigurationProperties()
-
-
Method Details
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceio.micronaut.core.util.Toggleable
-
getRolesName
Description copied from interface:TokenConfigurationKey which will be used in theAuthentication.getAttributes()for the User`s roles.- Specified by:
getRolesNamein interfaceTokenConfiguration- Returns:
- The key used for the user's roles within the user's attributes. e.g. "roles".
- See Also:
-
setEnabled
public void setEnabled(boolean enabled) Sets whether the configuration is enabled. Default value true.- Parameters:
enabled- True if it is enabled
-
setRolesName
Authenticationattributes map key for the user's roles. Default value "roles".- Parameters:
rolesName- The roles name
-
getNameKey
Description copied from interface:TokenConfigurationKey which will be used in theAuthentication.getAttributes()for the User`s name.- Specified by:
getNameKeyin interfaceTokenConfiguration- Returns:
- The key used for the user's name within the user's attributes. e.g. "sub".
- See Also:
-
setNameKey
Authenticationattributes map key for the user's name. Default value "sub".- Parameters:
nameKey- key for name
-
getRolesSeparator
Description copied from interface:TokenConfigurationSeparator which will be used for splitting the roles before processing theAuthentication.- Specified by:
getRolesSeparatorin interfaceTokenConfiguration- Returns:
- The separator used for splitting the users roles
-
setRolesSeparator
If the entry used for the roles in theAuthenticationattributes map is a String, you can use the separator to split its value into multiple roles. Default valueTokenConfiguration.DEFAULT_ROLES_SEPARATOR.- Parameters:
rolesSeparator- separator to split roles by
-