Esempio n. 1
0
        public ActionResult Login(string returnUrl)
        {
            var binding = new Saml2PostBinding();

            binding.SetRelayStateQuery(new Dictionary <string, string> {
                { RelayStateReturnUrl, returnUrl }
            });

            return(binding.Bind(new Saml2AuthnRequest
            {
                ForceAuthn = false,
                IsPassive = false,
                NameIdPolicy =
                    new NameIdPolicy
                {
                    AllowCreate = true,
                    Format = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
                },
                RequestedAuthnContext = new RequestedAuthnContext
                {
                    Comparison = AuthnContextComparisonTypes.Exact,
                    AuthnContextClassRef =
                        new[] { AuthnContextClassTypes.PasswordProtectedTransport.OriginalString }
                },
                Issuer = new EndpointReference(Constants.ConfigSettings.SAServiceProviderEntityId),
                Destination = new EndpointAddress(Constants.ConfigSettings.SADestination),
                AssertionConsumerServiceUrl =
                    new EndpointAddress(Constants.ConfigSettings.SAAssertionConsumerServiceUrl),
            }).ToActionResult());
        }