Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public static SignInMessage BuildMessage(string userName, string password, string clientId)
        {
            SignInMessage msg = new SignInMessage()
            {
                ClientId = clientId,
                UserName = userName
            };
            RSAEncryptionCreator encryption = new RSAEncryptionCreator();

            msg.Password = encryption.PublicEncryption(password);
            return(msg);
        }