protected AuthenticationDetails loginMiddleware(LoginPasswordCredentials credentials) throws LoginException { return authenticationService.login(credentials); }
protected AuthenticationDetails loginMiddleware(LoginPasswordCredentials credentials) throws LoginException { return authenticationService.login(credentials); }
protected AuthenticationDetails loginMiddleware(Credentials credentials) throws LoginException { return authenticationService.login(credentials); }
protected AuthenticationDetails loginMiddleware(TrustedClientCredentials credentials) throws LoginException { return authenticationService.login(credentials); }
protected AuthenticationDetails loginMiddleware(LoginPasswordCredentials credentials) throws LoginException { return authenticationService.login(credentials); }
@Nullable @Override public AuthenticationDetails login(Credentials credentials) throws LoginException { if (!(credentials instanceof RememberMeCredentials)) { throw new ClassCastException("Credentials cannot be cast to RememberMeCredentials"); } return authenticationService.login(credentials); }
@Override public UserSession login(String login, String password, Locale locale, Map<String, Object> params) throws LoginException { LoginPasswordCredentials credentials = new LoginPasswordCredentials(login, password, locale, params); copyParamsToCredentials(params, credentials); return authenticationService.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 authenticationService.login(credentials).getSession(); }
try { AbstractClientCredentials credentials = new LoginPasswordCredentials(username, password, locale); UserSession userSession = authenticationService.login(credentials).getSession();
UserSession session = authenticationService.login(credentials).getSession(); AppContext.setSecurityContext(new SecurityContext(session)); logoutRequired = true;
session = authenticationService.login(credentials).getSession(); } catch (RestApiAccessDeniedException ex) { log.info("User is not allowed to use the REST API {}", login);
session = authenticationService.login(credentials).getSession(); } catch (LoginException e) { throw new OAuth2Exception("Cannot login to the middleware", e);
@Override public UserSession loginTrusted(String login, String password, Locale locale, Map<String, Object> params) throws LoginException { checkRemoteClientTrusted(); TrustedClientCredentials credentials = new TrustedClientCredentials(login, password, locale, params); RemoteClientInfo remoteClientInfo = RemoteClientInfo.get(); if (remoteClientInfo != null) { credentials.setClientIpAddress(remoteClientInfo.getAddress()); } else { credentials.setClientIpAddress(null); } copyParamsToCredentials(params, credentials); return authenticationService.login(credentials).getSession(); }
return authenticationService.login(trustedClientCredentials);
protected UserSession loginAsAnonymous() { String login = portalConfig.getAnonymousUserLogin(); String password = portalConfig.getTrustedClientPassword(); UserSession userSession; try { String portalLocationString = getPortalNetworkLocation(); String portalClientInfo = "Portal Anonymous Session"; if (StringUtils.isNotBlank(portalLocationString)) { portalClientInfo += " (" + portalLocationString + ")"; } TrustedClientCredentials credentials = new TrustedClientCredentials(login, password, messagesTools.getDefaultLocale()); credentials.setClientType(ClientType.PORTAL); credentials.setClientInfo(portalClientInfo); credentials.setParams(ParamsMap.of( ClientType.class.getName(), AppContext.getProperty("cuba.clientType"), SessionParams.CLIENT_INFO.getId(), portalClientInfo )); userSession = authenticationService.login(credentials).getSession(); } catch (LoginException e) { throw new NoMiddlewareConnectionException("Unable to login as anonymous portal user", e); } catch (Exception e) { throw new NoMiddlewareConnectionException("Unable to connect to middleware services", e); } return userSession; }
protected AuthenticationDetails loginClient(LoginPasswordCredentials credentials) { String login = credentials.getLogin(); Locale credentialsLocale = credentials.getLocale() == null ? messages.getTools().getDefaultLocale() : credentials.getLocale(); if (Strings.isNullOrEmpty(login)) { // empty login is not valid throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } UserSession systemSession = trustedClientService.getSystemSession(portalConfig.getTrustedClientPassword()); User user = AppContext.withSecurityContext(new SecurityContext(systemSession), () -> usersRepository.findUserByLogin(login)); if (user == null) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } if (!passwordEncryption.checkPassword(user, credentials.getPassword())) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } return authenticationService.login(createTrustedCredentials(credentials)); }
protected AuthenticationDetails loginClient(LoginPasswordCredentials credentials) { String login = credentials.getLogin(); Locale credentialsLocale = credentials.getLocale() == null ? messages.getTools().getDefaultLocale() : credentials.getLocale(); if (Strings.isNullOrEmpty(login)) { // empty login is not valid throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } UserSession systemSession = trustedClientService.getSystemSession(restApiConfig.getTrustedClientPassword()); User user = AppContext.withSecurityContext(new SecurityContext(systemSession), () -> usersRepository.findUserByLogin(login)); if (user == null) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } if (!passwordEncryption.checkPassword(user, credentials.getPassword())) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } return authenticationService.login(createTrustedCredentials(credentials)); }
protected AuthenticationDetails loginClient(LoginPasswordCredentials credentials) { String login = credentials.getLogin(); Locale credentialsLocale = credentials.getLocale() == null ? messages.getTools().getDefaultLocale() : credentials.getLocale(); if (Strings.isNullOrEmpty(login)) { // empty login is not valid throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } UserSession systemSession = trustedClientService.getSystemSession(webAuthConfig.getTrustedClientPassword()); User user = AppContext.withSecurityContext(new SecurityContext(systemSession), () -> usersRepository.findUserByLogin(login)); if (user == null) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } if (!passwordEncryption.checkPassword(user, credentials.getPassword())) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); } return authenticationService.login(createTrustedCredentials(credentials)); }