1. Packages
  2. Keycloak
  3. API Docs
  4. ldap
  5. FullNameMapper
Keycloak v5.3.1 published on Monday, Mar 11, 2024 by Pulumi

keycloak.ldap.FullNameMapper

Explore with Pulumi AI

keycloak logo
Keycloak v5.3.1 published on Monday, Mar 11, 2024 by Pulumi

    # keycloak.ldap.FullNameMapper

    Allows for creating and managing full name mappers for Keycloak users federated via LDAP.

    The LDAP full name mapper can map a user’s full name from an LDAP attribute to the first and last name attributes of a Keycloak user.

    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("ldapUserFederation", {
        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 ldapFullNameMapper = new keycloak.ldap.FullNameMapper("ldapFullNameMapper", {
        ldapFullNameAttribute: "cn",
        ldapUserFederationId: ldapUserFederation.id,
        realmId: realm.id,
    });
    
    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_full_name_mapper = keycloak.ldap.FullNameMapper("ldapFullNameMapper",
        ldap_full_name_attribute="cn",
        ldap_user_federation_id=ldap_user_federation.id,
        realm_id=realm.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak"
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak/ldap"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		realm, err := keycloak.NewRealm(ctx, "realm", &keycloak.RealmArgs{
    			Enabled: pulumi.Bool(true),
    			Realm:   pulumi.String("test"),
    		})
    		if err != nil {
    			return err
    		}
    		ldapUserFederation, err := ldap.NewUserFederation(ctx, "ldapUserFederation", &ldap.UserFederationArgs{
    			BindCredential:   pulumi.String("admin"),
    			BindDn:           pulumi.String("cn=admin,dc=example,dc=org"),
    			ConnectionUrl:    pulumi.String("ldap://openldap"),
    			RdnLdapAttribute: pulumi.String("cn"),
    			RealmId:          realm.ID(),
    			UserObjectClasses: pulumi.StringArray{
    				pulumi.String("simpleSecurityObject"),
    				pulumi.String("organizationalRole"),
    			},
    			UsernameLdapAttribute: pulumi.String("cn"),
    			UsersDn:               pulumi.String("dc=example,dc=org"),
    			UuidLdapAttribute:     pulumi.String("entryDN"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ldap.NewFullNameMapper(ctx, "ldapFullNameMapper", &ldap.FullNameMapperArgs{
    			LdapFullNameAttribute: pulumi.String("cn"),
    			LdapUserFederationId:  ldapUserFederation.ID(),
    			RealmId:               realm.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Keycloak = Pulumi.Keycloak;
    
    return await Deployment.RunAsync(() => 
    {
        var realm = new Keycloak.Realm("realm", new()
        {
            Enabled = true,
            RealmName = "test",
        });
    
        var ldapUserFederation = new Keycloak.Ldap.UserFederation("ldapUserFederation", new()
        {
            BindCredential = "admin",
            BindDn = "cn=admin,dc=example,dc=org",
            ConnectionUrl = "ldap://openldap",
            RdnLdapAttribute = "cn",
            RealmId = realm.Id,
            UserObjectClasses = new[]
            {
                "simpleSecurityObject",
                "organizationalRole",
            },
            UsernameLdapAttribute = "cn",
            UsersDn = "dc=example,dc=org",
            UuidLdapAttribute = "entryDN",
        });
    
        var ldapFullNameMapper = new Keycloak.Ldap.FullNameMapper("ldapFullNameMapper", new()
        {
            LdapFullNameAttribute = "cn",
            LdapUserFederationId = ldapUserFederation.Id,
            RealmId = realm.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.keycloak.Realm;
    import com.pulumi.keycloak.RealmArgs;
    import com.pulumi.keycloak.ldap.UserFederation;
    import com.pulumi.keycloak.ldap.UserFederationArgs;
    import com.pulumi.keycloak.ldap.FullNameMapper;
    import com.pulumi.keycloak.ldap.FullNameMapperArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var realm = new Realm("realm", RealmArgs.builder()        
                .enabled(true)
                .realm("test")
                .build());
    
            var ldapUserFederation = new UserFederation("ldapUserFederation", UserFederationArgs.builder()        
                .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")
                .build());
    
            var ldapFullNameMapper = new FullNameMapper("ldapFullNameMapper", FullNameMapperArgs.builder()        
                .ldapFullNameAttribute("cn")
                .ldapUserFederationId(ldapUserFederation.id())
                .realmId(realm.id())
                .build());
    
        }
    }
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          enabled: true
          realm: test
      ldapUserFederation:
        type: keycloak:ldap:UserFederation
        properties:
          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
      ldapFullNameMapper:
        type: keycloak:ldap:FullNameMapper
        properties:
          ldapFullNameAttribute: cn
          ldapUserFederationId: ${ldapUserFederation.id}
          realmId: ${realm.id}
    

    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.
    • ldap_full_name_attribute - (Required) The name of the LDAP attribute containing the user’s full name.
    • read_only - (Optional) When true, updates to a user within Keycloak will not be written back to LDAP. Defaults to false.
    • write_only - (Optional) When true, this mapper will only be used to write updates to LDAP. Defaults to false.

    Import

    LDAP mappers can be imported using the format {{realm_id}}/{{ldap_user_federation_id}}/{{ldap_mapper_id}}. The ID of the LDAP user federation provider and the mapper can be found within the Keycloak GUI, and they are typically GUIDs:

    $ terraform import keycloak_ldap_full_name_mapper.ldap_full_name_mapper my-realm/af2a6ca3-e4d7-49c3-b08b-1b3c70b4b860/3d923ece-1a91-4bf7-adaf-3b82f2a12b67
    

    Create FullNameMapper Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new FullNameMapper(name: string, args: FullNameMapperArgs, opts?: CustomResourceOptions);
    @overload
    def FullNameMapper(resource_name: str,
                       args: FullNameMapperArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def FullNameMapper(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       ldap_full_name_attribute: Optional[str] = None,
                       ldap_user_federation_id: Optional[str] = None,
                       realm_id: Optional[str] = None,
                       name: Optional[str] = None,
                       read_only: Optional[bool] = None,
                       write_only: Optional[bool] = None)
    func NewFullNameMapper(ctx *Context, name string, args FullNameMapperArgs, opts ...ResourceOption) (*FullNameMapper, error)
    public FullNameMapper(string name, FullNameMapperArgs args, CustomResourceOptions? opts = null)
    public FullNameMapper(String name, FullNameMapperArgs args)
    public FullNameMapper(String name, FullNameMapperArgs args, CustomResourceOptions options)
    
    type: keycloak:ldap:FullNameMapper
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args FullNameMapperArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args FullNameMapperArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args FullNameMapperArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FullNameMapperArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FullNameMapperArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var fullNameMapperResource = new Keycloak.Ldap.FullNameMapper("fullNameMapperResource", new()
    {
        LdapFullNameAttribute = "string",
        LdapUserFederationId = "string",
        RealmId = "string",
        Name = "string",
        ReadOnly = false,
        WriteOnly = false,
    });
    
    example, err := ldap.NewFullNameMapper(ctx, "fullNameMapperResource", &ldap.FullNameMapperArgs{
    	LdapFullNameAttribute: pulumi.String("string"),
    	LdapUserFederationId:  pulumi.String("string"),
    	RealmId:               pulumi.String("string"),
    	Name:                  pulumi.String("string"),
    	ReadOnly:              pulumi.Bool(false),
    	WriteOnly:             pulumi.Bool(false),
    })
    
    var fullNameMapperResource = new FullNameMapper("fullNameMapperResource", FullNameMapperArgs.builder()        
        .ldapFullNameAttribute("string")
        .ldapUserFederationId("string")
        .realmId("string")
        .name("string")
        .readOnly(false)
        .writeOnly(false)
        .build());
    
    full_name_mapper_resource = keycloak.ldap.FullNameMapper("fullNameMapperResource",
        ldap_full_name_attribute="string",
        ldap_user_federation_id="string",
        realm_id="string",
        name="string",
        read_only=False,
        write_only=False)
    
    const fullNameMapperResource = new keycloak.ldap.FullNameMapper("fullNameMapperResource", {
        ldapFullNameAttribute: "string",
        ldapUserFederationId: "string",
        realmId: "string",
        name: "string",
        readOnly: false,
        writeOnly: false,
    });
    
    type: keycloak:ldap:FullNameMapper
    properties:
        ldapFullNameAttribute: string
        ldapUserFederationId: string
        name: string
        readOnly: false
        realmId: string
        writeOnly: false
    

    FullNameMapper Resource Properties

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

    Inputs

    The FullNameMapper resource accepts the following input properties:

    LdapFullNameAttribute string
    LdapUserFederationId string
    The ldap user federation provider to attach this mapper to.
    RealmId string
    The realm in which the ldap user federation provider exists.
    Name string
    Display name of the mapper when displayed in the console.
    ReadOnly bool
    WriteOnly bool
    LdapFullNameAttribute string
    LdapUserFederationId string
    The ldap user federation provider to attach this mapper to.
    RealmId string
    The realm in which the ldap user federation provider exists.
    Name string
    Display name of the mapper when displayed in the console.
    ReadOnly bool
    WriteOnly bool
    ldapFullNameAttribute String
    ldapUserFederationId String
    The ldap user federation provider to attach this mapper to.
    realmId String
    The realm in which the ldap user federation provider exists.
    name String
    Display name of the mapper when displayed in the console.
    readOnly Boolean
    writeOnly Boolean
    ldapFullNameAttribute string
    ldapUserFederationId string
    The ldap user federation provider to attach this mapper to.
    realmId string
    The realm in which the ldap user federation provider exists.
    name string
    Display name of the mapper when displayed in the console.
    readOnly boolean
    writeOnly boolean
    ldap_full_name_attribute str
    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.
    name str
    Display name of the mapper when displayed in the console.
    read_only bool
    write_only bool
    ldapFullNameAttribute String
    ldapUserFederationId String
    The ldap user federation provider to attach this mapper to.
    realmId String
    The realm in which the ldap user federation provider exists.
    name String
    Display name of the mapper when displayed in the console.
    readOnly Boolean
    writeOnly Boolean

    Outputs

    All input properties are implicitly available as output properties. Additionally, the FullNameMapper 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 string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing FullNameMapper Resource

    Get an existing FullNameMapper 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?: FullNameMapperState, opts?: CustomResourceOptions): FullNameMapper
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            ldap_full_name_attribute: Optional[str] = None,
            ldap_user_federation_id: Optional[str] = None,
            name: Optional[str] = None,
            read_only: Optional[bool] = None,
            realm_id: Optional[str] = None,
            write_only: Optional[bool] = None) -> FullNameMapper
    func GetFullNameMapper(ctx *Context, name string, id IDInput, state *FullNameMapperState, opts ...ResourceOption) (*FullNameMapper, error)
    public static FullNameMapper Get(string name, Input<string> id, FullNameMapperState? state, CustomResourceOptions? opts = null)
    public static FullNameMapper get(String name, Output<String> id, FullNameMapperState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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:
    LdapFullNameAttribute string
    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
    RealmId string
    The realm in which the ldap user federation provider exists.
    WriteOnly bool
    LdapFullNameAttribute string
    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
    RealmId string
    The realm in which the ldap user federation provider exists.
    WriteOnly bool
    ldapFullNameAttribute String
    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
    realmId String
    The realm in which the ldap user federation provider exists.
    writeOnly Boolean
    ldapFullNameAttribute string
    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
    realmId string
    The realm in which the ldap user federation provider exists.
    writeOnly boolean
    ldap_full_name_attribute str
    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
    realm_id str
    The realm in which the ldap user federation provider exists.
    write_only bool
    ldapFullNameAttribute String
    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
    realmId String
    The realm in which the ldap user federation provider exists.
    writeOnly Boolean

    Package Details

    Repository
    Keycloak pulumi/pulumi-keycloak
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the keycloak Terraform Provider.
    keycloak logo
    Keycloak v5.3.1 published on Monday, Mar 11, 2024 by Pulumi