Beispiel #1
0
 internal bool Match(TokenCacheKey key)
 {
     return(key != null &&
            (key.Authority == this.Authority && key.ScopeEquals(this.Scope) &&
             key.Equals(key.ClientId, this.ClientId) &&
             key.UniqueId == this.UniqueId &&
             key.Equals(key.DisplayableId, this.DisplayableId) && (key.HomeObjectId == this.HomeObjectId) &&
             key.Equals(key.Policy, this.Policy)));
 }
        public void TestScopeEquals()
        {
            TokenCacheKey key = new TokenCacheKey(TestConstants.DefaultAuthorityHomeTenant,
                                                  TestConstants.DefaultScope, TestConstants.DefaultClientId,
                                                  TestConstants.DefaultUniqueId, TestConstants.DefaultDisplayableId, TestConstants.DefaultHomeObjectId,
                                                  TestConstants.DefaultPolicy);

            HashSet <string> otherScope = null;

            Assert.IsFalse(key.ScopeEquals(otherScope));

            otherScope = new HashSet <string>(TestConstants.DefaultScope.ToArray());
            Assert.IsTrue(key.ScopeEquals(otherScope));

            otherScope.Add("anotherscope");
            Assert.IsFalse(key.ScopeEquals(otherScope));

            otherScope.Clear();
            Assert.IsFalse(key.ScopeEquals(otherScope));
        }