コード例 #1
0
        public void AuthenticateUserTest()
        {
            GlobalIdentity g = new GlobalIdentity();
            AuthenticateUserResponse response = g.AuthenticateUser(new AuthenticateUserRequest()
            {
                ApplicationKey = this.ApplicationKey,
                Email = this.UserName + "!",
                Password = this.Password + "!"
            });

            Assert.IsFalse(response.Success);

            response = g.AuthenticateUser(new AuthenticateUserRequest()
            {
                ApplicationKey = this.ApplicationKey,
                Email = this.UserName,
                Password = this.Password
            });

            Assert.IsTrue(response.Success);
        }
コード例 #2
0
        public void IsUserInRoleTest()
        {
            GlobalIdentity g = new GlobalIdentity();
            string[] roles =new[]{"Wolfie"};

            IsUserInRoleResponse response = g.IsUserInRole(new IsUserInRoleRequest()
            {
                ApplicationKey = this.ApplicationKey,
                UserKey = this.UserKey,
                RoleCollection = roles.ToList()
            });

            Assert.IsFalse(response.Success);

            roles[0] = "Doge";
            response = g.IsUserInRole(new IsUserInRoleRequest()
            {
                ApplicationKey = this.ApplicationKey,
                UserKey = this.UserKey,
                RoleCollection = roles.ToList()
            });

            Assert.IsTrue(response.Success);
        }
コード例 #3
0
        public void ValidateApplicationTest()
        {
            GlobalIdentity g = new GlobalIdentity();

            ValidateApplicationResponse response = g.ValidateApplication(new ValidateApplicationRequest()
            {
                ApplicationKey = this.ApplicationKey,
                ClientApplicationKey = this.ClientApplicationKey,
                RawData = "bananas"
            }, this.ClientSecretKey + "!");
            Assert.IsFalse(response.Success);

            response = g.ValidateApplication(new ValidateApplicationRequest()
            {
                ApplicationKey = this.ApplicationKey,
                ClientApplicationKey = this.ClientApplicationKey,
                RawData = "bananas"
            }, this.ClientSecretKey);
            Assert.IsTrue(response.Success);
        }
コード例 #4
0
        public void ValidateTokenTest()
        {
            GlobalIdentity g = new GlobalIdentity();
            ValidateTokenResponse response = g.ValidateToken(new ValidateTokenRequest()
            {
                ApplicationKey = this.ApplicationKey,
                Token = Guid.NewGuid().ToString()
            });

            Assert.IsFalse(response.Success);

            string authenticationToken = g.AuthenticateUser(new AuthenticateUserRequest()
            {
                ApplicationKey = this.ApplicationKey,
                Email = this.UserName,
                Password = this.Password
            }).AuthenticationToken;
            response = g.ValidateToken(new ValidateTokenRequest()
            {
                ApplicationKey = this.ApplicationKey,
                Token = authenticationToken
            });
            Assert.IsTrue(response.Success);
        }