T
- type of AuthenticatorConfigpublic abstract class AbstractAuthenticator<T extends AuthenticatorConfig> extends Object
AbstractAuthenticator
provides basic functionality for
authenticating against an LDAP.Modifier and Type | Field and Description |
---|---|
protected T |
config
Authenticator configuration environment.
|
protected org.apache.commons.logging.Log |
logger
Log for this class.
|
Constructor and Description |
---|
AbstractAuthenticator() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
authenticateAndAuthorize(String dn,
Object credential,
AuthenticationResultHandler[] authResultHandler,
AuthorizationHandler[] authzHandler)
This will authenticate by binding to the LDAP with the supplied dn and
credential.
|
protected Attributes |
authenticateAndAuthorize(String dn,
Object credential,
boolean searchAttrs,
String[] retAttrs,
AuthenticationResultHandler[] authResultHandler,
AuthorizationHandler[] authzHandler)
This will authenticate by binding to the LDAP with the supplied dn and
credential.
|
void |
close()
This will close the connection on the underlying DN resolver.
|
void |
setAuthenticatorConfig(T authConfig)
This will set the config parameters of this
Authenticator . |
protected final org.apache.commons.logging.Log logger
protected T extends AuthenticatorConfig config
public void setAuthenticatorConfig(T authConfig)
Authenticator
.authConfig
- AuthenticatorConfig
protected boolean authenticateAndAuthorize(String dn, Object credential, AuthenticationResultHandler[] authResultHandler, AuthorizationHandler[] authzHandler) throws NamingException
authenticateAndAuthorize( String, Object, boolean,
String[], AuthenticationResultHandler[], AuthorizationHandler[])
.dn
- String
for bindcredential
- Object
for bindauthResultHandler
- AuthenticationResultHandler[]
to
post process authentication resultsauthzHandler
- AuthorizationHandler[]
to process
authorization after authenticationboolean
- whether the bind succeededNamingException
- if the authentication fails for any other reason
than invalid credentialsprotected Attributes authenticateAndAuthorize(String dn, Object credential, boolean searchAttrs, String[] retAttrs, AuthenticationResultHandler[] authResultHandler, AuthorizationHandler[] authzHandler) throws NamingException
LdapConfig.getAuthtype()
is set to 'none'. If retAttrs is null
and searchAttrs is true then all user attributes will be returned. If
retAttrs is an empty array and searchAttrs is true then no attributes will
be returned. This method throws AuthenticationException if authentication
fails and AuthorizationException if authorization fails.dn
- String
for bindcredential
- Object
for bindsearchAttrs
- boolean
whether to perform attribute
searchretAttrs
- String[]
user attributes to returnauthResultHandler
- AuthenticationResultHandler[]
to
post process authentication resultsauthzHandler
- AuthorizationHandler[]
to process
authorization after authenticationAttribute
- belonging to the supplied user, returns
null if searchAttrs is falseNamingException
- if any of the ldap operations failAuthenticationException
- if authentication failsAuthorizationException
- if authorization failspublic void close()
Copyright © 2014. All rights reserved.