Example #1
0
        public void LoginTestMethod1()
        {
            Configuration.Configure();
            AccountBussiness accountBussines = new AccountBussiness();
            SignInMessage    msg             = new SignInMessage();

            msg.UserName = "******";
            RSAEncryptionCreator encryption = new RSAEncryptionCreator();

            msg.Password = encryption.PublicEncryption("123");
            msg.ClientId = "1";
            var result = accountBussines.Authenticate(msg);

            Assert.AreNotEqual(result.HasError, true);
            Assert.AreNotEqual(result.IdentityToken.Signature, string.Empty);

            TokenValidator validator       = new TokenValidator();
            var            tokenValidation = validator.ValiateIdentityToken(result.IdentityToken);
            var            strToken        = result.IdentityToken.ToString();
            IdentityToken  cToken          = new IdentityToken(strToken);
            var            strCtoken       = cToken.ToString();

            Assert.AreEqual(strToken, strCtoken);
            Assert.AreEqual(tokenValidation.IsError, true);
        }
Example #2
0
        public static void SetToken(IdentityToken token)
        {
            // HttpContext.Current.Session["identityToken"] = token;
            var strToken = token.ToString();
            var encToken = ISE.Framework.Utility.Utils.Encryption.EncryptData(strToken);

            HttpContext.Current.Response.Cookies.Add(new HttpCookie("identityToken", encToken));
        }