public class DatabaseServerLoginModule extends UsernamePasswordLoginModule
LoginModule options:
"select Password from Principals where PrincipalID=?"
"select Role, RoleGroup from Roles where PrincipalID=?"
Modifier and Type | Field and Description |
---|---|
protected String |
dsJndiName
The JNDI name of the DataSource to use
|
protected String |
principalsQuery
The sql query to obtain the user password
|
protected String |
rolesQuery
The sql query to obtain the user roles
|
protected boolean |
suspendResume
Whether to suspend resume transactions during database operations
|
protected TransactionManager |
tm
The TransactionManagaer instance to be used
|
protected String |
txManagerJndiName
The JNDI name of the transaction manager
|
callbackHandler, jbossModuleName, log, loginOk, options, principalClassModuleName, principalClassName, sharedState, subject, unauthenticatedIdentity, useFirstPass
Constructor and Description |
---|
DatabaseServerLoginModule() |
Modifier and Type | Method and Description |
---|---|
protected String |
convertRawPassword(String rawPassword)
A hook to allow subclasses to convert a password from the database
into a plain text string or whatever form is used for matching against
the user input.
|
protected Group[] |
getRoleSets()
Execute the rolesQuery against the dsJndiName to obtain the roles for
the authenticated user.
|
protected TransactionManager |
getTransactionManager() |
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.
|
createPasswordHash, getCredentials, getIdentity, getUnauthenticatedIdentity, getUsername, getUsernameAndPassword, getValidateError, login, safeClose, setValidateError, validatePassword
abort, addValidOptions, checkOptions, commit, createGroup, createIdentity, getCallerPrincipalGroup, getUseFirstPass, logout
protected String dsJndiName
protected String principalsQuery
protected String rolesQuery
protected boolean suspendResume
protected String txManagerJndiName
protected TransactionManager tm
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String,?> sharedState, Map<String,?> options)
initialize
in interface LoginModule
initialize
in class UsernamePasswordLoginModule
options
- -
dsJndiName: The name of the DataSource of the database containing the
Principals, Roles tables
principalsQuery: The prepared statement query, equivalent to:
"select Password from Principals where PrincipalID=?"
rolesQuery: The prepared statement query, equivalent to:
"select Role, RoleGroup from Roles where PrincipalID=?"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 instancesprotected String getUsersPassword() throws LoginException
getUsersPassword
in class UsernamePasswordLoginModule
LoginException
protected Group[] getRoleSets() throws LoginException
getRoleSets
in class AbstractServerLoginModule
LoginException
protected String convertRawPassword(String rawPassword)
rawPassword
- - the password as obtained from the databaseprotected TransactionManager getTransactionManager() throws NamingException
NamingException
Copyright © 2020 JBoss by Red Hat. All rights reserved.