Example usage for org.apache.shiro.ldap UnsupportedAuthenticationMechanismException UnsupportedAuthenticationMechanismException

List of usage examples for org.apache.shiro.ldap UnsupportedAuthenticationMechanismException UnsupportedAuthenticationMechanismException

Introduction

In this page you can find the example usage for org.apache.shiro.ldap UnsupportedAuthenticationMechanismException UnsupportedAuthenticationMechanismException.

Prototype

public UnsupportedAuthenticationMechanismException(String message, Throwable cause) 

Source Link

Usage

From source file:org.ow2.proactive.iam.core.realms.LdapRealm.java

License:Open Source License

/**
 * Delegates to {@link #queryForAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken, LdapContextFactory)},
 * wrapping any {@link NamingException}s in a Shiro {@link AuthenticationException} to satisfy the parent method
 * signature.//from   w  ww  .j  a v a 2 s  . com
 *
 * @param token the authentication token containing the user's principal and credentials.
 * @return the {@link AuthenticationInfo} acquired after a successful authentication attempt
 * @throws AuthenticationException if the authentication attempt fails or if a
 *                                 {@link NamingException} occurs.
 */
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
    AuthenticationInfo info;
    try {
        info = queryForAuthenticationInfo(token, getContextFactory());
    } catch (AuthenticationNotSupportedException e) {
        String msg = "Unsupported configured authentication mechanism";
        throw new UnsupportedAuthenticationMechanismException(msg, e);
    } catch (javax.naming.AuthenticationException e) {
        throw new AuthenticationException("LDAP authentication failed.", e);
    } catch (NamingException e) {
        String msg = "LDAP naming error while attempting to authenticate user.";
        throw new AuthenticationException(msg, e);
    }

    return info;
}