Class JaasAuthenticationHandler
- java.lang.Object
-
- org.apereo.cas.authentication.AbstractAuthenticationHandler
-
- org.apereo.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler
-
- org.apereo.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler
-
- org.apereo.cas.authentication.handler.support.jaas.JaasAuthenticationHandler
-
- All Implemented Interfaces:
org.apereo.cas.authentication.AuthenticationHandler,org.apereo.cas.authentication.PrePostAuthenticationHandler,org.springframework.core.Ordered
public class JaasAuthenticationHandler extends AbstractUsernamePasswordAuthenticationHandler
JAAS Authentication Handler for CAAS. This is a simple bridge from CAS' authentication to JAAS.Using the JAAS Authentication Handler requires you to configure the appropriate JAAS modules. You can specify the location of a jass.conf file using the following VM parameter:
-Djava.security.auth.login.config=$PATH_TO_JAAS_CONF/jaas.conf
This example jaas.conf would try Kerberos based authentication, then try LDAP authentication:
CAS { com.sun.security.auth.module.Krb5LoginModule sufficient client=TRUE debug=FALSE useTicketCache=FALSE; edu.uconn.netid.jaas.LDAPLoginModule sufficient java.naming.provider.url="ldap://ldapserver.my.edu:389/dc=my,dc=edu" java.naming.security.principal="uid=jaasauth,dc=my,dc=edu" java.naming.security.credentials="password" Attribute="uid" startTLS="true"; };- Since:
- 3.0.0
- See Also:
CallbackHandler,PasswordCallback,NameCallback
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classJaasAuthenticationHandler.UsernamePasswordCallbackHandlerA simple JAAS CallbackHandler which accepts a Name String and Password String in the constructor.
-
Field Summary
-
Fields inherited from class org.apereo.cas.authentication.AbstractAuthenticationHandler
credentialSelectionPredicate, principalFactory, servicesManager
-
Fields inherited from class org.apereo.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler
passwordPolicyHandlingStrategy
-
-
Constructor Summary
Constructors Constructor Description JaasAuthenticationHandler(java.lang.String name, org.apereo.cas.services.ServicesManager servicesManager, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, java.lang.Integer order)Instantiates a new Jaas authentication handler, and attempts to load/verify the configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apereo.cas.authentication.principal.PrincipalauthenticateAndGetPrincipal(UsernamePasswordCredential credential)Authenticate and get principal principal.protected org.apereo.cas.authentication.AuthenticationHandlerExecutionResultauthenticateUsernamePasswordInternal(UsernamePasswordCredential credential, java.lang.String originalPassword)Authenticates a username/password credential by an arbitrary strategy with extra parameter original credential password before encoding password.protected javax.security.auth.login.LoginContextgetLoginContext(UsernamePasswordCredential credential)Gets login context.-
Methods inherited from class org.apereo.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler
authenticate, createHandlerResult, createHandlerResult
-
Methods inherited from class org.apereo.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler
doAuthentication, matches, supports, supports
-
Methods inherited from interface org.apereo.cas.authentication.AuthenticationHandler
getName, getOrder
-
-
-
-
Constructor Detail
-
JaasAuthenticationHandler
public JaasAuthenticationHandler(java.lang.String name, org.apereo.cas.services.ServicesManager servicesManager, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, java.lang.Integer order)Instantiates a new Jaas authentication handler, and attempts to load/verify the configuration.- Parameters:
name- the nameservicesManager- the services managerprincipalFactory- the principal factoryorder- the order
-
-
Method Detail
-
authenticateUsernamePasswordInternal
protected org.apereo.cas.authentication.AuthenticationHandlerExecutionResult authenticateUsernamePasswordInternal(UsernamePasswordCredential credential, java.lang.String originalPassword) throws java.security.GeneralSecurityException
Description copied from class:AbstractUsernamePasswordAuthenticationHandlerAuthenticates a username/password credential by an arbitrary strategy with extra parameter original credential password before encoding password. Override it if implementation need to use original password for authentication.- Specified by:
authenticateUsernamePasswordInternalin classAbstractUsernamePasswordAuthenticationHandler- Parameters:
credential- the credential object bearing the transformed username and password.originalPassword- original password from credential before password encoding- Returns:
- AuthenticationHandlerExecutionResult resolved from credential on authentication success or null if no principal could be resolved from the credential.
- Throws:
java.security.GeneralSecurityException- On authentication failure.
-
authenticateAndGetPrincipal
protected org.apereo.cas.authentication.principal.Principal authenticateAndGetPrincipal(UsernamePasswordCredential credential) throws java.security.GeneralSecurityException
Authenticate and get principal principal.- Parameters:
credential- the credential- Returns:
- the principal
- Throws:
java.security.GeneralSecurityException- the general security exception
-
getLoginContext
protected javax.security.auth.login.LoginContext getLoginContext(UsernamePasswordCredential credential) throws java.security.GeneralSecurityException
Gets login context.- Parameters:
credential- the credential- Returns:
- the login context
- Throws:
java.security.GeneralSecurityException- the general security exception
-
-