edu.vt.middleware.ldap.jaas.JaasAuthenticator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vt-ldap Show documentation
Show all versions of vt-ldap Show documentation
Library for performing common LDAP operations
/*
$Id: JaasAuthenticator.java 1330 2010-05-23 22:10:53Z dfisher $
Copyright (C) 2003-2010 Virginia Tech.
All rights reserved.
SEE LICENSE FOR MORE INFORMATION
Author: Middleware Services
Email: [email protected]
Version: $Revision: 1330 $
Updated: $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
*/
package edu.vt.middleware.ldap.jaas;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import edu.vt.middleware.ldap.auth.Authenticator;
import edu.vt.middleware.ldap.auth.AuthenticatorConfig;
import edu.vt.middleware.ldap.auth.handler.AuthenticationResultHandler;
import edu.vt.middleware.ldap.auth.handler.AuthorizationHandler;
/**
* JaasAuthenticator
is the default implementation for JAAS
* authentication.
*
* @author Middleware Services
* @version $Revision: 1330 $ $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
*/
public class JaasAuthenticator extends Authenticator
{
/** serial version uid. */
private static final long serialVersionUID = -7884185473690369247L;
/** Default constructor. */
public JaasAuthenticator() {}
/**
* This will create a new JaasAuthenticator
with the supplied
* AuthenticatorConfig
.
*
* @param authConfig AuthenticatorConfig
*/
public JaasAuthenticator(final AuthenticatorConfig authConfig)
{
this.setAuthenticatorConfig(authConfig);
}
/** {@inheritDoc} */
public Attributes authenticate(
final String user,
final Object credential,
final String[] retAttrs)
throws NamingException
{
return super.authenticate(user, credential, retAttrs);
}
/** {@inheritDoc} */
public Attributes authenticate(
final String user,
final Object credential,
final String[] retAttrs,
final AuthenticationResultHandler[] authHandler,
final AuthorizationHandler[] authzHandler)
throws NamingException
{
if (retAttrs != null && retAttrs.length == 0) {
return
this.authenticateAndAuthorize(
this.getDn(user),
credential,
false,
retAttrs,
authHandler,
authzHandler);
} else {
return
this.authenticateAndAuthorize(
this.getDn(user),
credential,
true,
retAttrs,
authHandler,
authzHandler);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy