try { TrustedClientCredentials credentials = new TrustedClientCredentials(login, config.getTrustedClientPassword(), locale); credentials.setClientType(ClientType.REST_API);
tcCredentials.setClientType(ClientType.WEB); tcCredentials.setIpAddress(externalUserCredentials.getIpAddress()); tcCredentials.setOverrideLocale(externalUserCredentials.isOverrideLocale());
credentials.setClientType(ClientType.REST_API);
trustedClientCredentials.setClientType(ClientType.WEB); trustedClientCredentials.setIpAddress(loginPassword.getIpAddress()); trustedClientCredentials.setOverrideLocale(loginPassword.isOverrideLocale());
tcCredentials.setClientType(ClientType.WEB); tcCredentials.setIpAddress(loginPasswordCredentials.getIpAddress()); tcCredentials.setOverrideLocale(loginPasswordCredentials.isOverrideLocale());
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; }
sessionLocale); credentials.setClientType(ClientType.WEB);
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; }
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; }