public Principal principal() { if (principalHolder.size() == 0) { return null; } else { EventContext ec = principalHolder.getCurrentEventContext(); String session = ec.getCurrentSessionUuid(); return new Principal(session); } }
public boolean doLogin(boolean readOnly, boolean isClose) { try { secSys.loadEventContext(readOnly, isClose); } catch (SessionTimeoutException ste) { // If this is a CloseOnNoSessionContext then we skip all handling // since almost any action by the close() method will try to load // the context and will fail. This assumes that EventHandler is // the most inner handler. If this changes, then this logic may // need to be pushed down further. if (ste.sessionContext instanceof BasicSecurityWiring.CloseOnNoSessionContext) { log.debug("CloseOnNoSessionContext. Skipping"); return false; } throw ste; } // now the user can be considered to be logged in. EventContext ec = secSys.getEventContext(); if (!readOnly) { sql.prepareSession(ec.getCurrentEventId(), ec.getCurrentUserId(), ec.getCurrentGroupId()); } if (log.isInfoEnabled()) { StringBuilder sb = new StringBuilder(); sb.append(" Auth:\tuser="******",group="); sb.append(ec.getCurrentGroupId()); sb.append(",event="); sb.append(ec.getCurrentEventId()); sb.append("("); sb.append(ec.getCurrentEventType()); sb.append("),sess="); sb.append(ec.getCurrentSessionUuid()); Long shareId = ec.getCurrentShareId(); if (shareId != null) { sb.append(",share="); sb.append(shareId); } log.info(sb.toString()); } return true; }