UserAttributeMapper

# keycloak.ldap.UserAttributeMapper

Allows for creating and managing user attribute mappers for Keycloak users federated via LDAP.

The LDAP user attribute mapper can be used to map a single LDAP attribute to an attribute on the Keycloak user model.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as keycloak from "@pulumi/keycloak";

const realm = new keycloak.Realm("realm", {
    enabled: true,
    realm: "test",
});
const ldapUserFederation = new keycloak.ldap.UserFederation("ldap_user_federation", {
    bindCredential: "admin",
    bindDn: "cn=admin,dc=example,dc=org",
    connectionUrl: "ldap://openldap",
    rdnLdapAttribute: "cn",
    realmId: realm.id,
    userObjectClasses: [
        "simpleSecurityObject",
        "organizationalRole",
    ],
    usernameLdapAttribute: "cn",
    usersDn: "dc=example,dc=org",
    uuidLdapAttribute: "entryDN",
});
const ldapUserAttributeMapper = new keycloak.ldap.UserAttributeMapper("ldap_user_attribute_mapper", {
    ldapAttribute: "bar",
    ldapUserFederationId: ldapUserFederation.id,
    realmId: realm.id,
    userModelAttribute: "foo",
});
import pulumi
import pulumi_keycloak as keycloak

realm = keycloak.Realm("realm",
    enabled=True,
    realm="test")
ldap_user_federation = keycloak.ldap.UserFederation("ldapUserFederation",
    bind_credential="admin",
    bind_dn="cn=admin,dc=example,dc=org",
    connection_url="ldap://openldap",
    rdn_ldap_attribute="cn",
    realm_id=realm.id,
    user_object_classes=[
        "simpleSecurityObject",
        "organizationalRole",
    ],
    username_ldap_attribute="cn",
    users_dn="dc=example,dc=org",
    uuid_ldap_attribute="entryDN")
ldap_user_attribute_mapper = keycloak.ldap.UserAttributeMapper("ldapUserAttributeMapper",
    ldap_attribute="bar",
    ldap_user_federation_id=ldap_user_federation.id,
    realm_id=realm.id,
    user_model_attribute="foo")
using Pulumi;
using Keycloak = Pulumi.Keycloak;

class MyStack : Stack
{
    public MyStack()
    {
        var realm = new Keycloak.Realm("realm", new Keycloak.RealmArgs
        {
            Enabled = true,
            Realm = "test",
        });
        var ldapUserFederation = new Keycloak.Ldap.UserFederation("ldapUserFederation", new Keycloak.Ldap.UserFederationArgs
        {
            BindCredential = "admin",
            BindDn = "cn=admin,dc=example,dc=org",
            ConnectionUrl = "ldap://openldap",
            RdnLdapAttribute = "cn",
            RealmId = realm.Id,
            UserObjectClasses = 
            {
                "simpleSecurityObject",
                "organizationalRole",
            },
            UsernameLdapAttribute = "cn",
            UsersDn = "dc=example,dc=org",
            UuidLdapAttribute = "entryDN",
        });
        var ldapUserAttributeMapper = new Keycloak.Ldap.UserAttributeMapper("ldapUserAttributeMapper", new Keycloak.Ldap.UserAttributeMapperArgs
        {
            LdapAttribute = "bar",
            LdapUserFederationId = ldapUserFederation.Id,
            RealmId = realm.Id,
            UserModelAttribute = "foo",
        });
    }

}

Argument Reference

The following arguments are supported:

  • realm_id - (Required) The realm that this LDAP mapper will exist in.
  • ldap_user_federation_id - (Required) The ID of the LDAP user federation provider to attach this mapper to.
  • name - (Required) Display name of this mapper when displayed in the console.
  • user_model_attribute - (Required) Name of the user property or attribute you want to map the LDAP attribute into.
  • ldap_attribute - (Required) Name of the mapped attribute on the LDAP object.
  • read_only - (Optional) When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak. Defaults to false.
  • always_read_value_from_ldap - (Optional) When true, the value fetched from LDAP will override the value stored in Keycloak. Defaults to false.
  • is_mandatory_in_ldap - (Optional) When true, this attribute must exist in LDAP. Defaults to false.

Create a UserAttributeMapper Resource

def UserAttributeMapper(resource_name, opts=None, always_read_value_from_ldap=None, is_mandatory_in_ldap=None, ldap_attribute=None, ldap_user_federation_id=None, name=None, read_only=None, realm_id=None, user_model_attribute=None, __props__=None);
name string
The unique name of the resource.
args UserAttributeMapperArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args UserAttributeMapperArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args UserAttributeMapperArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

UserAttributeMapper Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The UserAttributeMapper resource accepts the following input properties:

LdapAttribute string

Name of the mapped attribute on LDAP object.

LdapUserFederationId string

The ldap user federation provider to attach this mapper to.

RealmId string

The realm in which the ldap user federation provider exists.

UserModelAttribute string

Name of the UserModel property or attribute you want to map the LDAP attribute into.

AlwaysReadValueFromLdap bool

When true, the value fetched from LDAP will override the value stored in Keycloak.

IsMandatoryInLdap bool

When true, this attribute must exist in LDAP.

Name string

Display name of the mapper when displayed in the console.

ReadOnly bool

When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak.

LdapAttribute string

Name of the mapped attribute on LDAP object.

LdapUserFederationId string

The ldap user federation provider to attach this mapper to.

RealmId string

The realm in which the ldap user federation provider exists.

UserModelAttribute string

Name of the UserModel property or attribute you want to map the LDAP attribute into.

AlwaysReadValueFromLdap bool

When true, the value fetched from LDAP will override the value stored in Keycloak.

IsMandatoryInLdap bool

When true, this attribute must exist in LDAP.

Name string

Display name of the mapper when displayed in the console.

ReadOnly bool

When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak.

ldapAttribute string

Name of the mapped attribute on LDAP object.

ldapUserFederationId string

The ldap user federation provider to attach this mapper to.

realmId string

The realm in which the ldap user federation provider exists.

userModelAttribute string

Name of the UserModel property or attribute you want to map the LDAP attribute into.

alwaysReadValueFromLdap boolean

When true, the value fetched from LDAP will override the value stored in Keycloak.

isMandatoryInLdap boolean

When true, this attribute must exist in LDAP.

name string

Display name of the mapper when displayed in the console.

readOnly boolean

When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak.

ldap_attribute str

Name of the mapped attribute on LDAP object.

ldap_user_federation_id str

The ldap user federation provider to attach this mapper to.

realm_id str

The realm in which the ldap user federation provider exists.

user_model_attribute str

Name of the UserModel property or attribute you want to map the LDAP attribute into.

always_read_value_from_ldap bool

When true, the value fetched from LDAP will override the value stored in Keycloak.

is_mandatory_in_ldap bool

When true, this attribute must exist in LDAP.

name str

Display name of the mapper when displayed in the console.

read_only bool

When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak.

Outputs

All input properties are implicitly available as output properties. Additionally, the UserAttributeMapper resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing UserAttributeMapper Resource

Get an existing UserAttributeMapper resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

static get(resource_name, id, opts=None, always_read_value_from_ldap=None, is_mandatory_in_ldap=None, ldap_attribute=None, ldap_user_federation_id=None, name=None, read_only=None, realm_id=None, user_model_attribute=None, __props__=None);
func GetUserAttributeMapper(ctx *Context, name string, id IDInput, state *UserAttributeMapperState, opts ...ResourceOption) (*UserAttributeMapper, error)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

AlwaysReadValueFromLdap bool

When true, the value fetched from LDAP will override the value stored in Keycloak.

IsMandatoryInLdap bool

When true, this attribute must exist in LDAP.

LdapAttribute string

Name of the mapped attribute on LDAP object.

LdapUserFederationId string

The ldap user federation provider to attach this mapper to.

Name string

Display name of the mapper when displayed in the console.

ReadOnly bool

When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak.

RealmId string

The realm in which the ldap user federation provider exists.

UserModelAttribute string

Name of the UserModel property or attribute you want to map the LDAP attribute into.

AlwaysReadValueFromLdap bool

When true, the value fetched from LDAP will override the value stored in Keycloak.

IsMandatoryInLdap bool

When true, this attribute must exist in LDAP.

LdapAttribute string

Name of the mapped attribute on LDAP object.

LdapUserFederationId string

The ldap user federation provider to attach this mapper to.

Name string

Display name of the mapper when displayed in the console.

ReadOnly bool

When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak.

RealmId string

The realm in which the ldap user federation provider exists.

UserModelAttribute string

Name of the UserModel property or attribute you want to map the LDAP attribute into.

alwaysReadValueFromLdap boolean

When true, the value fetched from LDAP will override the value stored in Keycloak.

isMandatoryInLdap boolean

When true, this attribute must exist in LDAP.

ldapAttribute string

Name of the mapped attribute on LDAP object.

ldapUserFederationId string

The ldap user federation provider to attach this mapper to.

name string

Display name of the mapper when displayed in the console.

readOnly boolean

When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak.

realmId string

The realm in which the ldap user federation provider exists.

userModelAttribute string

Name of the UserModel property or attribute you want to map the LDAP attribute into.

always_read_value_from_ldap bool

When true, the value fetched from LDAP will override the value stored in Keycloak.

is_mandatory_in_ldap bool

When true, this attribute must exist in LDAP.

ldap_attribute str

Name of the mapped attribute on LDAP object.

ldap_user_federation_id str

The ldap user federation provider to attach this mapper to.

name str

Display name of the mapper when displayed in the console.

read_only bool

When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak.

realm_id str

The realm in which the ldap user federation provider exists.

user_model_attribute str

Name of the UserModel property or attribute you want to map the LDAP attribute into.

Package Details

Repository
https://github.com/pulumi/pulumi-keycloak
License
Apache-2.0
Notes
This Pulumi package is based on the keycloak Terraform Provider.