use of com.haulmont.cuba.security.global.ClientBasedSession in project cuba by cuba-platform.
the class CubaRemoteInvocationFactory method createRemoteInvocation.
@Override
public RemoteInvocation createRemoteInvocation(MethodInvocation methodInvocation) {
SecurityContext securityContext = AppContext.getSecurityContext();
CubaRemoteInvocation remoteInvocation = new CubaRemoteInvocation(methodInvocation, securityContext == null ? null : securityContext.getSessionId());
if (securityContext != null) {
UserSession session = securityContext.getSession();
if (session instanceof ClientBasedSession && ((ClientBasedSession) session).hasRequestScopedInfo()) {
remoteInvocation.setLocale(session.getLocale() != null ? session.getLocale().toLanguageTag() : null);
remoteInvocation.setTimeZone(session.getTimeZone());
remoteInvocation.setAddress(session.getAddress());
remoteInvocation.setClientInfo(session.getClientInfo());
}
}
return remoteInvocation;
}
use of com.haulmont.cuba.security.global.ClientBasedSession in project cuba by cuba-platform.
the class StickySessionServerSelector method getSessionUrlsHolder.
@Nullable
protected SessionUrlsHolder getSessionUrlsHolder() {
SecurityContext securityContext = AppContext.getSecurityContext();
if (securityContext == null)
return null;
UserSession session = securityContext.getSession();
if (session == null || session instanceof ClientBasedSession && ((ClientBasedSession) session).hasRequestScopedInfo())
return anonymousSessionUrlsHolder;
return new UserSessionUrlsHolder(session);
}
Aggregations