public TerminateSessionResponse TerminateSession(TerminateSessionRequest request)
		{
			Platform.CheckForNullReference(request, "request");
			Platform.CheckMemberIsSet(request.UserName, "UserName");
			Platform.CheckMemberIsSet(request.SessionToken, "SessionToken");

			// get the session and user
			var session = GetSession(request.SessionToken);
			if (session == null)
				throw new InvalidUserSessionException();

			var user = session.User;

			// validate the session, ignoring the expiry time
			session.Validate(request.UserName, false);

			// terminate it
			session.Terminate();

			// delete the session object
			var broker = PersistenceContext.GetBroker<IUserSessionBroker>();
			broker.Delete(session);

			// while we're at it, clean-up any other expired sessions for that user
			CleanExpiredSessions(user);

			return new TerminateSessionResponse();
		}
 public TerminateSessionResponse TerminateSession(TerminateSessionRequest request)
 {
     SessionTokenManager.Instance.RemoveSession(request.SessionToken);
     return new TerminateSessionResponse();
 }
Esempio n. 3
0
        public void Logout(string tokenId)
        {
            var session = SessionCache.Instance.Find(tokenId);
            if (session == null)
            {
                throw new Exception(String.Format("Unexpected error: session {0} does not exist in the cache", tokenId));
            }

            var request = new TerminateSessionRequest(session.Credentials.UserName,
                                                      session.Credentials.SessionToken);


            Platform.GetService(
                delegate(IAuthenticationService service)
                    {
                        service.TerminateSession(request);
                        SessionCache.Instance.RemoveSession(tokenId);
                    });
        }