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) Whentrue, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak. Defaults tofalse.always_read_value_from_ldap- (Optional) Whentrue, the value fetched from LDAP will override the value stored in Keycloak. Defaults tofalse.is_mandatory_in_ldap- (Optional) Whentrue, this attribute must exist in LDAP. Defaults tofalse.
Create a UserAttributeMapper Resource
new UserAttributeMapper(name: string, args: UserAttributeMapperArgs, opts?: CustomResourceOptions);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);func NewUserAttributeMapper(ctx *Context, name string, args UserAttributeMapperArgs, opts ...ResourceOption) (*UserAttributeMapper, error)public UserAttributeMapper(string name, UserAttributeMapperArgs args, CustomResourceOptions? opts = null)- 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:
- Ldap
Attribute string Name of the mapped attribute on LDAP object.
- Ldap
User stringFederation Id The ldap user federation provider to attach this mapper to.
- Realm
Id string The realm in which the ldap user federation provider exists.
- User
Model stringAttribute Name of the UserModel property or attribute you want to map the LDAP attribute into.
- Always
Read boolValue From Ldap When true, the value fetched from LDAP will override the value stored in Keycloak.
- Is
Mandatory boolIn Ldap When true, this attribute must exist in LDAP.
- Name string
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.
- Ldap
Attribute string Name of the mapped attribute on LDAP object.
- Ldap
User stringFederation Id The ldap user federation provider to attach this mapper to.
- Realm
Id string The realm in which the ldap user federation provider exists.
- User
Model stringAttribute Name of the UserModel property or attribute you want to map the LDAP attribute into.
- Always
Read boolValue From Ldap When true, the value fetched from LDAP will override the value stored in Keycloak.
- Is
Mandatory boolIn Ldap When true, this attribute must exist in LDAP.
- Name string
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.
- ldap
Attribute string Name of the mapped attribute on LDAP object.
- ldap
User stringFederation Id The ldap user federation provider to attach this mapper to.
- realm
Id string The realm in which the ldap user federation provider exists.
- user
Model stringAttribute Name of the UserModel property or attribute you want to map the LDAP attribute into.
- always
Read booleanValue From Ldap When true, the value fetched from LDAP will override the value stored in Keycloak.
- is
Mandatory booleanIn Ldap When true, this attribute must exist in LDAP.
- name string
Display name of the mapper when displayed in the console.
- read
Only 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_ strfederation_ id 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_ strattribute Name of the UserModel property or attribute you want to map the LDAP attribute into.
- always_
read_ boolvalue_ from_ ldap When true, the value fetched from LDAP will override the value stored in Keycloak.
- is_
mandatory_ boolin_ ldap 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:
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.
public static get(name: string, id: Input<ID>, state?: UserAttributeMapperState, opts?: CustomResourceOptions): UserAttributeMapperstatic 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)public static UserAttributeMapper Get(string name, Input<string> id, UserAttributeMapperState? state, CustomResourceOptions? opts = null)- 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:
- Always
Read boolValue From Ldap When true, the value fetched from LDAP will override the value stored in Keycloak.
- Is
Mandatory boolIn Ldap When true, this attribute must exist in LDAP.
- Ldap
Attribute string Name of the mapped attribute on LDAP object.
- Ldap
User stringFederation Id The ldap user federation provider to attach this mapper to.
- Name string
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 string The realm in which the ldap user federation provider exists.
- User
Model stringAttribute Name of the UserModel property or attribute you want to map the LDAP attribute into.
- Always
Read boolValue From Ldap When true, the value fetched from LDAP will override the value stored in Keycloak.
- Is
Mandatory boolIn Ldap When true, this attribute must exist in LDAP.
- Ldap
Attribute string Name of the mapped attribute on LDAP object.
- Ldap
User stringFederation Id The ldap user federation provider to attach this mapper to.
- Name string
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 string The realm in which the ldap user federation provider exists.
- User
Model stringAttribute Name of the UserModel property or attribute you want to map the LDAP attribute into.
- always
Read booleanValue From Ldap When true, the value fetched from LDAP will override the value stored in Keycloak.
- is
Mandatory booleanIn Ldap When true, this attribute must exist in LDAP.
- ldap
Attribute string Name of the mapped attribute on LDAP object.
- ldap
User stringFederation Id The ldap user federation provider to attach this mapper to.
- name string
Display name of the mapper when displayed in the console.
- read
Only boolean When true, this attribute is not saved back to LDAP when the user attribute is updated in Keycloak.
- realm
Id string The realm in which the ldap user federation provider exists.
- user
Model stringAttribute Name of the UserModel property or attribute you want to map the LDAP attribute into.
- always_
read_ boolvalue_ from_ ldap When true, the value fetched from LDAP will override the value stored in Keycloak.
- is_
mandatory_ boolin_ ldap When true, this attribute must exist in LDAP.
- ldap_
attribute str Name of the mapped attribute on LDAP object.
- ldap_
user_ strfederation_ id 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_ strattribute 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
keycloakTerraform Provider.