Exemplo n.º 1
0
        protected void SignAssertion(XDocument document)
        {
            //SignatureConfiguration signatureConfiguration = new SignatureConfiguration(new string[] { assertionID }, assertionID, IDValues.Id);
            //signatureConfiguration.setSignatureSiblingNode(subjectNode);
            //AddExtraSignatureConfiguration(signatureConfiguration);

            //SignatureUtil.Sign(SignatureProviderFactory.fromCredentialVault(signingVault), document, signatureConfiguration);
            var         signer   = new SealSignedXml(document);
            XmlDocument envelope = signer.SignAssertion(SigningVault.GetSystemCredentials(), AssertionId);
            // TODO: Assign back
        }
        public override OioSamlAssertion Build()
        {
            ValidateBeforeBuild();

            XElement assertion = CreateDocument();

            if (IncludeIdCardAsBootstrapToken)
            {
                AddIdCardAsBootstrapToken(assertion);
            }

            var signer         = new SealSignedXml(assertion);
            var signedXml      = signer.SignAssertion(SigningVault.GetSystemCredentials(), AssertionId);
            var signedXelement = XElement.Parse(signedXml.OuterXml, LoadOptions.PreserveWhitespace);

            return(new OioSamlAssertion(signedXelement));
        }
        private void AddHealthcareContextToken(XElement actAs)
        {
            var builder = new HealthcareContextTokenDomBuilder(UserGivenName)
            {
                Issuer                = ItSystemName,
                ItSystem              = ItSystemName,
                SubjectName           = SigningVault.GetSystemCredentials().Subject,
                UserGivenName         = UserGivenName,
                UserSurName           = UserSurName,
                UserAuthorizationCode = UserAuthorizationCode,
                SubjectNameId         = ItSystemName,
                SubjectNameIdFormat   = SamlValues.NameidFormatX509SubjectName,
                UserEducationCode     = UserEducationCode,
            };
            var healthCareContextToken = builder.Build();

            AddAssertion(actAs, healthCareContextToken);
        }
 public void SignAssertion(Saml2Assertion assertion)
 {
     assertion.SigningCredentials = new X509SigningCredentials(SigningVault.GetSystemCredentials());
 }