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
new HardcodedRoleMapper(name: string, args: HardcodedRoleMapperArgs, opts?: CustomResourceOptions);def HardcodedRoleMapper(resource_name, opts=None, ldap_user_federation_id=None, name=None, realm_id=None, role=None, __props__=None);func NewHardcodedRoleMapper(ctx *Context, name string, args HardcodedRoleMapperArgs, opts ...ResourceOption) (*HardcodedRoleMapper, error)public HardcodedRoleMapper(string name, HardcodedRoleMapperArgs args, CustomResourceOptions? opts = null)- 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:
Outputs
All input properties are implicitly available as output properties. Additionally, the HardcodedRoleMapper resource produces the following output properties:
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.
public static get(name: string, id: Input<ID>, state?: HardcodedRoleMapperState, opts?: CustomResourceOptions): HardcodedRoleMapperstatic 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)public static HardcodedRoleMapper Get(string name, Input<string> id, HardcodedRoleMapperState? 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:
Package Details
- Repository
- https://github.com/pulumi/pulumi-keycloak
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
keycloakTerraform Provider.