for ( final AuthenticationProvider authProvider : authProviders ) {
final AuthenticationResult result = authProvider.authenticate( credential, context );
if ( result.getStatus().equals( FAILED ) ) {
authScheme.challengeClient( httpContext );
throw new AuthenticationException( "Invalid credentials." );
} else if ( result.getStatus().equals( SUCCESS ) ) {
principal = result.getPrincipal();
break all_auth;
}
}
}
}
if ( principal == null ) {
throw new AuthenticationException( "Invalid credentials." );
}
final List<Role> roles = new ArrayList<Role>();
if ( isRememberOp ) {
roles.add( new RoleImpl( ROLE_REMEMBER_ME ) );