@Override public Authenticator<BasicCredentials, User> build(DSLContext dslContext) { logger.debug("Creating LDAP authenticator"); LdapConnectionFactory connectionFactory = new LdapConnectionFactory(getServer(), getPort(), getUserDN(), getPassword(), getTrustStorePath(), getTrustStorePassword(), getTrustStoreType()); return new LdapAuthenticator(connectionFactory, getLookup()); }
@Inject public SessionLoginResource(@Readonly Authenticator<BasicCredentials, User> userAuthenticator, AuthenticatedEncryptedCookieFactory cookieFactory, XsrfProtection xsrfProtection) { this.userAuthenticator = userAuthenticator; this.cookieFactory = cookieFactory; this.xsrfProtection = xsrfProtection; }
public static Authenticator<BasicCredentials, Principal> getBasicAuthenticator(final List<String> validUsers) { return credentials -> { if (validUsers.contains(credentials.getUsername()) && "secret".equals(credentials.getPassword())) { return Optional.<Principal>of(new PrincipalImpl(credentials.getUsername())); } if ("bad-guy".equals(credentials.getUsername())) { throw new AuthenticationException("CRAP"); } return Optional.empty(); }; }
public static Authenticator<String, Principal> getSingleUserOAuthAuthenticator(final String presented, final String returned) { return user -> { if (presented.equals(user)) { return Optional.<Principal>of(new PrincipalImpl(returned)); } if ("bad-guy".equals(user)) { throw new AuthenticationException("CRAP"); } return Optional.empty(); }; }
public static Authenticator<String, Principal> getMultiplyUsersOAuthAuthenticator(final List<String> validUsers) { return credentials -> { if (validUsers.contains(credentials)) { return Optional.<Principal>of(new PrincipalImpl(credentials)); } if (credentials.equals("bad-guy")) { throw new AuthenticationException("CRAP"); } return Optional.empty(); }; }
@Override public Authenticator<BasicCredentials, User> build(DSLContext dslContext) { logger.debug("Creating BCrypt authenticator"); UserDAO userDAO = new UserDAO(dslContext); return new BcryptAuthenticator(userDAO); }
@Provides @Singleton @Readonly Authenticator<BasicCredentials, User> authenticator(KeywhizConfig config, @Readonly DSLContext jooqContext) { return config.getUserAuthenticatorFactory().build(jooqContext); }
/** * Builds an authenticator from username/password credentials to a {@link User}. */ Authenticator<BasicCredentials, User> build(DSLContext dslContext);