public Nancy.Security.IUserIdentity GetUserFromIdentifier(Guid identifier, Nancy.NancyContext context) { RemoveExpiredIdentities(); if (_cachedIdentities.ContainsKey(identifier)) return _cachedIdentities[identifier].Identity; //todo: build from database with claims var identity = new UserIdentity("Mathieu"); _cachedIdentities.Add(identifier, new UserIdentityContainer(identity, DateTime.Now.AddSeconds(10))); return identity; }
public UserIdentityContainer(UserIdentity identity, DateTime expires) { _identity = identity; _expires = expires; }