Package com.hazelcast.config.security
Class SimpleAuthenticationConfig
java.lang.Object
com.hazelcast.config.security.AbstractClusterLoginConfig<SimpleAuthenticationConfig>
com.hazelcast.config.security.SimpleAuthenticationConfig
- All Implemented Interfaces:
AuthenticationConfig
public class SimpleAuthenticationConfig
extends AbstractClusterLoginConfig<SimpleAuthenticationConfig>
Typed authentication configuration for
SimplePropertiesLoginModule
. The user configuration (username, password, and
assigned roles) is directly part of the configuration object.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Helper immutable object representing user attributes (i.e. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddUser
(String username, SimpleAuthenticationConfig.UserDto userDto) Adds one user to the configuration.Adds one user to the configuration.Converts current configuration to stack of login modules.boolean
getPassword
(String username) Return the configured password for given username.Returns role names assigned to the given user.Returns the custom role separator (when set).Returns names of users registered in the configuration.int
hashCode()
protected Properties
protected static String
requireNonEmpty
(String str, String message) protected SimpleAuthenticationConfig
self()
setRoleSeparator
(String roleSeparator) Allows to use a custom role separator in the configuration.Replaces the users with ones from the given map.toString()
Methods inherited from class com.hazelcast.config.security.AbstractClusterLoginConfig
getSkipEndpoint, getSkipIdentity, getSkipRole, setIfConfigured, setIfConfigured, setIfConfigured, setSkipEndpoint, setSkipIdentity, setSkipRole
-
Constructor Details
-
SimpleAuthenticationConfig
public SimpleAuthenticationConfig()
-
-
Method Details
-
addUser
public SimpleAuthenticationConfig addUser(@Nonnull String username, @Nonnull String password, String... roles) Adds one user to the configuration.- Parameters:
username
- usernamepassword
- user's passwordroles
- roles assigned to the user- Returns:
- this object
-
addUser
public SimpleAuthenticationConfig addUser(@Nonnull String username, @Nonnull SimpleAuthenticationConfig.UserDto userDto) Adds one user to the configuration.- Parameters:
username
- usernameuserDto
- user's attributes- Returns:
- this object
-
setRoleSeparator
Allows to use a custom role separator in the configuration. It's important in case when a role name contains the default separator "," (comma).- Parameters:
roleSeparator
- new separator- Returns:
- this object
-
getRoleSeparator
Returns the custom role separator (when set). If no custom one is used,null
is returned and default separator is used ("," - comma).- Returns:
- the separator
-
getUsernames
Returns names of users registered in the configuration.- Returns:
- set of usernames
-
getPassword
Return the configured password for given username.- Parameters:
username
- username- Returns:
- user's password or null if such user doesn't exist
-
getRoles
Returns role names assigned to the given user.- Parameters:
username
- username- Returns:
- configured roles or null if the user doesn't exist
-
setUserMap
public SimpleAuthenticationConfig setUserMap(@Nullable Map<String, SimpleAuthenticationConfig.UserDto> map) Replaces the users with ones from the given map.- Parameters:
map
- map of new users- Returns:
- this object
-
initLoginModuleProperties
- Overrides:
initLoginModuleProperties
in classAbstractClusterLoginConfig<SimpleAuthenticationConfig>
-
asLoginModuleConfigs
Description copied from interface:AuthenticationConfig
Converts current configuration to stack of login modules.- Returns:
- login modules stack
-
toString
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractClusterLoginConfig<SimpleAuthenticationConfig>
-
equals
- Overrides:
equals
in classAbstractClusterLoginConfig<SimpleAuthenticationConfig>
-
self
- Specified by:
self
in classAbstractClusterLoginConfig<SimpleAuthenticationConfig>
-
requireNonEmpty
-