Example #1
0
        public void SignIn(TBody body)
        {
            //  获取 密钥
            string secret = SecretBuilder.Build();

            if (string.IsNullOrWhiteSpace(secret))
            {
                throw new Exception("应用程序密钥(AppSecret)为空或null");
            }

            ICookieFactory cookieFactory = new CookieFactory();
            ICookieClient  cookieClient  = cookieFactory.Create();

            cookieClient.SetCookie(AuthConfigProvider.AuthConfig.CookieName, body.SerializeObject(), AuthConfigProvider.AuthConfig.Expires,
                                   value =>
            {
                ICryptor cryptor = new DesCryptor(SecretBuilder.AppKey, secret);
                return(cryptor.Encrypt(value));
            });
        }