protected TrustedClientCredentials createTrustedCredentials(LoginPasswordCredentials credentials) { TrustedClientCredentials tcCredentials = new TrustedClientCredentials( credentials.getLogin(), webAuthConfig.getTrustedClientPassword(), credentials.getLocale(), credentials.getParams() ); tcCredentials.setClientInfo(credentials.getClientInfo()); tcCredentials.setClientType(ClientType.WEB); tcCredentials.setIpAddress(credentials.getIpAddress()); tcCredentials.setOverrideLocale(credentials.isOverrideLocale()); tcCredentials.setSyncNewUserSessionReplication(credentials.isSyncNewUserSessionReplication()); tcCredentials.setSessionAttributes(credentials.getSessionAttributes()); return tcCredentials; }
@Override public String getUserIdentifier() { return getLogin(); }
@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(); }
TrustedClientCredentials credentials = new TrustedClientCredentials(login, config.getTrustedClientPassword(), locale); credentials.setClientType(ClientType.REST_API); if (attributes != null) { HttpServletRequest request = attributes.getRequest(); credentials.setIpAddress(request.getRemoteAddr()); credentials.setClientInfo(makeClientInfo(request.getHeader(HttpHeaders.USER_AGENT))); } else { credentials.setClientInfo(makeClientInfo("")); credentials.setParams(tokenRequest.getLoginParams());
sessionInfo.getLocale() : null; TrustedClientCredentials credentials = new TrustedClientCredentials(username, restApiConfig.getTrustedClientPassword(), locale); credentials.setClientType(ClientType.REST_API); if (attributes != null) { HttpServletRequest request = attributes.getRequest(); credentials.setIpAddress(request.getRemoteAddr()); credentials.setClientInfo(makeClientInfo(request.getHeader(HttpHeaders.USER_AGENT))); } else { credentials.setClientInfo(makeClientInfo("")); credentials.setOverrideLocale(false);
TrustedClientCredentials credentials = new TrustedClientCredentials( auth.getUsername(), idpConfig.getTrustedClientPassword(), sessionLocale); credentials.setClientType(ClientType.WEB);
@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(); }
TrustedClientCredentials trustedClient = (TrustedClientCredentials) credentials; String login = trustedClient.getLogin(); Locale credentialsLocale = trustedClient.getLocale() == null ? messages.getTools().getDefaultLocale() : trustedClient.getLocale(); if (trustedClient.getClientIpAddress() != null) { if (!trustedLoginHandler.checkAddress(trustedClient.getClientIpAddress())) { log.warn("Attempt of trusted login from not permitted IP address: {} {}", login, trustedClient.getClientIpAddress()); throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale)); trustedClient.getLogin()); if (!trustedLoginHandler.checkPassword(trustedClient.getTrustedClientPassword())) { throw new LoginException(getInvalidCredentialsMessage(login, credentialsLocale));
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; }
Locale defaultLocale = availableLocales.values().iterator().next(); TrustedClientCredentials credentials = new TrustedClientCredentials(userLogin, userPassword, defaultLocale);
protected TrustedClientCredentials createTrustedCredentials(LoginPasswordCredentials credentials) { TrustedClientCredentials tcCredentials = new TrustedClientCredentials( credentials.getLogin(), portalConfig.getTrustedClientPassword(), credentials.getLocale(), credentials.getParams() ); tcCredentials.setClientInfo(credentials.getClientInfo()); tcCredentials.setClientType(ClientType.PORTAL); tcCredentials.setIpAddress(credentials.getIpAddress()); tcCredentials.setOverrideLocale(credentials.isOverrideLocale()); tcCredentials.setSyncNewUserSessionReplication(credentials.isSyncNewUserSessionReplication()); tcCredentials.setSessionAttributes(credentials.getSessionAttributes()); return tcCredentials; }
protected TrustedClientCredentials createTrustedCredentials(LoginPasswordCredentials credentials) { TrustedClientCredentials tcCredentials = new TrustedClientCredentials( credentials.getLogin(), restApiConfig.getTrustedClientPassword(), credentials.getLocale(), credentials.getParams() ); tcCredentials.setClientInfo(credentials.getClientInfo()); tcCredentials.setClientType(ClientType.REST_API); tcCredentials.setIpAddress(credentials.getIpAddress()); tcCredentials.setOverrideLocale(credentials.isOverrideLocale()); tcCredentials.setSyncNewUserSessionReplication(credentials.isSyncNewUserSessionReplication()); tcCredentials.setSessionAttributes(credentials.getSessionAttributes()); return tcCredentials; }
TrustedClientCredentials tcCredentials = new TrustedClientCredentials( externalUserCredentials.getLogin(), webAuthConfig.getTrustedClientPassword(), ); tcCredentials.setClientInfo(externalUserCredentials.getClientInfo()); tcCredentials.setClientType(ClientType.WEB); tcCredentials.setIpAddress(externalUserCredentials.getIpAddress()); tcCredentials.setOverrideLocale(externalUserCredentials.isOverrideLocale()); tcCredentials.setSyncNewUserSessionReplication(externalUserCredentials.isSyncNewUserSessionReplication()); tcCredentials.setSessionAttributes(targetSessionAttributes);
TrustedClientCredentials trustedClientCredentials = new TrustedClientCredentials( systemLogin, webAuthConfig.getTrustedClientPassword(), ); trustedClientCredentials.setClientInfo(loginPassword.getClientInfo()); trustedClientCredentials.setClientType(ClientType.WEB); trustedClientCredentials.setIpAddress(loginPassword.getIpAddress()); trustedClientCredentials.setOverrideLocale(loginPassword.isOverrideLocale()); trustedClientCredentials.setSyncNewUserSessionReplication(loginPassword.isSyncNewUserSessionReplication()); targetSessionAttributes = ImmutableMap.of(EXTERNAL_AUTH_USER_SESSION_ATTRIBUTE, true); trustedClientCredentials.setSessionAttributes(targetSessionAttributes);
TrustedClientCredentials tcCredentials = new TrustedClientCredentials( loginPasswordCredentials.getLogin(), webAuthConfig.getTrustedClientPassword(), ); tcCredentials.setClientInfo(loginPasswordCredentials.getClientInfo()); tcCredentials.setClientType(ClientType.WEB); tcCredentials.setIpAddress(loginPasswordCredentials.getIpAddress()); tcCredentials.setOverrideLocale(loginPasswordCredentials.isOverrideLocale()); tcCredentials.setSyncNewUserSessionReplication(loginPasswordCredentials.isSyncNewUserSessionReplication()); tcCredentials.setSessionAttributes(targetSessionAttributes);