@Override public void handleNotification(SecurityNotification notification) { if (notification.getEventType() == SecurityNotification.EventType.LOGGED_OUT) { singleSignOnManager.removeSingleSignOn(sso); } } });
@Override public void handleNotification(SecurityNotification notification) { EventType event = notification.getEventType(); if (event == EventType.AUTHENTICATED || event == EventType.FAILED_AUTHENTICATION) { AuditEvent auditEvent = new AuditEvent(event == EventType.AUTHENTICATED ? AuditLevel.SUCCESS : AuditLevel.FAILURE); Map<String, Object> ctxMap = new HashMap<String, Object>(); Account account = notification.getAccount(); if (account != null) { ctxMap.put("principal", account.getPrincipal().getName()); } ctxMap.put("message", notification.getMessage()); ServletRequestContext src = notification.getExchange().getAttachment(ServletRequestContext.ATTACHMENT_KEY); if(src != null) { ServletRequest hsr = src.getServletRequest(); if (hsr instanceof HttpServletRequest) { ctxMap.put("request", deriveUsefulInfo((HttpServletRequest) hsr)); } } ctxMap.put("Source", getClass().getCanonicalName()); auditEvent.setContextMap(ctxMap); auditManager.audit(auditEvent); } }
@Override public void handleNotification(SecurityNotification notification) { if (notification.getEventType() == SecurityNotification.EventType.LOGGED_OUT) { Account account = notification.getAccount(); Principal principal = (account instanceof AccountImpl) ? ((AccountImpl) account).getOriginalPrincipal() : account.getPrincipal(); if (principal != null) { // perform the logout of the principal using the subject currently set in the security context. Subject subject = SecurityActions.getSubject(); this.manager.logout(principal, subject); } // Clear old context SecurityActions.clearSecurityContext(); SecurityActions.setSecurityRoles(null); // Set a new one in case re-authentication is done within the same thread org.jboss.security.SecurityContext securityContext = SecurityActions.createSecurityContext(securityDomain); notification.getExchange().putAttachment(UndertowSecurityAttachments.SECURITY_CONTEXT_ATTACHMENT, securityContext); SecurityActions.setSecurityContextOnAssociation(securityContext); } } }
@Override public void handleNotification(SecurityNotification notification) { EventType eventType = notification.getEventType(); HttpServerExchange exchange = notification.getExchange(); SessionManager sessionManager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY);
@Override public void handleNotification(SecurityNotification notification) { if (notification.getEventType() == SecurityNotification.EventType.LOGGED_OUT) { singleSignOnManager.removeSingleSignOn(sso); } } });
@Override public void handleNotification(SecurityNotification notification) { if (notification.getEventType() == SecurityNotification.EventType.LOGGED_OUT) { singleSignOnManager.removeSingleSignOn(sso); } } });
@Override public void handleNotification(SecurityNotification notification) { EventType event = notification.getEventType(); if (event == EventType.AUTHENTICATED || event == EventType.FAILED_AUTHENTICATION) { AuditEvent auditEvent = new AuditEvent(event == EventType.AUTHENTICATED ? AuditLevel.SUCCESS : AuditLevel.FAILURE); Map<String, Object> ctxMap = new HashMap<String, Object>(); Account account = notification.getAccount(); if (account != null) { ctxMap.put("principal", account.getPrincipal().getName()); } ctxMap.put("message", notification.getMessage()); ServletRequestContext src = notification.getExchange().getAttachment(ServletRequestContext.ATTACHMENT_KEY); if(src != null) { ServletRequest hsr = src.getServletRequest(); if (hsr instanceof HttpServletRequest) { ctxMap.put("request", deriveUsefulInfo((HttpServletRequest) hsr)); } } ctxMap.put("Source", getClass().getCanonicalName()); auditEvent.setContextMap(ctxMap); auditManager.audit(auditEvent); } }
@Override public void handleNotification(SecurityNotification notification) { EventType event = notification.getEventType(); if (event == EventType.AUTHENTICATED || event == EventType.FAILED_AUTHENTICATION) { AuditEvent auditEvent = new AuditEvent(event == EventType.AUTHENTICATED ? AuditLevel.SUCCESS : AuditLevel.FAILURE); Map<String, Object> ctxMap = new HashMap<String, Object>(); Account account = notification.getAccount(); if (account != null) { ctxMap.put("principal", account.getPrincipal().getName()); } ctxMap.put("message", notification.getMessage()); ServletRequestContext src = notification.getExchange().getAttachment(ServletRequestContext.ATTACHMENT_KEY); if(src != null) { ServletRequest hsr = src.getServletRequest(); if (hsr instanceof HttpServletRequest) { ctxMap.put("request", deriveUsefulInfo((HttpServletRequest) hsr)); } } ctxMap.put("Source", getClass().getCanonicalName()); auditEvent.setContextMap(ctxMap); auditManager.audit(auditEvent); } }
@Override public void handleNotification(SecurityNotification notification) { if (notification.getEventType() != SecurityNotification.EventType.LOGGED_OUT) return; HttpServerExchange exchange = notification.getExchange(); UndertowHttpFacade facade = createFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); KeycloakSecurityContext ksc = exchange.getAttachment(OIDCUndertowHttpFacade.KEYCLOAK_SECURITY_CONTEXT_KEY); if (!deployment.isBearerOnly() && ksc != null && ksc instanceof RefreshableKeycloakSecurityContext) { ((RefreshableKeycloakSecurityContext) ksc).logout(deployment); } AdapterTokenStore tokenStore = getTokenStore(exchange, facade, deployment, securityContext); tokenStore.logout(); } };
@Override public void handleNotification(SecurityNotification notification) { if (notification.getEventType() != SecurityNotification.EventType.LOGGED_OUT) return; HttpServerExchange exchange = notification.getExchange(); UndertowHttpFacade facade = createFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); KeycloakSecurityContext ksc = exchange.getAttachment(OIDCUndertowHttpFacade.KEYCLOAK_SECURITY_CONTEXT_KEY); if (!deployment.isBearerOnly() && ksc != null && ksc instanceof RefreshableKeycloakSecurityContext) { ((RefreshableKeycloakSecurityContext) ksc).logout(deployment); } AdapterTokenStore tokenStore = getTokenStore(exchange, facade, deployment, securityContext); tokenStore.logout(); } };
@Override public void handleNotification(SecurityNotification notification) { if (notification.getEventType() == SecurityNotification.EventType.LOGGED_OUT) { Account account = notification.getAccount(); Principal principal = (account instanceof AccountImpl) ? ((AccountImpl) account).getOriginalPrincipal() : account.getPrincipal(); if (principal != null) { // perform the logout of the principal using the subject currently set in the security context. Subject subject = SecurityActions.getSubject(); this.manager.logout(principal, subject); } // Clear old context SecurityActions.clearSecurityContext(); SecurityActions.setSecurityRoles(null); // Set a new one in case re-authentication is done within the same thread org.jboss.security.SecurityContext securityContext = SecurityActions.createSecurityContext(securityDomain); notification.getExchange().putAttachment(UndertowSecurityAttachments.SECURITY_CONTEXT_ATTACHMENT, securityContext); SecurityActions.setSecurityContextOnAssociation(securityContext); } } }
@Override public void handleNotification(SecurityNotification notification) { if (notification.getEventType() == SecurityNotification.EventType.LOGGED_OUT) { Account account = notification.getAccount(); Principal principal = (account instanceof AccountImpl) ? ((AccountImpl) account).getOriginalPrincipal() : account.getPrincipal(); if (principal != null) { // perform the logout of the principal using the subject currently set in the security context. Subject subject = SecurityActions.getSubject(); this.manager.logout(principal, subject); } // Clear old context SecurityActions.clearSecurityContext(); SecurityActions.setSecurityRoles(null); // Set a new one in case re-authentication is done within the same thread org.jboss.security.SecurityContext securityContext = SecurityActions.createSecurityContext(securityDomain); notification.getExchange().putAttachment(UndertowSecurityAttachments.SECURITY_CONTEXT_ATTACHMENT, securityContext); SecurityActions.setSecurityContextOnAssociation(securityContext); } } }
@Override public void handleNotification(SecurityNotification notification) { EventType eventType = notification.getEventType(); HttpServerExchange exchange = notification.getExchange(); SessionManager sessionManager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY);
@Override public void handleNotification(SecurityNotification notification) { EventType eventType = notification.getEventType(); HttpServerExchange exchange = notification.getExchange(); SessionManager sessionManager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY);
@Override public void handleNotification(SecurityNotification notification) { EventType eventType = notification.getEventType(); HttpSessionImpl httpSession = servletContext.getSession(notification.getExchange(), false); switch (eventType) {