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
Modifier and TypeFieldDescriptionstatic final boolean
The default enable value.static final String
Fields inherited from interface io.micronaut.security.token.config.TokenConfiguration
DEFAULT_NAME_KEY, DEFAULT_ROLES_NAME, DEFAULT_ROLES_SEPARATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NonNull String
Key which will be used in theAuthentication.getAttributes()
for the User`s name.@NonNull String
Key which will be used in theAuthentication.getAttributes()
for the User`s roles.@Nullable String
Separator which will be used for splitting the roles before processing theAuthentication
.boolean
void
setEnabled
(boolean enabled) Sets whether the configuration is enabled.void
setNameKey
(@NonNull String nameKey) Authentication
attributes map key for the user's name.void
setRolesName
(@NonNull String rolesName) Authentication
attributes map key for the user's roles.void
setRolesSeparator
(@Nullable String rolesSeparator) If the entry used for the roles in theAuthentication
attributes 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:
isEnabled
in interfaceio.micronaut.core.util.Toggleable
-
getRolesName
Description copied from interface:TokenConfiguration
Key which will be used in theAuthentication.getAttributes()
for the User`s roles.- Specified by:
getRolesName
in 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
Authentication
attributes map key for the user's roles. Default value "roles".- Parameters:
rolesName
- The roles name
-
getNameKey
Description copied from interface:TokenConfiguration
Key which will be used in theAuthentication.getAttributes()
for the User`s name.- Specified by:
getNameKey
in interfaceTokenConfiguration
- Returns:
- The key used for the user's name within the user's attributes. e.g. "sub".
- See Also:
-
setNameKey
Authentication
attributes map key for the user's name. Default value "sub".- Parameters:
nameKey
- key for name
-
getRolesSeparator
Description copied from interface:TokenConfiguration
Separator which will be used for splitting the roles before processing theAuthentication
.- Specified by:
getRolesSeparator
in interfaceTokenConfiguration
- Returns:
- The separator used for splitting the users roles
-
setRolesSeparator
If the entry used for the roles in theAuthentication
attributes 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
-