@Override public UserSession substituteUser(User substitutedUser) { return authenticationManager.substituteUser(substitutedUser); }
@Nonnull @Override public UserSession substituteUser(User substitutedUser) { try { UserSession currentSession = userSessionSource.getUserSession(); SessionLogEntry logEntry = userSessionLog.updateSessionLogRecord(currentSession, SessionAction.SUBSTITUTION); UserSession substitutionSession = authenticationManager.substituteUser(substitutedUser); Map<String, Object> logParams = emptyMap(); if (logEntry != null && logEntry.getClientType() != null) { logParams = ParamsMap.of(ClientType.class.getName(), logEntry.getClientType().name()); } userSessionLog.createSessionLogRecord(substitutionSession, SessionAction.LOGIN, currentSession, logParams); return substitutionSession; } catch (Throwable e) { log.error("Substitution error", e); throw new RuntimeException("Substitution error: " + e.toString()); } }