protected List<AuthcAuthzEvent> getAaesFromMaps(List<Entry> data) { List<AuthcAuthzEvent> result = new ArrayList<AuthcAuthzEvent>(); for (Entry record : data) { Map<String, String> map = record.getData(); HashMap<String, Object> ctx = new HashMap<String, Object>(); for (String key : map.keySet()) { if (key.startsWith(CTX_PREFIX)) { ctx.put(key.substring(4), map.get(key)); } } AuthcAuthzEvent evt = new AuthcAuthzEvent(getEventDate(map), map.get(ACTION), map.get(MESSAGE)); evt.addEventContext(ctx); result.add(evt); } return result; }
public void addAuthcAuthzEvent(AuthcAuthzEvent evt) { Map<String, String> map = new HashMap<String, String>(); putContext(map, CTX_PREFIX, evt.getEventContext()); map.put(ACTION, evt.getAction()); map.put(MESSAGE, evt.getMessage()); map.put(DATE, getDateFormat().format(evt.getEventDate())); addToTimeline(map, AUTHC_AUTHZ_EVENT_TYPE, evt.getAction()); }
SyndEntry entry = new SyndEntryImpl(); if (FeedRecorder.SYSTEM_AUTHC.equals(item.getAction())) { entry.setTitle("Authentication"); else if (FeedRecorder.SYSTEM_AUTHZ.equals(item.getAction())) { entry.setTitle("Authorization"); entry.setTitle(item.getAction()); content.setValue(item.getMessage()); entry.setPublishedDate(item.getEventDate());
@Subscribe @AllowConcurrentEvents public void inspect(final NexusAuthenticationEvent nae) { if (!isRecordedEvent(nae)) { // do nothing return; } lastNexusAuthenticationEvent = nae; final ClientInfo ai = nae.getClientInfo(); final String msg = String.format("%s user [%s] from IP address %s", (nae.isSuccessful() ? "Successfully authenticated" : "Unable to authenticate"), ai.getUserid(), StringUtils.defaultString(ai.getRemoteIP(), "[unknown]")); log.debug(msg); final AuthcAuthzEvent aae = new AuthcAuthzEvent(nae.getEventDate(), FeedRecorder.SYSTEM_AUTHC, msg); final String ip = ai.getRemoteIP(); if (ip != null) { nae.getEventContext().put(AccessManager.REQUEST_REMOTE_ADDRESS, ip); } getFeedRecorder().addAuthcAuthzEvent(aae); }
@Subscribe @AllowConcurrentEvents public void inspect(NexusAuthorizationEvent nae) { if (!isRecordedEvent(nae)) { // do nothing return; } lastNexusAuthorizationEvent = nae; final ClientInfo ai = nae.getClientInfo(); final ResourceInfo ri = nae.getResourceInfo(); final String msg = "Unable to authorize user [" + ai.getUserid() + "] for " + ri.getAction() + "(" + ri.getAccessProtocol() + " method \"" + ri.getAccessMethod() + "\") to " + ri.getAccessedUri() + " from IP Address " + ai.getRemoteIP() + ", user agent:\"" + ai.getUserAgent() + "\""; log.debug(msg); final AuthcAuthzEvent aae = new AuthcAuthzEvent(nae.getEventDate(), FeedRecorder.SYSTEM_AUTHZ, msg); final String ip = ai.getRemoteIP(); if (ip != null) { nae.getEventContext().put(AccessManager.REQUEST_REMOTE_ADDRESS, ip); } getFeedRecorder().addAuthcAuthzEvent(aae); }