@Override public void setTimeZone(TimeZone timeZone) { super.setTimeZone(timeZone); if (authenticated) { UserSessionService uss = AppBeans.get(UserSessionService.NAME); uss.setSessionTimeZone(id, timeZone); } }
@Override public void setSessionTimeZone(UUID sessionId, TimeZone timeZone) { UserSession userSession = userSessions.getNN(sessionId); checkSession(userSession); userSession.setTimeZone(timeZone); userSessions.propagate(sessionId); }
protected void setTimeZone(Credentials credentials, AuthenticationDetails authenticationDetails) { if (credentials instanceof TimeZoneProvider) { TimeZone timeZone = ((TimeZoneProvider) credentials).getTimeZone(); UserSession session = authenticationDetails.getSession(); if (Boolean.TRUE.equals(session.getUser().getTimeZoneAuto())) { session.setTimeZone(timeZone); } } }
@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); }