Skip to content

Instantly share code, notes, and snippets.

@javaeeeee
Created February 10, 2015 03:48
Show Gist options
  • Select an option

  • Save javaeeeee/248cfaca3b4a1eb5688c to your computer and use it in GitHub Desktop.

Select an option

Save javaeeeee/248cfaca3b4a1eb5688c to your computer and use it in GitHub Desktop.
Dropwizard Authenticator Subclass
public class GreetingAuthenticator
implements Authenticator<BasicCredentials, User> {
@Override
public Optional<User> authenticate(BasicCredentials credentials)
throws AuthenticationException {
if ("crimson".equals(credentials.getPassword())) {
return Optional.of(new User());
} else {
return Optional.absent();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment