コード例 #1
0
        public async Task CreateFiltersDelegatingIdentifiers()
        {
            Identifier id = GetMockIdentifier(ProtocolVersion.V20, false, true);
            var        rp = CreateRelyingParty();

            // First verify that delegating identifiers work
            Assert.IsTrue((await AuthenticationRequest.CreateAsync(id, rp, this.realm, this.returnTo, false, CancellationToken.None)).Any(), "The delegating identifier should have not generated any results.");

            // Now disable them and try again.
            rp.SecuritySettings.RejectDelegatingIdentifiers = true;
            Assert.IsFalse((await AuthenticationRequest.CreateAsync(id, rp, this.realm, this.returnTo, false, CancellationToken.None)).Any(), "The delegating identifier should have not generated any results.");
        }
コード例 #2
0
        public async Task DualIdentifierUsedOnlyAsOPIdentifierForAuthRequest()
        {
            var rp      = this.CreateRelyingParty(true);
            var results = (await AuthenticationRequest.CreateAsync(GetMockDualIdentifier(), rp, this.realm, this.returnTo, false, CancellationToken.None)).ToList();

            Assert.AreEqual(1, results.Count);
            Assert.IsTrue(results[0].IsDirectedIdentity);

            // Also test when dual identiifer support is turned on.
            rp.SecuritySettings.AllowDualPurposeIdentifiers = true;
            results = (await AuthenticationRequest.CreateAsync(GetMockDualIdentifier(), rp, this.realm, this.returnTo, false, CancellationToken.None)).ToList();
            Assert.AreEqual(1, results.Count);
            Assert.IsTrue(results[0].IsDirectedIdentity);
        }