/** * Sends information to the {@code AuditManager}. * * @param level * @param auditManager * @param userPrincipal */ private void audit(String level, AuditManager auditManager, Principal userPrincipal) { AuditEvent auditEvent = new AuditEvent(level); Map<String, Object> ctxMap = new HashMap<String, Object>(); ctxMap.put("principal", userPrincipal != null ? userPrincipal.getName() : "null"); ctxMap.put("Source", getClass().getCanonicalName()); ctxMap.put("Action", "authentication"); 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); } }
protected void audit(String level, Map<String,Object> contextMap, Exception e) { AuditManager am = securityContext.getAuditManager(); if(am == null) return; contextMap.put("Source", getClass().getName()); AuditEvent ae = new AuditEvent(level,contextMap,e); am.audit(ae); }
protected void audit(String level, Map<String,Object> contextMap, Exception e) { AuditManager am = securityContext.getAuditManager(); if(am == null) return; contextMap.put("Source", getClass().getName()); AuditEvent ae = new AuditEvent(level,contextMap,e); am.audit(ae); }
protected void audit(String level, Map<String,Object> contextMap, Exception e) { AuditManager am = securityContext.getAuditManager(); if(am == null) return; contextMap.put("Source", getClass().getName()); AuditEvent ae = new AuditEvent(level,contextMap,e); am.audit(ae); }
@Override public void audit(Subject subject, AuditContext context, String contextName, AuthorizationPermission permission, AuditResponse response) { String level; switch (response) { case ALLOW: level = AuditLevel.SUCCESS; break; case DENY: level = AuditLevel.FAILURE; break; case ERROR: level = AuditLevel.ERROR; break; default: level = AuditLevel.INFO; break; } AuditEvent ae = new AuditEvent(level); auditManager.audit(ae); }
@Override public void audit(Subject subject, AuditContext context, String contextName, AuthorizationPermission permission, AuditResponse response) { String level; switch (response) { case ALLOW: level = AuditLevel.SUCCESS; break; case DENY: level = AuditLevel.FAILURE; break; case ERROR: level = AuditLevel.ERROR; break; default: level = AuditLevel.INFO; break; } AuditEvent ae = new AuditEvent(level); auditManager.audit(ae); }
/** * Sends information to the {@code AuditManager}. * @param level * @param auditManager * @param userPrincipal * @param entries */ private void audit(String level, AuditManager auditManager, Principal userPrincipal) { AuditEvent auditEvent = new AuditEvent(AuditLevel.SUCCESS); Map<String, Object> ctxMap = new HashMap<String, Object>(); ctxMap.put("principal", userPrincipal != null ? userPrincipal : "null"); ctxMap.put("Source", getClass().getCanonicalName()); ctxMap.put("Action", "authentication"); auditEvent.setContextMap(ctxMap); auditManager.audit(auditEvent); }
/** * Sends information to the {@code AuditManager}. * * @param level * @param auditManager * @param userPrincipal */ private void audit(String level, AuditManager auditManager, Principal userPrincipal) { AuditEvent auditEvent = new AuditEvent(level); Map<String, Object> ctxMap = new HashMap<String, Object>(); ctxMap.put("principal", userPrincipal != null ? userPrincipal.getName() : "null"); ctxMap.put("Source", getClass().getCanonicalName()); ctxMap.put("Action", "authentication"); auditEvent.setContextMap(ctxMap); auditManager.audit(auditEvent); }
/** * Sends information to the {@code AuditManager}. * @param level * @param auditManager * @param userPrincipal * @param entries */ private void audit(String level, AuditManager auditManager, Principal userPrincipal) { AuditEvent auditEvent = new AuditEvent(AuditLevel.SUCCESS); Map<String, Object> ctxMap = new HashMap<String, Object>(); ctxMap.put("principal", userPrincipal != null ? userPrincipal : "null"); ctxMap.put("Source", getClass().getCanonicalName()); ctxMap.put("Action", "authentication"); auditEvent.setContextMap(ctxMap); auditManager.audit(auditEvent); }
private void audit(String level, Map<String, Object> contextMap, Exception e) { String requestInfo = ""; try { HttpServletRequest hsr = (HttpServletRequest) PolicyContext.getContext(SecurityConstants.WEB_REQUEST_KEY); requestInfo = WebUtil.deriveUsefulInfo(hsr); contextMap.put("request", requestInfo); } catch (PolicyContextException pe) { if (trace) log.trace("Error obtaining the servlet request:", pe); } contextMap.put("Source", getClass().getName()); AuditEvent ae = new AuditEvent(level); ae.setContextMap(contextMap); ae.setUnderlyingException(e); SecurityContext sc = SecurityAssociationActions.getSecurityContext(); if (sc != null) { AuditManager auditManager = sc.getAuditManager(); if (auditManager != null) auditManager.audit(ae); else log.trace("Audit Manager obtained from Security Context is null"); } }
@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); } }
map.put(ShellServer.AUDIT_COMMAND_RESPONSE, txMessage); putPrincipal(map, chan.getPrincipal()); securityContext.getAuditManager().audit(new AuditEvent(AuditLevel.INFO, map));
map.put(AUDIT_MESSAGE, "logout success"); putPrincipal(map, chan.getPrincipal()); this.securityContext.getAuditManager().audit(new AuditEvent(AuditLevel.SUCCESS, map)); putPrincipal(map, chan.getPrincipal()); this.securityContext.getAuditManager() .audit(new AuditEvent(AuditLevel.SUCCESS, map)); map.put(AUDIT_COMMAND_RESPONSE, "Invalid command"); putPrincipal(map, chan.getPrincipal()); this.securityContext.getAuditManager().audit(new AuditEvent(AuditLevel.INFO, map));