keycloak.HardcodedAttributeIdentityProviderMapper
Explore with Pulumi AI
Allows for creating and managing hardcoded attribute mappers for Keycloak identity provider.
The identity provider hardcoded attribute mapper will set the specified value to the IDP attribute.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as keycloak from "@pulumi/keycloak";
const realm = new keycloak.Realm("realm", {
realm: "my-realm",
enabled: true,
});
const oidc = new keycloak.oidc.IdentityProvider("oidc", {
realm: realm.id,
alias: "my-idp",
authorizationUrl: "https://authorizationurl.com",
clientId: "clientID",
clientSecret: "clientSecret",
tokenUrl: "https://tokenurl.com",
});
const oidcHardcodedAttributeIdentityProviderMapper = new keycloak.HardcodedAttributeIdentityProviderMapper("oidc", {
realm: realm.id,
name: "hardcodedUserSessionAttribute",
identityProviderAlias: oidc.alias,
attributeName: "attribute",
attributeValue: "value",
userSession: true,
extraConfig: {
syncMode: "INHERIT",
},
});
import pulumi
import pulumi_keycloak as keycloak
realm = keycloak.Realm("realm",
realm="my-realm",
enabled=True)
oidc = keycloak.oidc.IdentityProvider("oidc",
realm=realm.id,
alias="my-idp",
authorization_url="https://authorizationurl.com",
client_id="clientID",
client_secret="clientSecret",
token_url="https://tokenurl.com")
oidc_hardcoded_attribute_identity_provider_mapper = keycloak.HardcodedAttributeIdentityProviderMapper("oidc",
realm=realm.id,
name="hardcodedUserSessionAttribute",
identity_provider_alias=oidc.alias,
attribute_name="attribute",
attribute_value="value",
user_session=True,
extra_config={
"syncMode": "INHERIT",
})
package main
import (
"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak"
"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak/oidc"
"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{
Realm: pulumi.String("my-realm"),
Enabled: pulumi.Bool(true),
})
if err != nil {
return err
}
oidc, err := oidc.NewIdentityProvider(ctx, "oidc", &oidc.IdentityProviderArgs{
Realm: realm.ID(),
Alias: pulumi.String("my-idp"),
AuthorizationUrl: pulumi.String("https://authorizationurl.com"),
ClientId: pulumi.String("clientID"),
ClientSecret: pulumi.String("clientSecret"),
TokenUrl: pulumi.String("https://tokenurl.com"),
})
if err != nil {
return err
}
_, err = keycloak.NewHardcodedAttributeIdentityProviderMapper(ctx, "oidc", &keycloak.HardcodedAttributeIdentityProviderMapperArgs{
Realm: realm.ID(),
Name: pulumi.String("hardcodedUserSessionAttribute"),
IdentityProviderAlias: oidc.Alias,
AttributeName: pulumi.String("attribute"),
AttributeValue: pulumi.String("value"),
UserSession: pulumi.Bool(true),
ExtraConfig: pulumi.StringMap{
"syncMode": pulumi.String("INHERIT"),
},
})
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()
{
RealmName = "my-realm",
Enabled = true,
});
var oidc = new Keycloak.Oidc.IdentityProvider("oidc", new()
{
Realm = realm.Id,
Alias = "my-idp",
AuthorizationUrl = "https://authorizationurl.com",
ClientId = "clientID",
ClientSecret = "clientSecret",
TokenUrl = "https://tokenurl.com",
});
var oidcHardcodedAttributeIdentityProviderMapper = new Keycloak.HardcodedAttributeIdentityProviderMapper("oidc", new()
{
Realm = realm.Id,
Name = "hardcodedUserSessionAttribute",
IdentityProviderAlias = oidc.Alias,
AttributeName = "attribute",
AttributeValue = "value",
UserSession = true,
ExtraConfig =
{
{ "syncMode", "INHERIT" },
},
});
});
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.oidc.IdentityProvider;
import com.pulumi.keycloak.oidc.IdentityProviderArgs;
import com.pulumi.keycloak.HardcodedAttributeIdentityProviderMapper;
import com.pulumi.keycloak.HardcodedAttributeIdentityProviderMapperArgs;
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()
.realm("my-realm")
.enabled(true)
.build());
var oidc = new IdentityProvider("oidc", IdentityProviderArgs.builder()
.realm(realm.id())
.alias("my-idp")
.authorizationUrl("https://authorizationurl.com")
.clientId("clientID")
.clientSecret("clientSecret")
.tokenUrl("https://tokenurl.com")
.build());
var oidcHardcodedAttributeIdentityProviderMapper = new HardcodedAttributeIdentityProviderMapper("oidcHardcodedAttributeIdentityProviderMapper", HardcodedAttributeIdentityProviderMapperArgs.builder()
.realm(realm.id())
.name("hardcodedUserSessionAttribute")
.identityProviderAlias(oidc.alias())
.attributeName("attribute")
.attributeValue("value")
.userSession(true)
.extraConfig(Map.of("syncMode", "INHERIT"))
.build());
}
}
resources:
realm:
type: keycloak:Realm
properties:
realm: my-realm
enabled: true
oidc:
type: keycloak:oidc:IdentityProvider
properties:
realm: ${realm.id}
alias: my-idp
authorizationUrl: https://authorizationurl.com
clientId: clientID
clientSecret: clientSecret
tokenUrl: https://tokenurl.com
oidcHardcodedAttributeIdentityProviderMapper:
type: keycloak:HardcodedAttributeIdentityProviderMapper
name: oidc
properties:
realm: ${realm.id}
name: hardcodedUserSessionAttribute
identityProviderAlias: ${oidc.alias}
attributeName: attribute
attributeValue: value
userSession: true
extraConfig:
syncMode: INHERIT
Create HardcodedAttributeIdentityProviderMapper Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new HardcodedAttributeIdentityProviderMapper(name: string, args: HardcodedAttributeIdentityProviderMapperArgs, opts?: CustomResourceOptions);
@overload
def HardcodedAttributeIdentityProviderMapper(resource_name: str,
args: HardcodedAttributeIdentityProviderMapperArgs,
opts: Optional[ResourceOptions] = None)
@overload
def HardcodedAttributeIdentityProviderMapper(resource_name: str,
opts: Optional[ResourceOptions] = None,
identity_provider_alias: Optional[str] = None,
realm: Optional[str] = None,
user_session: Optional[bool] = None,
attribute_name: Optional[str] = None,
attribute_value: Optional[str] = None,
extra_config: Optional[Mapping[str, str]] = None,
name: Optional[str] = None)
func NewHardcodedAttributeIdentityProviderMapper(ctx *Context, name string, args HardcodedAttributeIdentityProviderMapperArgs, opts ...ResourceOption) (*HardcodedAttributeIdentityProviderMapper, error)
public HardcodedAttributeIdentityProviderMapper(string name, HardcodedAttributeIdentityProviderMapperArgs args, CustomResourceOptions? opts = null)
public HardcodedAttributeIdentityProviderMapper(String name, HardcodedAttributeIdentityProviderMapperArgs args)
public HardcodedAttributeIdentityProviderMapper(String name, HardcodedAttributeIdentityProviderMapperArgs args, CustomResourceOptions options)
type: keycloak:HardcodedAttributeIdentityProviderMapper
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 HardcodedAttributeIdentityProviderMapperArgs
- 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 HardcodedAttributeIdentityProviderMapperArgs
- 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 HardcodedAttributeIdentityProviderMapperArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HardcodedAttributeIdentityProviderMapperArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args HardcodedAttributeIdentityProviderMapperArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var hardcodedAttributeIdentityProviderMapperResource = new Keycloak.HardcodedAttributeIdentityProviderMapper("hardcodedAttributeIdentityProviderMapperResource", new()
{
IdentityProviderAlias = "string",
Realm = "string",
UserSession = false,
AttributeName = "string",
AttributeValue = "string",
ExtraConfig =
{
{ "string", "string" },
},
Name = "string",
});
example, err := keycloak.NewHardcodedAttributeIdentityProviderMapper(ctx, "hardcodedAttributeIdentityProviderMapperResource", &keycloak.HardcodedAttributeIdentityProviderMapperArgs{
IdentityProviderAlias: pulumi.String("string"),
Realm: pulumi.String("string"),
UserSession: pulumi.Bool(false),
AttributeName: pulumi.String("string"),
AttributeValue: pulumi.String("string"),
ExtraConfig: pulumi.StringMap{
"string": pulumi.String("string"),
},
Name: pulumi.String("string"),
})
var hardcodedAttributeIdentityProviderMapperResource = new HardcodedAttributeIdentityProviderMapper("hardcodedAttributeIdentityProviderMapperResource", HardcodedAttributeIdentityProviderMapperArgs.builder()
.identityProviderAlias("string")
.realm("string")
.userSession(false)
.attributeName("string")
.attributeValue("string")
.extraConfig(Map.of("string", "string"))
.name("string")
.build());
hardcoded_attribute_identity_provider_mapper_resource = keycloak.HardcodedAttributeIdentityProviderMapper("hardcodedAttributeIdentityProviderMapperResource",
identity_provider_alias="string",
realm="string",
user_session=False,
attribute_name="string",
attribute_value="string",
extra_config={
"string": "string",
},
name="string")
const hardcodedAttributeIdentityProviderMapperResource = new keycloak.HardcodedAttributeIdentityProviderMapper("hardcodedAttributeIdentityProviderMapperResource", {
identityProviderAlias: "string",
realm: "string",
userSession: false,
attributeName: "string",
attributeValue: "string",
extraConfig: {
string: "string",
},
name: "string",
});
type: keycloak:HardcodedAttributeIdentityProviderMapper
properties:
attributeName: string
attributeValue: string
extraConfig:
string: string
identityProviderAlias: string
name: string
realm: string
userSession: false
HardcodedAttributeIdentityProviderMapper 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 HardcodedAttributeIdentityProviderMapper resource accepts the following input properties:
- Identity
Provider stringAlias - The IDP alias of the attribute to set.
- Realm string
- The realm ID that this mapper will exist in.
- User
Session bool - Is Attribute related to a User Session.
- Attribute
Name string - The name of the IDP attribute to set.
- Attribute
Value string - The value to set to the attribute. You can hardcode any value like 'foo'.
- Extra
Config Dictionary<string, string> - Name string
- Display name of this mapper when displayed in the console.
- Identity
Provider stringAlias - The IDP alias of the attribute to set.
- Realm string
- The realm ID that this mapper will exist in.
- User
Session bool - Is Attribute related to a User Session.
- Attribute
Name string - The name of the IDP attribute to set.
- Attribute
Value string - The value to set to the attribute. You can hardcode any value like 'foo'.
- Extra
Config map[string]string - Name string
- Display name of this mapper when displayed in the console.
- identity
Provider StringAlias - The IDP alias of the attribute to set.
- realm String
- The realm ID that this mapper will exist in.
- user
Session Boolean - Is Attribute related to a User Session.
- attribute
Name String - The name of the IDP attribute to set.
- attribute
Value String - The value to set to the attribute. You can hardcode any value like 'foo'.
- extra
Config Map<String,String> - name String
- Display name of this mapper when displayed in the console.
- identity
Provider stringAlias - The IDP alias of the attribute to set.
- realm string
- The realm ID that this mapper will exist in.
- user
Session boolean - Is Attribute related to a User Session.
- attribute
Name string - The name of the IDP attribute to set.
- attribute
Value string - The value to set to the attribute. You can hardcode any value like 'foo'.
- extra
Config {[key: string]: string} - name string
- Display name of this mapper when displayed in the console.
- identity_
provider_ stralias - The IDP alias of the attribute to set.
- realm str
- The realm ID that this mapper will exist in.
- user_
session bool - Is Attribute related to a User Session.
- attribute_
name str - The name of the IDP attribute to set.
- attribute_
value str - The value to set to the attribute. You can hardcode any value like 'foo'.
- extra_
config Mapping[str, str] - name str
- Display name of this mapper when displayed in the console.
- identity
Provider StringAlias - The IDP alias of the attribute to set.
- realm String
- The realm ID that this mapper will exist in.
- user
Session Boolean - Is Attribute related to a User Session.
- attribute
Name String - The name of the IDP attribute to set.
- attribute
Value String - The value to set to the attribute. You can hardcode any value like 'foo'.
- extra
Config Map<String> - name String
- Display name of this mapper when displayed in the console.
Outputs
All input properties are implicitly available as output properties. Additionally, the HardcodedAttributeIdentityProviderMapper 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 HardcodedAttributeIdentityProviderMapper Resource
Get an existing HardcodedAttributeIdentityProviderMapper 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?: HardcodedAttributeIdentityProviderMapperState, opts?: CustomResourceOptions): HardcodedAttributeIdentityProviderMapper
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
attribute_name: Optional[str] = None,
attribute_value: Optional[str] = None,
extra_config: Optional[Mapping[str, str]] = None,
identity_provider_alias: Optional[str] = None,
name: Optional[str] = None,
realm: Optional[str] = None,
user_session: Optional[bool] = None) -> HardcodedAttributeIdentityProviderMapper
func GetHardcodedAttributeIdentityProviderMapper(ctx *Context, name string, id IDInput, state *HardcodedAttributeIdentityProviderMapperState, opts ...ResourceOption) (*HardcodedAttributeIdentityProviderMapper, error)
public static HardcodedAttributeIdentityProviderMapper Get(string name, Input<string> id, HardcodedAttributeIdentityProviderMapperState? state, CustomResourceOptions? opts = null)
public static HardcodedAttributeIdentityProviderMapper get(String name, Output<String> id, HardcodedAttributeIdentityProviderMapperState 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.
- Attribute
Name string - The name of the IDP attribute to set.
- Attribute
Value string - The value to set to the attribute. You can hardcode any value like 'foo'.
- Extra
Config Dictionary<string, string> - Identity
Provider stringAlias - The IDP alias of the attribute to set.
- Name string
- Display name of this mapper when displayed in the console.
- Realm string
- The realm ID that this mapper will exist in.
- User
Session bool - Is Attribute related to a User Session.
- Attribute
Name string - The name of the IDP attribute to set.
- Attribute
Value string - The value to set to the attribute. You can hardcode any value like 'foo'.
- Extra
Config map[string]string - Identity
Provider stringAlias - The IDP alias of the attribute to set.
- Name string
- Display name of this mapper when displayed in the console.
- Realm string
- The realm ID that this mapper will exist in.
- User
Session bool - Is Attribute related to a User Session.
- attribute
Name String - The name of the IDP attribute to set.
- attribute
Value String - The value to set to the attribute. You can hardcode any value like 'foo'.
- extra
Config Map<String,String> - identity
Provider StringAlias - The IDP alias of the attribute to set.
- name String
- Display name of this mapper when displayed in the console.
- realm String
- The realm ID that this mapper will exist in.
- user
Session Boolean - Is Attribute related to a User Session.
- attribute
Name string - The name of the IDP attribute to set.
- attribute
Value string - The value to set to the attribute. You can hardcode any value like 'foo'.
- extra
Config {[key: string]: string} - identity
Provider stringAlias - The IDP alias of the attribute to set.
- name string
- Display name of this mapper when displayed in the console.
- realm string
- The realm ID that this mapper will exist in.
- user
Session boolean - Is Attribute related to a User Session.
- attribute_
name str - The name of the IDP attribute to set.
- attribute_
value str - The value to set to the attribute. You can hardcode any value like 'foo'.
- extra_
config Mapping[str, str] - identity_
provider_ stralias - The IDP alias of the attribute to set.
- name str
- Display name of this mapper when displayed in the console.
- realm str
- The realm ID that this mapper will exist in.
- user_
session bool - Is Attribute related to a User Session.
- attribute
Name String - The name of the IDP attribute to set.
- attribute
Value String - The value to set to the attribute. You can hardcode any value like 'foo'.
- extra
Config Map<String> - identity
Provider StringAlias - The IDP alias of the attribute to set.
- name String
- Display name of this mapper when displayed in the console.
- realm String
- The realm ID that this mapper will exist in.
- user
Session Boolean - Is Attribute related to a User Session.
Package Details
- Repository
- Keycloak pulumi/pulumi-keycloak
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
keycloak
Terraform Provider.