class NpmTokenManager extends BearerTokenManager {

  public String login(final String username, final String password) {
    checkNotNull(username);
    checkNotNull(password);

    try {
      AuthenticationInfo authenticationInfo = securityHelper.getSecurityManager().authenticate(
          new UsernamePasswordToken(username, password));
      return super.createToken(authenticationInfo.getPrincipals());
    }
    catch (AuthenticationException e) {
      log.debug("Bad credentials provided for npm token creation", e);
      return null;
    }
  }

  @Inject public  NpmTokenManager(final ApiKeyStore apiKeyStore, final SecurityHelper securityHelper);

}