@Override public UserSession loginSystem(String login) throws LoginException { return authenticationManager.login(new SystemUserCredentials(login)).getSession(); }
@Override public UserSession login(String login, String password, Locale locale, Map<String, Object> params) throws LoginException { return authenticationManager.login(new LoginPasswordCredentials(login, password, locale, params)).getSession(); }
protected UserSession loginAnonymous() throws LoginException { return authenticationManager.login(new AnonymousUserCredentials()).getSession(); }
@Override public UserSession loginTrusted(String login, String password, Locale locale, Map<String, Object> params) throws LoginException { TrustedClientCredentials credentials = new TrustedClientCredentials(login, password, locale, params); copyParamsToCredentials(params, credentials); return authenticationManager.login(credentials).getSession(); }
@Override public UserSession loginByRememberMe(String login, String rememberMeToken, Locale locale, Map<String, Object> params) throws LoginException { RememberMeCredentials credentials = new RememberMeCredentials(login, rememberMeToken, locale, params); copyParamsToCredentials(params, credentials); return authenticationManager.login(credentials).getSession(); }
protected void setSecurityContext(ScheduledTask task, @Nullable UserSession userSession) throws LoginException { if (userSession == null) { UUID sessionId = userSessionIds.get(task.getUserName()); userSession = sessionId == null ? null : userSessions.getAndRefresh(sessionId); if (userSession == null) { userSession = authenticationManager.login(new SystemUserCredentials(task.getUserName())).getSession(); userSessionIds.put(task.getUserName(), userSession.getId()); } } AppContext.setSecurityContext(new SecurityContext(userSession)); }
@Nonnull @Override public AuthenticationDetails login(Credentials credentials) throws LoginException { try { preprocessCredentials(credentials); //noinspection UnnecessaryLocalVariable AuthenticationDetails details = authenticationManager.login(credentials); Map<String, Object> logParams = emptyMap(); if (credentials instanceof AbstractClientCredentials) { ClientType clientType = ((AbstractClientCredentials) credentials).getClientType(); if (clientType != null) { logParams = ParamsMap.of(ClientType.class.getName(), clientType.name()); } } userSessionLog.createSessionLogRecord(details.getSession(), SessionAction.LOGIN, logParams); return details; } catch (InternalAuthenticationException ie) { log.error("Login error", ie); throw ie; } catch (LoginException e) { log.info("Login failed: {}", e.toString()); throw e; } catch (Throwable e) { log.error("Login error", e); throw wrapInLoginException(e); } }
session = authenticationManager.login(new SystemUserCredentials(login)).getSession(); session.setClientInfo("System authentication"); } catch (LoginException e) {