Source:
private void handleCredentials(HttpServletRequest request, String user, String password) { UserProfile userProfile = translateUser(user); if (userProfile == null || userProfile.profile == null) { log.error("Cannot obtain profile for user {}", user); } else { ExtMap outputMap = userProfile.profile.getAuthn().invoke(new ExtMap().mput( Base.InvokeKeys.COMMAND, Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS ).mput( Authn.InvokeKeys.USER, userProfile.userName ).mput( Authn.InvokeKeys.CREDENTIALS, password ) ); if (outputMap.<Integer> get(Base.InvokeKeys.RESULT) == Base.InvokeResult.SUCCESS && outputMap.<Integer> get(Authn.InvokeKeys.RESULT) == Authn.AuthResult.SUCCESS) { request.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY, outputMap.<ExtMap> get(Authn.InvokeKeys.AUTH_RECORD)); request.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_TYPE_KEY, AuthType.CREDENTIALS); request.setAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY, userProfile.profile.getName()); request.setAttribute(FiltersHelper.Constants.REQUEST_PASSWORD_KEY, password); } else { if (outputMap.<Integer> get(Base.InvokeKeys.RESULT) != Base.InvokeResult.SUCCESS || outputMap.<Integer> get(Authn.InvokeKeys.RESULT) != Authn.AuthResult.SUCCESS) { AcctUtils.reportRecords( Acct.ReportReason.PRINCIPAL_LOGIN_FAILED, userProfile.userName, null, null, "Basic authentication failed for User %1$s.", userProfile.userName ); } log.error("User authentication failed. profile is {}. Invocation Result code is {}. Authn result code is {}", userProfile.userName, userProfile.profile.getName(), outputMap.<Integer> get(Base.InvokeKeys.RESULT), outputMap.<Integer> get(Authn.InvokeKeys.RESULT) ); } } }

Target:
private void handleCredentials(HttpServletRequest request, String user, String password) { UserProfile userProfile = translateUser(user); if (userProfile == null || userProfile.profile == null) { log.error("Cannot obtain profile for user {}", user); } else { ExtMap outputMap = userProfile.profile.getAuthn().invoke(new ExtMap().mput( Base.InvokeKeys.COMMAND, Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS ).mput( Authn.InvokeKeys.USER, userProfile.userName ).mput( Authn.InvokeKeys.CREDENTIALS, password ) ); if (outputMap.<Integer> get(Base.InvokeKeys.RESULT) == Base.InvokeResult.SUCCESS && outputMap.<Integer> get(Authn.InvokeKeys.RESULT) == Authn.AuthResult.SUCCESS) { request.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_RECORD_KEY, outputMap.<ExtMap> get(Authn.InvokeKeys.AUTH_RECORD)); request.setAttribute(FiltersHelper.Constants.REQUEST_AUTH_TYPE_KEY, AuthType.CREDENTIALS); request.setAttribute(FiltersHelper.Constants.REQUEST_PROFILE_KEY, userProfile.profile.getName()); request.setAttribute(FiltersHelper.Constants.REQUEST_PASSWORD_KEY, password); } else { int authResultCode = outputMap.<Integer> get(Authn.InvokeKeys.RESULT, Authn.AuthResult.GENERAL_ERROR); String authnResult = authResultMap.get(authResultCode); if (authnResult == null) { authnResult = Integer.toString(authResultCode); } AcctUtils.reportRecords( Acct.ReportReason.PRINCIPAL_LOGIN_FAILED, userProfile.userName, null, null, "Basic authentication failed for User %1$s (%2$s).", userProfile.userName, authnResult ); log.error("User authentication failed. profile is {}. Invocation Result code is {}. Authn result code is {}", userProfile.userName, userProfile.profile.getName(), outputMap.<Integer> get(Base.InvokeKeys.RESULT), authnResult ); } } }