All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yammer.dropwizard.authenticator.UserResourceAuthenticator Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show newest version
package com.yammer.dropwizard.authenticator;

import io.dropwizard.auth.AuthenticationException;
import io.dropwizard.auth.Authenticator;
import io.dropwizard.auth.basic.BasicCredentials;

import java.util.Optional;

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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy