Search code examples
itfoxtec-identity-saml2nemlogin

Require NSIS High in Authn Request


I'm using the ITfoxtec.Identity.Saml2 package and have it connected to the Danish NemLog-in 3. How do I require the NSIS level High in a SAML 2.0 Authn Request?


Solution

  • You can add a RequestedAuthnContext to the Saml2AuthnRequest and with that add a AuthnContextClassRef requiring the NSIS level High (https://data.gov.dk/concept/core/nsis/loa/High).
    Set the Comparison to Minimum.

    var saml2AuthnRequest = new Saml2AuthnRequest(config)
    {
        RequestedAuthnContext = new RequestedAuthnContext
        {
            Comparison = AuthnContextComparisonTypes.Minimum,
            AuthnContextClassRef = new string[]
            {
                //"https://data.gov.dk/concept/core/nsis/loa/Low"
                //"https://data.gov.dk/concept/core/nsis/loa/Substantial",
                "https://data.gov.dk/concept/core/nsis/loa/High"
            },
        },
    };
    

    The code sample is from the TestWebAppCoreNemLogin3Sp sample application which is configured with NemLog-in 3 and show how to implement a NemLog-in 3 Service Provider.