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

com.brightsparklabs.dropwizard.bundles.auth.external.DevAuthenticator Maven / Gradle / Ivy

The newest version!
/*
 * Maintained by brightSPARK Labs.
 * www.brightsparklabs.com
 *
 * Refer to LICENSE at repository root for license details.
 */

package com.brightsparklabs.dropwizard.bundles.auth.external;

import io.dropwizard.auth.AuthenticationException;
import java.security.Principal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Authenticator for use during development only.
 *
 * @param 

Type of {@link Principal} to return for authenticated users. * @author brightSPARK Labs */ public class DevAuthenticator

extends ExternalAuthenticator { // ------------------------------------------------------------------------- // CONSTANTS // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // CLASS VARIABLES // ------------------------------------------------------------------------- /** Class logger */ private static final Logger logger = LoggerFactory.getLogger(DevAuthenticator.class); // ------------------------------------------------------------------------- // INSTANCE VARIABLES // ------------------------------------------------------------------------- /** User to return */ private final InternalUser user; // ------------------------------------------------------------------------- // CONSTRUCTION // ------------------------------------------------------------------------- /** * Creates a new authenticator which always returns the User from configuration. For use during * development only * * @param principalConverter Converter between {@link InternalUser} and the {@link Principal} * used in the system. * @param user user to return */ DevAuthenticator( final PrincipalConverter

principalConverter, final InternalUser user, final Iterable listeners) { super(principalConverter, listeners); this.user = user; } // ------------------------------------------------------------------------- // IMPLEMENTATION: ExternalAuthenticator // ------------------------------------------------------------------------- @Override public InternalUser doAuthenticate(final String credentials) throws AuthenticationException, AuthenticationDeniedException { logger.warn("********** USING DEV MODE AUTHENTICATOR. DO NOT USE IN PRODUCTION **********"); return user; } // ------------------------------------------------------------------------- // PUBLIC METHODS // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // PRIVATE METHODS // ------------------------------------------------------------------------- }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy