com.yammer.dropwizard.authenticator.UserResourceAuthenticator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-auth-ldap Show documentation
Show all versions of dropwizard-auth-ldap Show documentation
Dropwizard Authentication Module for LDAP using JNDI
package com.yammer.dropwizard.authenticator;
import com.google.common.base.Optional;
import io.dropwizard.auth.AuthenticationException;
import io.dropwizard.auth.Authenticator;
import io.dropwizard.auth.basic.BasicCredentials;
import static com.google.common.base.Preconditions.checkNotNull;
public class UserResourceAuthenticator implements Authenticator {
private final LdapAuthenticator ldapAuthenticator;
public UserResourceAuthenticator(LdapAuthenticator ldapAuthenticator) {
this.ldapAuthenticator = checkNotNull(ldapAuthenticator);
}
@Override
public Optional authenticate(BasicCredentials credentials) throws AuthenticationException {
return ldapAuthenticator.authenticateAndReturnPermittedGroups(credentials);
}
}