Search in sources :

Example 1 with Action

use of io.jans.as.server.model.audit.Action in project jans by JanssenProject.

the class SessionIdService method auditLogging.

private void auditLogging(SessionId sessionId) {
    HttpServletRequest httpServletRequest = ServerUtil.getRequestOrNull();
    if (httpServletRequest != null) {
        Action action;
        switch(sessionId.getState()) {
            case AUTHENTICATED:
                action = Action.SESSION_AUTHENTICATED;
                break;
            case UNAUTHENTICATED:
                action = Action.SESSION_UNAUTHENTICATED;
                break;
            default:
                action = Action.SESSION_UNAUTHENTICATED;
        }
        OAuth2AuditLog oAuth2AuditLog = new OAuth2AuditLog(ServerUtil.getIpAddress(httpServletRequest), action);
        oAuth2AuditLog.setSuccess(true);
        applicationAuditLogger.sendMessage(oAuth2AuditLog);
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) Action(io.jans.as.server.model.audit.Action) OAuth2AuditLog(io.jans.as.server.model.audit.OAuth2AuditLog)

Aggregations

Action (io.jans.as.server.model.audit.Action)1 OAuth2AuditLog (io.jans.as.server.model.audit.OAuth2AuditLog)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1