Jeffrey Sullivan - 436 - May 27, 2014

I’m having trouble getting direct manipulation of sessions working properly.  Using some code from the source and a tip from Demis, I’ve put together something in our unit test client to auth the user and then recover the session.  The AuthResponse I’m getting from the service has a SessionId of 533, which results in a constructed urn of “urn:iauthsession:533”, whereas the urn in the Redis cache is “urn:iauthsession:sbQBLwb1WpRj8DqQ7EdL”, so obviously, the thing being passed to the urn builder in the running code is not simply the session id (or the overload being used is not what I think it is).

Here’s the code we’re using in our test base class to try to recover the session from the auth call:

            var client = new JsonServiceClient(ServiceTestAppHost.BaseUrl)
                UserName = userName,
                Password = password,
                AlwaysSendBasicAuthHeader = true

          var response = client.Post<AuthResponse>("/auth/basic", new Auth() { UserName = userName, Password = password, RememberMe = true });

            var sessionKey = IdUtils.CreateUrn<IAuthSession>(response.SessionId);

            var session = _appHost.TryResolve<ICacheClient>().Get<SsoUserSession>(sessionKey);