|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.n52.security.authentication.loginmodule.AbstractLoginModule
org.n52.security.authentication.loginmodule.AbstractPasswordLoginModule
org.n52.security.authentication.loginmodule.SingleUserLoginModule
public class SingleUserLoginModule
Class SingleUserLoginModule is a simple login module wich only knows a single user.
This user and his credentials are configured by the options of this login module.allowedUsername
defines the name of the allowed user.allowedPassword
defines the password of the allowed user.pwdEncAlg
defines the encryption allgorithmen wihtin the password is
stored, valid values are 'plain','md5', 'sha'.userRoles
defines a pipe separated list of user roles, wich will be applied as
RolePrincipal
s if the login succeeded.
LoginNamePrincipal
which holds the login name identiy of the user
and his authentication date.
Field Summary | |
---|---|
protected static java.lang.String |
OPTION_ALLOWED_PASSWORD
Field OPTION_ALLOWED_PASSWORD identifies the 'allowedPassword' option. |
protected static java.lang.String |
OPTION_ALLOWED_USERNAME
Field OPTION_ALLOWED_USERNAME identifies the 'allowedUsername' option. |
protected static java.lang.String |
OPTION_PASSWORD_ENCRYPTION_ALG
Field OPTION_PASSWORD_ENCRYPTION_ALG identifies the 'pwdEncAlg' option. |
protected static java.lang.String |
OPTION_USERROLES
Field OPTION_USERROLES identifies the 'userRoles' option. |
Fields inherited from class org.n52.security.authentication.loginmodule.AbstractLoginModule |
---|
m_callbackHandler, m_commitSucceeded, m_loginSucceeded, m_options, m_principals, m_privateCredentials, m_publicCredentials, m_sharedState, m_subject |
Constructor Summary | |
---|---|
SingleUserLoginModule()
|
Method Summary | |
---|---|
protected java.lang.String |
getDescription()
Gets a short description of this login module. |
protected void |
initialize()
This initializes the login module. |
protected boolean |
login(java.lang.String username,
char[] password)
This checks for the correct username and password, they must be equal to the values of the options allowedUsername and allowedPassword . |
protected void |
prepareCommitState()
Prepares a LoginNamePrincipal with out of the username, and some RolePrincipals from the userRoles option, all within the global scope . |
Methods inherited from class org.n52.security.authentication.loginmodule.AbstractPasswordLoginModule |
---|
clearAuthenticationState, getPassword, getUsername, isEqual, performLogin |
Methods inherited from class org.n52.security.authentication.loginmodule.AbstractLoginModule |
---|
abort, addPrincipal, addPrivateCredential, addPublicCredential, clearInternalState, commit, commitState, destroy, getCallbackHandler, getOptions, getPrincipals, getPrivateCredentials, getPublicCredentials, getSharedState, getSubject, handleCallbacks, initialize, isCallbackHandlerSet, isCommitSucceeded, isLoginSucceeded, login, logout, setCommitSucceeded, setLoginSucceeded, showModuleBanner |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String OPTION_ALLOWED_PASSWORD
OPTION_PASSWORD_ENCRYPTION_ALG
,
Constant Field Valuesprotected static final java.lang.String OPTION_PASSWORD_ENCRYPTION_ALG
protected static final java.lang.String OPTION_ALLOWED_USERNAME
protected static final java.lang.String OPTION_USERROLES
Constructor Detail |
---|
public SingleUserLoginModule()
Method Detail |
---|
protected java.lang.String getDescription()
getDescription
in class AbstractLoginModule
AbstractLoginModule.getDescription()
protected void initialize()
allowedUsername
and
allowedPassword
from the login module options and stores them localy.
initialize
in class AbstractLoginModule
AbstractLoginModule.initialize()
protected boolean login(java.lang.String username, char[] password) throws javax.security.auth.login.LoginException
allowedUsername
and allowedPassword
.
If the options "try_mapped_pass" or "use_mapped_pass" are set and the allowed password is encrypted, than the
method tries to calculate the hash for the given password. Otherwise the password is treaten as string
representation of the hash and directly compared. A string representation of one hash byte is a his hexadecimal
m_value written with two digits.
login
in class AbstractPasswordLoginModule
username
- the username.password
- the password.
javax.security.auth.login.LoginException
- if the username or password are incorrect or the login module is wrong configured.AbstractPasswordLoginModule.login(String,char[])
protected void prepareCommitState() throws javax.security.auth.login.LoginException
global scope
.
prepareCommitState
in class AbstractLoginModule
javax.security.auth.login.LoginException
- if an error occurs.AbstractLoginModule.prepareCommitState()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |