Can you suggest a way to check user auth in SignalR? Several posts refer to the SessionFeature.GetOrCreateSession<AuthUserSession> method but this requires a ServiceStack request which I don’t have within SignalR (SignalR has it’s own request).
It’s a matter of reading the ss-id cookie from the HTTP request and retrieving the session from the cache, here’s the code that does it in SS:
the ss cookies calls GetSessionKey to create the cache key:
Essentially something like:
var sessionId = GetCookieFromSignalR(“ss-id”);
var sessionKey = IdUtils.CreateUrn<IAuthSession>(sessionId);
var userSession = cache.Get<MyUserSession>(sessionKey);
If authentication is made with “RememberMe=true” then you want to read the “ss-pid” cookie instead, this preference is stored in the ss-opt cookie.
Thank you so much +Demis Bellot This is exactly what I was looking for!