HardcodedRoleMapper

# keycloak.ldap.HardcodedRoleMapper

This mapper will grant a specified Keycloak role to each Keycloak user linked with LDAP.

Example Usage

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

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

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

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

}

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.
  • role - (Required) The role which should be assigned to the users.

Create a HardcodedRoleMapper Resource

def HardcodedRoleMapper(resource_name, opts=None, ldap_user_federation_id=None, name=None, realm_id=None, role=None, __props__=None);
name string
The unique name of the resource.
args HardcodedRoleMapperArgs
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 HardcodedRoleMapperArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args HardcodedRoleMapperArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

HardcodedRoleMapper Resource Properties

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

Inputs

The HardcodedRoleMapper resource accepts the following input properties:

LdapUserFederationId string

The ldap user federation provider to attach this mapper to.

RealmId string

The realm in which the ldap user federation provider exists.

Role string

Role to grant to user.

Name string

Display name of the mapper when displayed in the console.

LdapUserFederationId string

The ldap user federation provider to attach this mapper to.

RealmId string

The realm in which the ldap user federation provider exists.

Role string

Role to grant to user.

Name string

Display name of the mapper when displayed in the console.

ldapUserFederationId string

The ldap user federation provider to attach this mapper to.

realmId string

The realm in which the ldap user federation provider exists.

role string

Role to grant to user.

name string

Display name of the mapper when displayed in the console.

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.

role str

Role to grant to user.

name str

Display name of the mapper when displayed in the console.

Outputs

All input properties are implicitly available as output properties. Additionally, the HardcodedRoleMapper 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 HardcodedRoleMapper Resource

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

static get(resource_name, id, opts=None, ldap_user_federation_id=None, name=None, realm_id=None, role=None, __props__=None);
func GetHardcodedRoleMapper(ctx *Context, name string, id IDInput, state *HardcodedRoleMapperState, opts ...ResourceOption) (*HardcodedRoleMapper, 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:

LdapUserFederationId string

The ldap user federation provider to attach this mapper to.

Name string

Display name of the mapper when displayed in the console.

RealmId string

The realm in which the ldap user federation provider exists.

Role string

Role to grant to user.

LdapUserFederationId string

The ldap user federation provider to attach this mapper to.

Name string

Display name of the mapper when displayed in the console.

RealmId string

The realm in which the ldap user federation provider exists.

Role string

Role to grant to user.

ldapUserFederationId string

The ldap user federation provider to attach this mapper to.

name string

Display name of the mapper when displayed in the console.

realmId string

The realm in which the ldap user federation provider exists.

role string

Role to grant to user.

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.

realm_id str

The realm in which the ldap user federation provider exists.

role str

Role to grant to user.

Package Details

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