Exemple #1
0
 Maybe<SessionIdentity> VerifyAndLoad(AuthInfo info)
 {
     var maybe = _view.Get(info.Login);
     if (!maybe.HasValue)
         return Maybe<SessionIdentity>.Empty;
     var view = maybe.Value;
     // Stored token does not match actual token.
     // Crash this one
     if (!string.Equals(view.Token, info.Token))
         return Maybe<SessionIdentity>.Empty;
     return new SessionIdentity(info.Login, view.Security, view.Display, info.ToCookieString(), view.Permissions,
         info.Token);
 }
 public static SessionIdentity Create(string dispay, UserId user, string token, SecurityId sec,
     params string[] permissions)
 {
     var auth = new AuthInfo(user, token);
     return new SessionIdentity(user, sec, dispay, auth.ToCookieString(), permissions, token);
 }
 static AuthenticationResult ViewToResult(UserId id, LoginView view)
 {
     var auth = new AuthInfo(id, view.Token);
     var result =
         new AuthenticationResult(new SessionIdentity(id, view.Security, view.Display, auth.ToCookieString(),
             view.Permissions, view.Token));
     return result;
 }