Connect NemLog-in as authentication method

You can connect FoxIDs to NemLog-in (Danish IdP) with a SAML 2.0 authentication method and let the users authenticate with MitID. NemLog-in is connected as a SAML 2.0 Identity Provider (IdP).

By configuring an SAML 2.0 authentication method and a OpenID Connect application registration FoxIDs become a bridge between SAML 2.0 and OpenID Connect. FoxIDs will then handle the SAML 2.0 connection as a Relying Party (RP) / Service Provider (SP) and you only need to care about OpenID Connect in your application. If needed, you can possibly select multiple login option (authentication methods) from the same OpenID Connect application registration.

Connect to NemLog-in

FoxIDs support NemLog-in and the SAML 2.0 based OIOSAML3 including single logout (SLO), logging, issuer naming, required OCES3 (RSASSA-PSS) certificates and it is possible to support NSIS.

You can test the NemLog-in login with the online web app sample (sample docs) by clicking Log in and then Danish NemLog-in TEST for the test environment or Danish NemLog-in for production.
Take a look at the NemLog-in sample configuration in FoxIDs Control: https://control.foxids.com/test-corp
Get read access with the user [email protected] and password TestAccess! then select the nemlogin or nemlogin-test environment.
The sample is configured with a separate environment for the NemLog-in SAML 2.0 integration.

NemLog-in documentation:

Transform the DK privilege XML claim to a JSON claim.

Consider separate environment

NemLog-in requires the Relying Party (RP) to use a OSES3 certificate and extensive logging. Therefore, consider connecting NemLog-in in a separate environment where the OCES3 certificate and log level can be configured without affecting anything else.

Connect to NemLog-in and use Environment Link

You can connect two environments in the same tenant with a Environment Link.

Certificate

NemLog-in requires all requests (authn and logout) from the Relying Party (RP) to be signed. Furthermore, NemLog-in requires the RP to sign with a OCES3 certificate. It is not possible to use a certificate issued by another certificate authority, a self-signed certificate or a certificate issued by FoxIDs.

OCES3 test certificates are use in the test environment and OCES3 production certificates are used in production. An OCES3 certificate is valid for three years. After that, it must be updated manually.
You will need separate FoxIDs environments to handle the test and production environments respectively. The environments can optionally be combined in an app environment with environment links.

Add the .P12 OCES3 certificate in FoxIDs Control Client:

  1. Select (or create) the environment to be used for NemLog-in
  2. Select the Certificates tab
  3. Click the arrow down on the Swap certificate button and then in the Contained certificates section click Change container type

Change container type

  1. Then click on the primary certificate, then write the password and upload the .P12 OCES3 certificate

Add OCES3 certificate

It is subsequently possible to add a secondary certificate and to swap between the primary and secondary certificates.

Configuring NemLog-in 3 as Identity Provider (IdP)

You need to configure the OCES3 certificate before following this guide.

1) - Start by creating an SAML 2.0 authentication method in FoxIDs Control Client

  1. Select the Authentication methods tab
  2. Click New authentication and then SAML 2.0
  3. Add the name
  4. Select show advanced
  5. Select the dot URL binding pattern
  6. Set the session lifetime to 1800 (30 minutes) in the Logout session tab
  7. Go back to the SAML tab

NemLog-in SAML 2.0 authentication method

  1. Disable automatic update
  2. Click Read metadata from file and select the NemLog-in IdP-metadata

NemLog-in SAML 2.0 authentication method

  1. Configure a custom SP issuer, the issuer can optionally start with https://saml.
    • The issuer in this example is https://saml.foxids.com/test-corp/nemlogin-test/
  2. Optionally remove the * and configure claims, the following claims is most often used:
    • https://data.gov.dk/concept/core/nsis/loa
    • https://data.gov.dk/model/core/eid/cprNumber
    • https://data.gov.dk/model/core/eid/cprUuid
    • https://data.gov.dk/model/core/eid/email
    • https://data.gov.dk/model/core/eid/firstName
    • https://data.gov.dk/model/core/eid/lastName
    • https://data.gov.dk/model/core/eid/professional/cvr
    • https://data.gov.dk/model/core/eid/professional/orgName
    • https://data.gov.dk/model/core/eid/professional/uuid/persistent
    • https://data.gov.dk/model/core/specVersion
    • optionally include the privilege claim, see step 3)

NemLog-in SAML 2.0 authentication method

  1. In production only! optionally the Certificate validation mode to Chain trust if the OCES3 root certificate is trusted on your platform. The OCES3 root certificate is NOT trusted in Azure
    Set the Certificate revocation mode to Online
  2. Select to include the encryption certificate in metadata
  3. Set the NameID format in metadata to urn:oasis:names:tc:SAML:2.0:nameid-format:persistent

NemLog-in SAML 2.0 authentication method

  1. Add an attribute consuming service in metadata and add the service name.
  2. Add all the claims configured in step 11 as requested attributes with the format urn:oasis:names:tc:SAML:2.0:attrname-format:uri. Optionally set each attribute as required.

NemLog-in SAML 2.0 authentication method

  1. Add at least one technical contact person

NemLog-in SAML 2.0 authentication method

  1. Click create
  2. Go to the top of the SAML 2.0 authentication method
  3. Download the SAML 2.0 authentication method SP-metadata, in this case https://foxids.com/test-corp/nemlogin-test/.nemlogin./saml/spmetadata.
  4. The SP-metadata file is used to configure the NemLog-in IT system.

2) - Then go to the NemLog-in adminstration protal

First you need to create an NemLog-in IT-system or have someone else creating an NemLog-in IT-system and assign you access.

  1. Select the IT-system
  2. Click upload metadata file and upload the SAML 2.0 authentication method SP-metadata file
  3. Go back to the IT-system
  4. Click the button Save the technical details
  5. Click Provision to integrationtest and then click Apply for integration test

To configure production you need to upload a test report, have it approved and then repeat the FoxIDs and NemLog-in configuration.

3) - Optionally - Configure MitID app-switch to mobile app in FoxIDs Control Client

Optionally, configure MitID app-switch if you are using NemLog-in / MitID in a mobile app.

NemLog-in support mobile app-switch using either Universal Links on iOS or App Links on Android, based on a return URL which is handed to NemLog-in in a SAML 2.0 extension as part of the authn (login) request.

The return URL is the URL for your mobile app and the return URL is used to app-switch back to your mobile app from the MitID app after authentication.

The return URL is configured as XML, if the return URL for your Android app is https://myapp.page.link/zyx
The SAML 2.0 authn request extension XML is:

<nl:AppSwitch xmlns:nl="https://data.gov.dk/eid/saml/extensions">
  <nl:Platform>Android</nl:Platform>
  <nl:ReturnURL>https://myapp.page.link/zyx</nl:ReturnURL>
</nl:AppSwitch>

Select show advanced settings and add the extension XML in Authn request extensions XML and click Update

NemLog-in SAML 2.0 authn request extension XM

You can only configure one SAML 2.0 extension per authentication method in FoxIDs, therefor you might need to configure multiple authentication method for NemLog-in. One authentication method for your web site without a SAML 2.0 extension, and one authentication method for each of the supported mobile app platforms.

As of now iOS do not require a return URL to do app-switch. But this can change over time!
Therefor, you currently only need two authentication methods; one for your web site and iOS app without a redirect URL and one for your Android app with a redirect URL.

4) - Optionally - add privilege claim transformation in FoxIDs Control Client

Optionally, if you are using the privilege claim.

FoxIDs can transform the DK privilege XML claim to a JSON claim. It is recommended to add the transformation in order to obtain smaller claims and tokens. Furthermore, it makes the tokens readable.

  1. Add the DK privilege claim transformer.
  2. Remove the original privilege claim from the claims pipeline.

NemLog-in SAML 2.0 authentication method privilege claim transformation

5) - Add SAML 2.0 claim to JWT claim mappings in FoxIDs Control Client

FoxIDs internally converts SAML 2.0 clams to JWT claims. NemLog-in / OIOSAML3 defines a set of SAML 2.0 claims where JWT mappings need to be added.

  1. Go to the Settings tab and Claim mappings
  2. Add mappings for all the claims configured in step 1.11, optionally also include mapping for the privilege claim, you can create you own short JWT claim names
  3. Click update

Claim mappings

The SAML 2.0 authentication method can now be used as an authentication method for application registrations in the environment.

Logging

NemLog-in requires requests and responses to be logged including the signature proof and stored for half a year (180 days). It is also required to log which identity has login and logout of which session, at what time and the IP address.
FoxIDs default log errors and events including the time and the IP address.

With an Enterprise plan on FoxIDs.com log data is stored for 180 days. If you are using a Free or Pro plan, you can send logs to your own Application Insights with a log stream and thereby save the logs for 180 days.

It can be configured which logs should be logged to the Application Insights which is part of the FoxIDs installation or to an external repository with a log stream.

The log level NemLog-in require is configured in the FoxIDs log settings:

  1. Enable log info trace
  2. Enable log claims trace
  3. Enable log message trace
  4. Click update

NemLog-in SAML 2.0 authentication method

Request authentication context

You can request a desired NSIS assurance level as an authn context class reference.

NSIS assurance level in SAML 2.0 authentication method

Possible NSIS assurance levels:

  • 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

You can likewise specify ID type as an authn context class reference.

ID type in SAML 2.0 authentication method

Possible ID types:

  • https://data.gov.dk/eid/Person
  • https://data.gov.dk/eid/Professional

And possible credential types:

  • https://nemlogin.dk/internal/credential/type/nemidkeycard
  • https://nemlogin.dk/internal/credential/type/nemidkeyfile
  • https://nemlogin.dk/internal/credential/type/mitid
  • https://nemlogin.dk/internal/credential/type/local
  • https://nemlogin.dk/internal/credential/type/test

In the case you need to provide different sets of authn context class references. You need to create multiple SAML 2.0 authentication methods connected to NemLog-in as different IT systems.
E.g., if you need to support step-up authentication. Then you would create one SAML 2.0 authentication method with authn context class reference https://data.gov.dk/concept/core/nsis/loa/Substantial and another SAML 2.0 authentication method with authn context class reference https://data.gov.dk/concept/core/nsis/loa/High.