public Subject authenticateUser(AuthenticationService authenticationService, String userName,
                                    String jaasEntryName, String customCacheKey) throws AuthenticationException
    {
        validateInput(authenticationService, userName);
        if (jaasEntryName == null || jaasEntryName.trim().isEmpty())
            jaasEntryName = JaasLoginConfigConstants.SYSTEM_DEFAULT;

        Subject partialSubject = createPartialSubject(userName, authenticationService, customCacheKey);
        return authenticationService.authenticate(jaasEntryName, partialSubject);
    }
public Subject authenticateUser ( AuthenticationService authenticationService , String userName , String jaasEntryName , String customCacheKey ) throws AuthenticationException { validateInput ( authenticationService , userName ) ; if ( jaasEntryName == null || jaasEntryName . trim ( ) . isEmpty ( ) ) jaasEntryName = JaasLoginConfigConstants . SYSTEM_DEFAULT ; Subject partialSubject = createPartialSubject ( userName , authenticationService , customCacheKey ) ; return authenticationService . authenticate ( jaasEntryName , partialSubject ) ; }
Authenticate the given user and return an authenticated Subject.

@param authenticationService service to authenticate a user, must not be null
@param userName the user to authenticate, must not be null
@param jaasEntryName the optional JAAS configuration entry name. The system.DEFAULT JAAS entry name will be used if null or empty String is passed
@param customCacheKey The custom cache key to look up the subject
@return the authenticated subject
@throws AuthenticationException if there was a problem authenticating the user, or if the userName or authenticationService is null