Ejemplo n.º 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");
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 3
0
        public void CreateSslNegotiationBindingElement()
        {
            SymmetricSecurityBindingElement be =
                SecurityBindingElement.CreateSslNegotiationBindingElement(true, true);

            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, "");

            // FIXME: also try different constructor arguments

            // test ProtectionTokenParameters
            Assert.AreEqual(typeof(SslSecurityTokenParameters), be.ProtectionTokenParameters.GetType(), "#1");
            SslSecurityTokenParameters sp = be.ProtectionTokenParameters as SslSecurityTokenParameters;

            Assert.AreEqual(true, sp.RequireCancellation, "#2");
            Assert.AreEqual(true, sp.RequireClientCertificate, "#3");
        }
Ejemplo n.º 4
0
        public void CreateUserNameForSslBindingElement()
        {
            SymmetricSecurityBindingElement be =
                SecurityBindingElement.CreateUserNameForSslBindingElement();

            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, 1, 0,
                // ProtectionTokenParameters
                true, SecurityTokenInclusionMode.AlwaysToRecipient, SecurityTokenReferenceStyle.Internal, true,
                // LocalClientSettings
                true, 60, true,

                be, "");

            UserNameSecurityTokenParameters up =
                be.EndpointSupportingTokenParameters.SignedEncrypted [0] as UserNameSecurityTokenParameters;
            // FIXME: test it

            // FIXME: test ProtectionTokenParameters
        }
        public void DefaultValues()
        {
            SymmetricSecurityBindingElement be =
                new SymmetricSecurityBindingElement();

            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
                false,
                default(SecurityTokenInclusionMode),
                default(SecurityTokenReferenceStyle),
                default(bool),
                // LocalClientSettings
                true, 60, true,

                be, "");
        }