@Override public void setAddress(String address) { super.setAddress(address); if (authenticated) { UserSessionService uss = AppBeans.get(UserSessionService.NAME); uss.setSessionAddress(id, address); } }
protected void setClientSessionParams(AbstractClientCredentials clientCredentials, UserSession userSession) { userSession.setClientInfo(clientCredentials.getClientInfo()); if (clientCredentials.getHostName() != null) { StringBuilder addressBuilder = new StringBuilder(); addressBuilder.append(clientCredentials.getHostName()); if (clientCredentials.getIpAddress() != null) { addressBuilder.append(" (").append(clientCredentials.getIpAddress()).append(")"); } userSession.setAddress(addressBuilder.toString()); } else { userSession.setAddress(clientCredentials.getIpAddress()); } } }
@Override public void setSessionAddress(UUID sessionId, String address) { UserSession userSession = userSessions.getNN(sessionId); checkSession(userSession); userSession.setAddress(address); userSessions.propagate(sessionId); }
@SuppressWarnings("RedundantThrows") @Nullable @Override public AuthenticationDetails login(Credentials credentials) throws LoginException { if (!(credentials instanceof AnonymousUserCredentials)) { throw new ClassCastException("Credentials cannot be cast to AnonymousUserCredentials"); } AnonymousUserCredentials anonymousCredentials = (AnonymousUserCredentials) credentials; UserSession anonymousSession = anonymousSessionHolder.getAnonymousSession(); Locale credentialsLocale = anonymousCredentials.getLocale(); if (credentialsLocale != null) { anonymousSession.setLocale(credentialsLocale); } if (anonymousCredentials.getTimeZone() != null && Boolean.TRUE.equals(anonymousSession.getUser().getTimeZoneAuto())) { anonymousSession.setTimeZone(anonymousCredentials.getTimeZone()); } anonymousSession.setAddress(anonymousCredentials.getIpAddress()); anonymousSession.setClientInfo(anonymousCredentials.getClientInfo()); if (anonymousCredentials.getSessionAttributes() != null) { for (Map.Entry<String, Serializable> attribute : anonymousCredentials.getSessionAttributes().entrySet()) { anonymousSession.setAttribute(attribute.getKey(), attribute.getValue()); } } return new SimpleAuthenticationDetails(anonymousSession); }