/** * 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 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); }
public void audit(AuditEvent ae) { int len = this.providerList.size(); for(int i = 0; i < len; i++) { AuditProvider ap = (AuditProvider)this.providerList.get(i); ap.audit(ae); } }
/** * Audit the event * * @param ae */ public void audit(AuditEvent ae) { if (auditManager == null) { throw logger.auditNullAuditManager(); } auditManager.audit(ae); }
public String toString() { StringBuilder sbu = new StringBuilder(); sbu.append("[").append(auditLevel).append("]"); sbu.append(dissectContextMap()); return sbu.toString(); }
public void audit(AuditEvent auditEvent) { Exception e = auditEvent.getUnderlyingException(); if(e != null) log.trace(auditEvent, e); else log.trace(auditEvent); } }
@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 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); } }
/** * Audit the event * * @param ae */ public void audit(AuditEvent ae) { if (auditManager == null) { throw logger.auditNullAuditManager(); } auditManager.audit(ae); }
public String toString() { StringBuilder sbu = new StringBuilder(); sbu.append("[").append(auditLevel).append("]"); sbu.append(dissectContextMap()); return sbu.toString(); }
public void audit(AuditEvent ae) { int len = this.providerList.size(); for(int i = 0; i < len; i++) { AuditProvider ap = (AuditProvider)this.providerList.get(i); ap.audit(ae); } }
public void audit(AuditEvent auditEvent) { if(!PicketBoxLogger.AUDIT_LOGGER.isTraceEnabled()) { return; } Exception e = auditEvent.getUnderlyingException(); if(e != null) { PicketBoxLogger.AUDIT_LOGGER.trace(auditEvent, e); } else { PicketBoxLogger.AUDIT_LOGGER.trace(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); }
/** * Audit the event * * @param ae */ public void audit(AuditEvent ae) { if (auditManager == null) { throw logger.auditNullAuditManager(); } auditManager.audit(ae); }
public String toString() { StringBuilder sbu = new StringBuilder(); sbu.append("[").append(auditLevel).append("]"); sbu.append(dissectContextMap()); return sbu.toString(); }
public void audit(AuditEvent ae) { int len = this.providerList.size(); for(int i = 0; i < len; i++) { AuditProvider ap = (AuditProvider)this.providerList.get(i); ap.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); }
public String toString() { StringBuilder sbu = new StringBuilder(); sbu.append("[").append(auditLevel).append("]"); sbu.append(dissectContextMap()); return sbu.toString(); }
public void audit(AuditEvent ae) { int len = this.providerList.size(); for(int i = 0; i < len; i++) { AuditProvider ap = (AuditProvider)this.providerList.get(i); ap.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); }