User Guide

Identity Provider (IdP) Configuration

How To setup Microsoft Active Directory Federation Services (MSADFS) in Keycloak with SAML

This guide explains how to configure Microsoft Active Directory Federation Services (MSADFS) as an Identity Provider (IdP) in Keycloak.

Note

This guides assumes that you have access to the Authentication Admin Console and to your MSADFS console.

Note

You need the federation metadata endpoint URL from your MSADFS console. This URL is used to configure the IdP in Keycloak. Usually, the URL is in the format https://<ADFS_HOST>/FederationMetadata/2007-06/FederationMetadata.xml.

Keycloak Configuration

To configure MSADFS as an IdP in Keycloak, you need to go to the Authentication Admin Console and follow these steps:

  • Go to Identity Providers > Add provider > SAML v2.0.

  • Select an alias for the IdP, for example, MSADFS.

  • Insert the federation metadata endpoint URL from your MSADFS console

  • Click on Save.

Note

Following configurations depends on your MSADFS setup. Please refer to your MSADFS documentation for more information. We recommend to set the following configuration parameters that usually work for most setups

  • NameID Policy Format: Unspecified

  • Want AuthnRequests Signed: TRUE

  • SAML Signature Key Name: CERT_SUBJECT

  • Validate Signature: TRUE

  • Use metadata descriptor URL: TRUE

Now we need to create a new mapper in Mappers with the following settings:

  • Name: username

  • Mapper Type: Attribute Importer

  • Attribute Name: http://schemas.microsoft.com/2012/12/certificatecontext/field/subjectname

  • User Attribute Name: username

Note

The Attribute Name MAY be different for you, referer to your claim names, in this configuration we use the subject name.

At this point, you can complete the rest of the configuration with common settings, please refer to Common IdP configuration and IdP After Setting up configuration sections to find all the information you need.

MSADFS Configuration

Now you need to configure the Keycloak as a relying party in your MSADFS console. You can follow this guide to add a new relying party in your MSADFS console:

Note

You can use the federation metadata URL from Keycloak to automatically configure the ADFS relying party. You can find it in the provider settings in the Identity Providers section.

Warning

If the metadata URL is not working, you can download the XML from keycloak at the same federation metadata URL and upload it in the MSADFS console.

After you have configured the relying party, you need to add the claim rules to map the user attributes to the SAML token. You can follow this guide to map your LDAP attributes to SAML attributes.

At the very minimum you need to map the username to the SAML token. In our how-to guide, we have mapped the sAMAccountName field in MSADFS as Subject Name, but it can be mapped depending on your setup.

LDAP Attribute

Outgoing Claim Type

sAMAccountName

Subject Name

Note

Remember to complete the rest of the configuration with common settings, please refer to Common IdP configuration and IdP After Setting up configuration sections to find all the information you need.

How To setup FortiAuthenticator in Keycloak with OIDC

This guide explains how to configure FortiAuthenticator (6.6.2) as an Identity Provider (IdP) in Keycloak.

Note

This guide assumes that you have access to the Authentication Admin Console and to your FortiAuthenticator console.

Note

You need the discovery info endpoint URL from your FortiAuthenticator instance. This URL is used to configure the IdP auto-discovery in Keycloak. Following this guide the URL should be https://<FORTIAUTHENTICATOR_HOST>/api/v1/oauth/.well-known/openid-configuration/.

Client and Keycloak Configuration

To configure FortiAuthenticator as an IdP in Keycloak, you need to go to the Authentication Admin Console and follow these steps:

  • Go to Identity Providers > Add provider > OpenID Connect v1.0.

  • Select an alias for the IdP, for example, Fortinet and copy the redirect URL.

  • Open a new page and go to your FortiAuthenticator console.

Next, we need to create a new OIDC client in FortiAuthenticator, you can follow this guide to create a new client. Feel free to configure the settings as needed, however, it is recommended to use the following parameters:

Field

Value

Client type

confidential

Authorization grant types

Authorization Code

Scopes

openid. You can read this guide to create scopes

Claims

With openid you need to add at least one claim: the username. You can read this guide to create claims

Redirect URIs

The redirect URL from Keycloak

Note

Other parameters have to be configured depending on your own setup.

Now you can copy the client id and the secret, and put them in the Keycloak configuration. After that, simply click on Save.

Next step is adding a new mapper in Mappers with the following settings:

  • Name: username

  • Mapper Type: Attribute Importer

  • Attribute Name: **username**

  • User Attribute Name: username

Note

The Attribute Name MAY be different for you, refer to your claim names to make sure. In this configuration we used username.

At this point, you can complete the rest of the configuration with common settings, please refer to Common IdP configuration and IdP After Setting up configuration sections to find all the information you need.

How To setup PingFederate in Keycloak with OIDC

This guide explains how to configure PingFederate as an Identity Provider (IdP) in Keycloak.

Note

This guide assumes that you have access to the Authentication Admin Console and to your PingFederate instance.

Note

You need the discovery info endpoint URL from your PingFederate instance. This URL is used to configure the IdP auto-discovery in Keycloak. Following this guide the URL should be https://<PINGFEDERATE_HOST>/.well-known/openid-configuration.

Client and Keycloak Configuration

To configure PingFederate as an IdP in Keycloak, you need to go to the Authentication Admin Console and follow these steps:

  • Go to Identity Providers > Add provider > OpenID Connect v1.0.

  • Select an alias for the IdP, for example, PingFederate and copy the redirect URL.

  • Open a new page and go to your PingFederate console.

Next, we need to create a new OIDC client in PingFederate, you can follow this guide to create a new client. Feel free to configure the settings as needed, however, it is recommended to use the following parameters:

Field

Value

Client Authentication

Client Secret

Allowed Grant Types

Select at least Authorization Code

Scopes

At least openid and profile

Redirection URI

The redirect URL from Keycloak

Note

Other parameters have to be configured depending on your own setup.

Now you can copy the client id and the secret, and put them in the Keycloak configuration. After that, simply click on Save.

Next step is adding a new mapper in Mappers with the following settings:

  • Name: username

  • Mapper Type: Attribute Importer

  • Attribute Name: sub

  • User Attribute Name: username

Note

The Attribute Name MAY be different for you, refer to your claim names to make sure. In this configuration we used sub that is the default with profile scope

At this point, you can complete the rest of the configuration with common settings, please refer to Common IdP configuration and IdP After Setting up configuration sections to find all the information you need.