コード例 #1
0
ファイル: Utils.cs プロジェクト: NGITechnology/BeymenCheckout
        public static HttpCookie GetFormsAuthenticationCookie(AuthorizationInfoDTO authorizationInfoDTO)
        {
            HttpCookie formsAuthenticationTicketCookie;
            DateTime cookieIssuedDate = DateTime.Now;

            var ticket = new FormsAuthenticationTicket(0,
                authorizationInfoDTO.User.UserName,
                cookieIssuedDate,
                cookieIssuedDate.AddMinutes(FormsAuthentication.Timeout.TotalMinutes),
                false,
                authorizationInfoDTO.Token.TokenString,
                FormsAuthentication.FormsCookiePath);

            string encryptedCookieContent = FormsAuthentication.Encrypt(ticket);

            formsAuthenticationTicketCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedCookieContent)
            {
                Domain = FormsAuthentication.CookieDomain,
                Path = FormsAuthentication.FormsCookiePath,
                HttpOnly = true,
                Secure = FormsAuthentication.RequireSSL
            };
            return formsAuthenticationTicketCookie;
        }
コード例 #2
0
 public EgasIdentity(AuthorizationInfoDTO authData)
 {
     this.AuthData = authData;
 }