Example #1
0
        public void Invalid_Scope()
        {
            var validator = new ScopeValidator(_logger);
            var scopes    = validator.ParseScopes("openid email resource1 resource2 unknown");

            var result = validator.AreScopesValid(scopes, _allScopes);

            Assert.IsFalse(result);
        }
        public void Disabled_Scope()
        {
            var validator = new ScopeValidator();
            var scopes    = validator.ParseScopes("openid email resource1 resource2 disabled");

            var result = validator.AreScopesValid(scopes, _allScopes);

            Assert.IsFalse(result);
        }
Example #3
0
        public void All_Scopes_Valid()
        {
            var validator = new ScopeValidator(_logger);
            var scopes    = validator.ParseScopes("openid email resource1 resource2");

            var result = validator.AreScopesValid(scopes, _allScopes);

            Assert.IsTrue(result);
        }
        public void Invalid_Scope()
        {
            var validator = new ScopeValidator();
            var scopes    = validator.ParseScopes("openid email resource1 resource2 unknown");

            var result = validator.AreScopesValid(scopes, _allScopes);

            result.Should().BeFalse();
        }
        public void All_Scopes_Valid()
        {
            var validator = new ScopeValidator();
            var scopes    = validator.ParseScopes("openid email resource1 resource2");

            var result = validator.AreScopesValid(scopes, _allScopes);

            result.Should().BeTrue();
        }
Example #6
0
        public void Contains_Identity_Scopes_Only()
        {
            var validator = new ScopeValidator(_logger);
            var scopes    = validator.ParseScopes("openid email");

            var result = validator.AreScopesValid(scopes, _allScopes);

            Assert.IsTrue(result);
            Assert.IsTrue(validator.ContainsOpenIdScopes);
            Assert.IsFalse(validator.ContainsResourceScopes);
        }
Example #7
0
        public void Contains_Resource_Scopes_Only()
        {
            var validator = new ScopeValidator();
            var scopes    = validator.ParseScopes("resource1 resource2");

            var result = validator.AreScopesValid(scopes, _allScopes);

            Assert.IsTrue(result);
            Assert.IsFalse(validator.ContainsOpenIdScopes);
            Assert.IsTrue(validator.ContainsResourceScopes);
        }
Example #8
0
        public void Contains_Resource_and_Identity_Scopes()
        {
            var validator = new ScopeValidator();
            var scopes    = validator.ParseScopes("openid email resource1 resource2");

            var result = validator.AreScopesValid(scopes, _allScopes);

            Assert.IsTrue(result);
            Assert.IsTrue(validator.ContainsOpenIdScopes);
            Assert.IsTrue(validator.ContainsResourceScopes);
        }
        public void Contains_Identity_Scopes_Only()
        {
            var validator = new ScopeValidator();
            var scopes    = validator.ParseScopes("openid email");

            var result = validator.AreScopesValid(scopes, _allScopes);

            result.Should().BeTrue();
            validator.ContainsOpenIdScopes.Should().BeTrue();
            validator.ContainsResourceScopes.Should().BeFalse();
        }