---
title: Keycloak Identity Provider
slug: homologacao-atmosphere/keycloak-identity-provider
description: Learn about the parameters and subfields used to manage Keycloak identity providers. This document covers various options such as alias, displayName, enabled, and more. It also explains the subfields within the config and mappers options. Find examples of
createdAt: 2021-10-26T17:27:11.000Z
---

# Resumo

- This module creates, removes or update Keycloak identity provider.

# Parâmetros

| **Parâmetro**                    | **Tipo**   | **Escolhas \| Valor Padrão**                          | **Comentários**                                          |
| -------------------------------- | ---------- | ----------------------------------------------------- | -------------------------------------------------------- |
| alias - *required*               | string     |                                                       | The alias of the identity provider.                      |
| addReadTokenRoleOnCreate         | boolean    | Escolhas:<br />- false<br />(default)<br />- true     | add Read Token Role On Create.                           |
| authenticateByDefault            | boolean    | Escolhas:<br />- false<br />(default)<br />- true     | authenticate By Default.                                 |
| config<br />(Possíveis valores)  | dictionary |                                                       | Detailed configuration of the identity provider.         |
| displayName                      | string     |                                                       | The display name of the realm.                           |
| enabled                          | boolean    | Escolhas:<br />- false<br />- true<br />(default)     | enabled.                                                 |
| firstBrokerLoginFlowAlias        | string     |                                                       |  first Broker Login Flow Alias.                          |
| force                            | boolean    | Escolhas:<br />- false<br />(default)<br />- true     | If true, allows to remove realm and recreate it.         |
| linkOnly                         | boolean    | Escolhas:<br />- false<br />(default)<br />- true     | Link only option for identity provider                   |
| mappers<br />(Possíveis valores) | list       |                                                       | List of mappers for the Identity provider.               |
| providerId                       | string     |                                                       | Type of identity provider.                               |
| postBrokerLoginFlowAlias         | string     |                                                       | post Broker Login Flow Alias.                            |
| realm                            | string     | - master<br />(default)                               | The name of the realm in which is the identity provider. |
| state                            | string     | Escolhas:<br />- present<br />(default)<br />- absent | Control if the realm exists.                             |
| storeToken                       | boolean    | Escolhas:<br />- false<br />- true<br />(default)     |  store Token.                                            |
| trustEmail                       | boolean    | Escolhas:<br />- false<br />(default)<br />- true     | trust Email.                                             |
| updateProfileFirstLoginMode      | string     |                                                       | update Profile First Login Mode.                         |



## Subcampos da opção config

| **Parâmetro**                                                                                                                                                                 | **Tipo** | **Escolhas \| Valor Padrão**                      | **Comentários**                                                                                                                |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| openIdConfigurationUrl                                                                                                                                                        | string   |                                                   | Open ID configuration URL of the IdP to configure. Will be used to configure IdP endpoints.                                    |
| clientId                                                                                                                                                                      | string   |                                                   | Client ID used to authenticate Keycloak on this IdP                                                                            |
| clientSecret                                                                                                                                                                  | string   |                                                   | Client secret to authenticate client on the IdP.                                                                               |
| disableUserInfo                                                                                                                                                               | string   | Escolhas:<br />- false<br />(default)<br />- true | Do we need to disable user info endpoint query. Default value is False.<br />- Must be set to true when IdP is Microsoft ADFS. |
| defaultScope                                                                                                                                                                  | string   |                                                   | Default scope supported with this IdP                                                                                          |
| guiOrder                                                                                                                                                                      | integer  |                                                   | Order to display the IdP button on login screen. Lower's first.                                                                |
| backchannelSupported:<br />description:<br />- Is back channel logout is supported by the IdP.<br />type: str<br />choices:<br />- 'true'<br />- 'false'<br />default: 'true' |          |                                                   |                                                                                                                                |



### Subcampos da opção mappers

| **Parâmetro**                                                                                                                                                                     | **Tipo** | **Escolhas \| Valor Padrão** | **Comentários** |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------------------- | --------------- |
| name:<br />description:<br />- Name of the mapper<br />type: str                                                                                                                  |          |                              |                 |
| identityProviderMapper:<br />description:<br />- Type of identity provider mapper.<br />type: str<br />choices:<br />- oidc-user-attribute-idp-mapper<br />- oidc-role-idp-mapper |          |                              |                 |
| config:<br />description:<br />- Configuration for this mapper.<br />type: dict                                                                                                   |          |                              |                 |



### Subcampos da opção config

| **Parâmetro**                                                                                                                                                                                                                | **Tipo** | **Escolhas \| Valor Padrão** | **Comentários** |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ---------------------------- | --------------- |
| claim:<br />description:<br />- Name of the claim to map.<br />type: str                                                                                                                                                     |          |                              |                 |
| user.attribute:<br />description:<br />- This option is for oidc-user-attribute-idp-mapper<br />- User attribute to copy the claim value to.<br />type: str                                                                  |          |                              |                 |
| claim.value:<br />description:<br />- This option is for oidc-role-idp-mapper<br />- Role will be granted to the user only if the claim match this value.<br />type: str                                                     |          |                              |                 |
|  role:                    description:                        - This option is for oidc-role-idp-mapper                        - Role to be granted to the user if the claim match claim.value.                    type: str |          |                              |                 |



# Exemplos

```yaml
# Exemplo: Create IdP1 fully configured with idp user attribute mapper and a role mapper
- keycloak_identity_provider:
    auth_keycloak_url: http://localhost:8080/auth
    auth_username: admin
    auth_password: password
    auth_realm: master
    realm: "master"
    alias: "IdP1"
    displayName: "My super dooper IdP"
    providerId: "oidc"
    config:
      openIdConfigurationUrl: https://my.idp.com/auth
      clientId: ClientIdMyIdpGaveMe
      clientSecret: ClientSecretMyIdpGaveMe
      disableUserInfo: False
      defaultScope: "openid email profile"
      guiOrder: 1
      backchannelSupported: True
    mappers:
      - name: ClaimMapper
        identityProviderMapper: oidc-user-attribute-idp-mapper
        config:
          claim: claim1
          user.attribute: attr1
        state: present
      - name: MyRoleMapper
        identityProviderMapper: oidc-role-idp-mapper
        config:
          claim: claimName
          claim.value: valueThatGiveRole
          role: roleName
        state: absent
    state: present

# Exemplo: Re-create the Idp1 without mappers. The existing Idp will be deleted.
- keycloak_identity_provider:
    auth_keycloak_url: http://localhost:8080/auth
    auth_username: admin
    auth_password: password
    auth_realm: master
    realm: "master"
    alias: "IdP1"
    displayName: "My super dooper IdP"
    providerId: "oidc"
    config:
      openIdConfigurationUrl: https://my.idp.com/auth
      clientId: ClientIdMyIdpGaveMe
      clientSecret: ClientSecretMyIdpGaveMe
      disableUserInfo: False
      defaultScope: "openid email profile"
      guiOrder: 2
      backchannelSupported: True
    state: present
    force: yes

# Exemplo: Remove a the Idp IdP1.
- keycloak_identity_provider:
    auth_keycloak_url: http://localhost:8080/auth
    auth_username: admin
    auth_password: password
    auth_realm: master
    realm: "master"
    alias: IdP1
    state: absent
```



## Valores retornados

| **Chave** | **Tipo**   | **Retornado quando** | **Descrição**                                                                                       |
| --------- | ---------- | -------------------- | --------------------------------------------------------------------------------------------------- |
| idp       | dictionary | Sucesso              | JSON representation for the identity provider.                                                      |
| mappers   | list       | Sucesso              | List of idp's mappers                                                                               |
| msg       | string     | Error                | Error message if it is the case                                                                     |
| changed   | boolean    | Sucesso              | Return True if the operation changed the identity provider on the keycloak server, false otherwise. |

