public UserSessionInfo QuerySession(string sessionId) { using(LoginService service = new LoginService()) { var sessionInfo = service.Query(sessionId); if (sessionInfo == null) { throw new SessionDoesNotExistException(); } return new UserSessionInfo(sessionInfo.User, sessionInfo.Credentials.SessionToken); } }
public void Validate() { _valid = false; using(var service = new LoginService()) { SessionInfo sessionInfo = service.Query(Credentials.SessionToken.Id); if (sessionInfo == null) { throw new SessionValidationException(); } _user.Credentials = sessionInfo.Credentials; SessionToken newToken = service.Renew(Credentials.SessionToken.Id); _user.Credentials.SessionToken = newToken; _valid = true; } }
public void Validate() { _valid = false; using (var service = new LoginService()) { SessionInfo sessionInfo = service.Query(Credentials.SessionToken.Id); if (sessionInfo == null) { throw new SessionValidationException(); } _user.Credentials = sessionInfo.Credentials; SessionToken newToken = service.Renew(Credentials.SessionToken.Id); _user.Credentials.SessionToken = newToken; _valid = true; } }
public void Query() { _valid = false; using (var service = new LoginService()) { SessionInfo sessionInfo = service.Query(Credentials.SessionToken.Id); if (sessionInfo == null) { throw new SessionValidationException(); } if (sessionInfo.Credentials.SessionToken.ExpiryTime < Platform.Time) { throw new SessionValidationException(); } _user.Credentials = sessionInfo.Credentials; _valid = true; } }