Example #1
0
        public static TokenResponse GetTokenResponseSuccess(string inResponseTo)
        {
            var response         = ResponseFactoryMock.GetTokenResponse(inResponseTo, StatusCodes.Success);
            var assertion        = AssertionFactroryMock.BuildAssertion();
            var token            = AssertionFactroryMock.GetToken(assertion);
            var assertionElement = AssertionFactroryMock.SerialiseToken(token);

            response.Assertions = new XmlElement[] { assertionElement };
            return(response);
        }
Example #2
0
        public static Saml2Assertion BuildAssertion()
        {
            var certificate        = AssertionFactroryMock.GetMockCertificate();
            var signingCredentials = new SigningCredentials(new X509AsymmetricSecurityKey(certificate), SecurityAlgorithms.RsaSha1Signature, SecurityAlgorithms.Sha1Digest, new SecurityKeyIdentifier(new X509RawDataKeyIdentifierClause(certificate)));
            var assertion          = new Saml2Assertion(new Saml2NameIdentifier("https://dg-mfb/idp/shibboleth", new Uri(NameIdentifierFormats.Entity)));

            assertion.Subject            = new Saml2Subject(new Saml2NameIdentifier("TestSubject", new Uri(NameIdentifierFormats.Persistent)));
            assertion.SigningCredentials = signingCredentials;
            return(assertion);
        }