예제 #1
0
        public void CreateIssuedTokenBindingElement1()
        {
            IssuedSecurityTokenParameters tp =
                new IssuedSecurityTokenParameters();
            SymmetricSecurityBindingElement be =
                SecurityBindingElement.CreateIssuedTokenBindingElement(tp);

            SecurityAssert.AssertSymmetricSecurityBindingElement(
                SecurityAlgorithmSuite.Default,
                true,                 // IncludeTimestamp
                SecurityKeyEntropyMode.CombinedEntropy,
                MessageProtectionOrder.SignBeforeEncryptAndEncryptSignature,
                MessageSecurityVersion.Default,
                false,                 // RequireSignatureConfirmation
                SecurityHeaderLayout.Strict,
                // EndpointSupportingTokenParameters: endorsing, signed, signedEncrypted, signedEndorsing (by count)
                0, 0, 0, 0,
                // ProtectionTokenParameters
                true, SecurityTokenInclusionMode.AlwaysToRecipient, SecurityTokenReferenceStyle.Internal, true,
                // LocalClientSettings
                true, 60, true,

                be, "");

            // test ProtectionTokenParameters
            Assert.AreEqual(tp, be.ProtectionTokenParameters, "#2-1");
            SecurityAssert.AssertSecurityTokenParameters(
                SecurityTokenInclusionMode.AlwaysToRecipient,
                SecurityTokenReferenceStyle.Internal,
                true, tp, "Protection");
        }
예제 #2
0
        public void CreateAnonymousForCertificateBindingElement()
        {
            SymmetricSecurityBindingElement be =
                SecurityBindingElement.CreateAnonymousForCertificateBindingElement();

            SecurityAssert.AssertSymmetricSecurityBindingElement(
                SecurityAlgorithmSuite.Default,
                true,                 // IncludeTimestamp
                SecurityKeyEntropyMode.CombinedEntropy,
                MessageProtectionOrder.SignBeforeEncryptAndEncryptSignature,
                MessageSecurityVersion.Default,
                true,                 // RequireSignatureConfirmation
                SecurityHeaderLayout.Strict,
                // EndpointSupportingTokenParameters: endorsing, signed, signedEncrypted, signedEndorsing (by count)
                0, 0, 0, 0,
                // ProtectionTokenParameters
                true, SecurityTokenInclusionMode.Never, SecurityTokenReferenceStyle.Internal, true,
                // LocalClientSettings
                true, 60, true,

                be, "");

            // test ProtectionTokenParameters
            X509SecurityTokenParameters tp =
                be.ProtectionTokenParameters
                as X509SecurityTokenParameters;

            Assert.IsNotNull(tp, "#2-1");
            SecurityAssert.AssertSecurityTokenParameters(
                SecurityTokenInclusionMode.Never,
                SecurityTokenReferenceStyle.Internal,
                true, tp, "Protection");
            Assert.AreEqual(X509KeyIdentifierClauseType.Thumbprint, tp.X509ReferenceStyle, "#2-2");
        }