Class LoginModuleImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule
-
- org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl
-
- All Implemented Interfaces:
LoginModule
public final class LoginModuleImpl extends AbstractLoginModule
Default login module implementation that authenticates JCRCredentialsagainst the repository. Based on the credentials thePrincipals associated with user are retrieved from a configurablePrincipalProvider.Credentials
TheCredentialsare collected duringlogin()using the following logic:Credentialsas specified inRepository.login(javax.jcr.Credentials)in which case they are retrieved from theCallbackHandler.- A
AbstractLoginModule.SHARED_KEY_CREDENTIALSentry in the shared state. The expected value is a validated singleCredentialsobject. - If neither of the above variants provides Credentials this module
tries to obtain them from the subject. See also
Subject.getSubject(java.security.AccessControlContext)
LoginModulecurrently supports the following types of JCR Credentials: TheCredentialsobtained during the#login()are added to the shared state and - upon successful#commit()to theSubject.Principals
Upon successful login the principals associated with the user are calculated (see alsoAbstractLoginModule.getPrincipals(String). These principals are finally added to the subject during#commit().Impersonation
Impersonation such as defined bySession.impersonate(javax.jcr.Credentials)is covered by this login module by the means ofImpersonationCredentials. Impersonation will succeed if thebase credentialsrefer to a valid user that has not been disabled. If the authenticating subject is not allowed to impersonate the specified user, the login attempt will fail withLoginException.Please note, that a user will always be allowed to impersonate him/herself irrespective of the impersonation definitions exposed by
User.getImpersonation()
-
-
Field Summary
Fields Modifier and Type Field Description protected static Set<Class>SUPPORTED_CREDENTIALS-
Fields inherited from class org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule
callbackHandler, options, SHARED_KEY_ATTRIBUTES, SHARED_KEY_CREDENTIALS, SHARED_KEY_LOGIN_NAME, SHARED_KEY_PRE_AUTH_LOGIN, sharedState, subject
-
-
Constructor Summary
Constructors Constructor Description LoginModuleImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclearState()Clear state information that has been created duringLoginModule.login().booleancommit()protected @NotNull Set<Class>getSupportedCredentials()booleanlogin()booleanlogout()Besteffort default implementation ofLoginModule.logout(), which removes all principals and all public credentials of typeCredentialsandAuthInfofrom the subject.-
Methods inherited from class org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule
abort, closeSystemSession, getCredentials, getLoginModuleMonitor, getPrincipalProvider, getPrincipals, getPrincipals, getRoot, getSecurityProvider, getSharedCredentials, getSharedLoginName, getSharedPreAuthLogin, getUserManager, getWhiteboard, initialize, logout, onError, setAuthInfo
-
-
-
-
Method Detail
-
login
public boolean login() throws LoginException- Throws:
LoginException
-
commit
public boolean commit()
-
logout
public boolean logout() throws LoginExceptionDescription copied from class:AbstractLoginModuleBesteffort default implementation ofLoginModule.logout(), which removes all principals and all public credentials of typeCredentialsandAuthInfofrom the subject. It will returnfalse, if either principal set or credentials set is empty. Note, that this implementation is not able to only remove those principals/credentials that have been added bythisvery login module instance. Therefore subclasses should overwrite this method to provide a fully compliant solution ofAbstractLoginModule.logout(). They may however take advantage ofAbstractLoginModule.logout(Set, Set)in order to simplify the implementation of a logout that is compatible with theLoginModule.logout()contract incorporating the additional recommendations highlighted at JAAS LoginModule Dev Guide- Specified by:
logoutin interfaceLoginModule- Overrides:
logoutin classAbstractLoginModule- Returns:
trueif neither principals nor public credentials of typeCredentialsorAuthInfostored in theSubjectare empty;falseotherwise- Throws:
LoginException- if the subject is readonly and destroyingDestroyablecredentials fails withDestroyFailedException.
-
getSupportedCredentials
@NotNull protected @NotNull Set<Class> getSupportedCredentials()
- Specified by:
getSupportedCredentialsin classAbstractLoginModule- Returns:
- A set of supported credential classes.
-
clearState
protected void clearState()
Description copied from class:AbstractLoginModuleClear state information that has been created duringLoginModule.login().- Overrides:
clearStatein classAbstractLoginModule
-
-