private AuthenticatedUser authenticateUser(Credentials credentials) throws GuacamoleException {
  GuacamoleCredentialsException authFailure=null;
  for (  AuthenticationProvider authProvider : authProviders) {
    try {
      AuthenticatedUser authenticatedUser=authProvider.authenticateUser(credentials);
      if (authenticatedUser != null)       return authenticatedUser;
    }
 catch (    GuacamoleCredentialsException e) {
      if (authFailure == null)       authFailure=e;
    }
  }
  if (authFailure != null)   throw authFailure;
  throw new GuacamoleInvalidCredentialsException("Permission Denied.",CredentialsInfo.USERNAME_PASSWORD);
}

private AuthenticatedUser authenticateUser ( Credentials credentials ) throws GuacamoleException { GuacamoleCredentialsException authFailure = null ; for ( AuthenticationProvider authProvider : authProviders ) { try { AuthenticatedUser authenticatedUser = authProvider . authenticateUser ( credentials ) ; if ( authenticatedUser != null ) return authenticatedUser ; } catch ( GuacamoleCredentialsException e ) { if ( authFailure == null ) authFailure = e ; } } if ( authFailure != null ) throw authFailure ; throw new GuacamoleInvalidCredentialsException ( "Permission Denied." , CredentialsInfo . USERNAME_PASSWORD ) ; }
attempts authentication against all authenticationproviders , in order , using the provided credentials . the first authentication failure takes priority , but remaining authenticationproviders are attempted . if any authenticationprovider succeeds , the resulting authenticateduser is returned , and no further authenticationproviders are tried .
