public class UsersRolesLoginModule extends UsernamePasswordLoginModule
callbackHandler, jbossModuleName, log, loginOk, options, principalClassModuleName, principalClassName, sharedState, subject, unauthenticatedIdentity, useFirstPass
Constructor and Description |
---|
UsersRolesLoginModule() |
Modifier and Type | Method and Description |
---|---|
protected Properties |
createRoles(Map<String,?> options)
A hook to allow subclasses to create the roles Properties map.
|
protected Properties |
createUsers(Map<String,?> options)
A hook to allow subclasses to create the users Properties map.
|
protected Group[] |
getRoleSets()
Create the set of roles the user belongs to by parsing the roles.properties
data for username=role1,role2,...
|
protected String |
getUsersPassword()
Get the expected password for the current username available via
the getUsername() method.
|
void |
initialize(Subject subject,
CallbackHandler callbackHandler,
Map<String,?> sharedState,
Map<String,?> options)
Initialize this LoginModule.
|
protected void |
loadRoles()
Loads the roles Properties from the defaultRolesRsrcName and rolesRsrcName
resource settings.
|
protected void |
loadUsers()
Loads the users Properties from the defaultUsersRsrcName and usersRsrcName
resource settings.
|
boolean |
login()
Method to authenticate a Subject (phase 1).
|
protected void |
parseGroupMembers(Group group,
String roles)
Parse the comma delimited roles names given by value and add them to
group.
|
createPasswordHash, getCredentials, getIdentity, getUnauthenticatedIdentity, getUsername, getUsernameAndPassword, getValidateError, safeClose, setValidateError, validatePassword
abort, addValidOptions, checkOptions, commit, createGroup, createIdentity, getCallerPrincipalGroup, getUseFirstPass, logout
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String,?> sharedState, Map<String,?> options)
initialize
in interface LoginModule
initialize
in class UsernamePasswordLoginModule
options
- - the login module option map. Supported options include:
usersProperties: The name of the properties resource containing
user/passwords. The default is "users.properties"
rolesProperties: The name of the properties resource containing user/roles
The default is "roles.properties".
roleGroupSeperator: The character used to seperate the role group name from
the username e.g., '.' in jduke.CallerPrincipal=... . The default = '.'.
defaultUsersProperties=string: The name of the properties resource containing
the username to password mappings that will be used as the defaults
Properties passed to the usersProperties Properties. This defaults to
defaultUsers.properties.
defaultRolesProperties=string: The name of the properties resource containing
the username to roles mappings that will be used as the defaults
Properties passed to the usersProperties Properties. This defaults to
defaultRoles.properties.subject
- the Subject to update after a successful login.callbackHandler
- the CallbackHandler that will be used to obtain the
the user identity and credentials.sharedState
- a Map shared between all configured login module instancespublic boolean login() throws LoginException
login
in interface LoginModule
login
in class UsernamePasswordLoginModule
LoginException
- thrown if the users or roles properties files
were not found or the super.login method fails.protected Group[] getRoleSets() throws LoginException
getRoleSets
in class AbstractServerLoginModule
LoginException
protected String getUsersPassword()
UsernamePasswordLoginModule
getUsersPassword
in class UsernamePasswordLoginModule
protected void loadUsers() throws IOException
IOException
- - thrown on failure to load the properties file.protected Properties createUsers(Map<String,?> options) throws IOException
options
- - the login module options passed to initializeIOException
- - thrown on failure to load the propertiesprotected void loadRoles() throws IOException
IOException
- - thrown on failure to load the properties file.protected Properties createRoles(Map<String,?> options) throws IOException
options
- - the login module options passed to initializeIOException
- - thrown on failure to load the propertiesprotected void parseGroupMembers(Group group, String roles)
group
- - the Group to add the roles to.roles
- - the comma delimited role names.AbstractServerLoginModule.createIdentity(String)
Copyright © 2019 JBoss by Red Hat. All rights reserved.