Ejemplo n.º 1
0
  /**
   * @param principal Principal used to retrieve the <code>Authentication</code> object.
   * @param credentials Credentials used for the authentication.
   * @return <code>true</code> if Credentials authenticate, <code>false</code> if no <code>
   *     Authentication</code> can handle the given <code>Credentials</code>
   * @throws javax.security.auth.login.FailedLoginException if the authentication failed.
   * @throws RepositoryException If another error occurs.
   * @see AbstractLoginModule#getAuthentication(java.security.Principal, javax.jcr.Credentials)
   * @see AbstractLoginModule#authenticate(java.security.Principal, javax.jcr.Credentials)
   */
  protected boolean authenticate(Principal principal, Credentials credentials)
      throws FailedLoginException, RepositoryException {

    Authentication auth = getAuthentication(principal, credentials);
    if (auth == null) {
      return false;
    } else if (auth.authenticate(credentials)) {
      return true;
    }
    throw new FailedLoginException();
  }
Ejemplo n.º 2
0
 /** Determine if a set of credentials are valid. */
 public boolean authenticate(String user, String password)
     throws TooManyAuthenticationAttemptsException {
   return authentication.authenticate(user, password);
 }