public void SetAuthenticationInfo(AuthenticationInfo authenticationInfo)
 {
     string userData = JsonConvert.SerializeObject(authenticationInfo);
     var formsAuthenticationTicket = new FormsAuthenticationTicket(1, authenticationInfo.UserAlias,
         DateTime.Now, DateTime.Now.AddHours(1),
         false, userData);
     string encryptedCookie = FormsAuthentication.Encrypt(formsAuthenticationTicket);
     var httpCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedCookie);
     _httpContextProvider.AddCookie(httpCookie);
 }
 public static AuthenticationInfo AsAuthenticationInfo(this OAuthAccessToken accessToken)
 {
     var authenticationInfo = new AuthenticationInfo();
     if (accessToken != null)
     {
         var userId = accessToken.UserId;
         Person person = new Flickr().PeopleGetInfo(userId);
         authenticationInfo = new AuthenticationInfo(userId, person.PathAlias, accessToken.Username, accessToken.Token); // , accessToken.TokenSecret
     }
     return authenticationInfo;
 }
 public static AuthenticationInfo AsAuthenticationInfo(this Auth auth)
 {
     var authenticationInfo = new AuthenticationInfo();
     if (auth != null)
     {
         var userId = auth.User.UserId;
         Person person = new Flickr().PeopleGetInfo(userId);
         var userAlias = person.PathAlias.IfNullOrEmpty(userId);
         authenticationInfo = new AuthenticationInfo(userId, userAlias, auth.User.UserName, auth.Token);
     }
     return authenticationInfo;
 }