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

keycloak.HardcodedAttributeIdentityProviderMapper

Explore with Pulumi AI

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

    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 oidcIdentityProvider = new keycloak.oidc.IdentityProvider("oidcIdentityProvider", {
        realm: realm.id,
        alias: "my-idp",
        authorizationUrl: "https://authorizationurl.com",
        clientId: "clientID",
        clientSecret: "clientSecret",
        tokenUrl: "https://tokenurl.com",
    });
    const oidcHardcodedAttributeIdentityProviderMapper = new keycloak.HardcodedAttributeIdentityProviderMapper("oidcHardcodedAttributeIdentityProviderMapper", {
        realm: realm.id,
        identityProviderAlias: oidcIdentityProvider.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_identity_provider = keycloak.oidc.IdentityProvider("oidcIdentityProvider",
        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("oidcHardcodedAttributeIdentityProviderMapper",
        realm=realm.id,
        identity_provider_alias=oidc_identity_provider.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
    		}
    		oidcIdentityProvider, err := oidc.NewIdentityProvider(ctx, "oidcIdentityProvider", &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, "oidcHardcodedAttributeIdentityProviderMapper", &keycloak.HardcodedAttributeIdentityProviderMapperArgs{
    			Realm:                 realm.ID(),
    			IdentityProviderAlias: oidcIdentityProvider.Alias,
    			AttributeName:         pulumi.String("attribute"),
    			AttributeValue:        pulumi.String("value"),
    			UserSession:           pulumi.Bool(true),
    			ExtraConfig: pulumi.Map{
    				"syncMode": pulumi.Any("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 oidcIdentityProvider = new Keycloak.Oidc.IdentityProvider("oidcIdentityProvider", new()
        {
            Realm = realm.Id,
            Alias = "my-idp",
            AuthorizationUrl = "https://authorizationurl.com",
            ClientId = "clientID",
            ClientSecret = "clientSecret",
            TokenUrl = "https://tokenurl.com",
        });
    
        var oidcHardcodedAttributeIdentityProviderMapper = new Keycloak.HardcodedAttributeIdentityProviderMapper("oidcHardcodedAttributeIdentityProviderMapper", new()
        {
            Realm = realm.Id,
            IdentityProviderAlias = oidcIdentityProvider.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 oidcIdentityProvider = new IdentityProvider("oidcIdentityProvider", 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())
                .identityProviderAlias(oidcIdentityProvider.alias())
                .attributeName("attribute")
                .attributeValue("value")
                .userSession(true)
                .extraConfig(Map.of("syncMode", "INHERIT"))
                .build());
    
        }
    }
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          realm: my-realm
          enabled: true
      oidcIdentityProvider:
        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
        properties:
          realm: ${realm.id}
          identityProviderAlias: ${oidcIdentityProvider.alias}
          attributeName: attribute
          attributeValue: value
          userSession: true
          extraConfig:
            syncMode: INHERIT
    

    Create HardcodedAttributeIdentityProviderMapper Resource

    new HardcodedAttributeIdentityProviderMapper(name: string, args: HardcodedAttributeIdentityProviderMapperArgs, opts?: CustomResourceOptions);
    @overload
    def HardcodedAttributeIdentityProviderMapper(resource_name: str,
                                                 opts: Optional[ResourceOptions] = None,
                                                 attribute_name: Optional[str] = None,
                                                 attribute_value: Optional[str] = None,
                                                 extra_config: Optional[Mapping[str, Any]] = None,
                                                 identity_provider_alias: Optional[str] = None,
                                                 name: Optional[str] = None,
                                                 realm: Optional[str] = None,
                                                 user_session: Optional[bool] = None)
    @overload
    def HardcodedAttributeIdentityProviderMapper(resource_name: str,
                                                 args: HardcodedAttributeIdentityProviderMapperArgs,
                                                 opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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:

    IdentityProviderAlias string
    The IDP alias of the attribute to set.
    Realm string
    The realm ID that this mapper will exist in.
    UserSession bool
    Is Attribute related to a User Session.
    AttributeName string
    The name of the IDP attribute to set.
    AttributeValue string
    The value to set to the attribute. You can hardcode any value like 'foo'.
    ExtraConfig Dictionary<string, object>
    Name string
    Display name of this mapper when displayed in the console.
    IdentityProviderAlias string
    The IDP alias of the attribute to set.
    Realm string
    The realm ID that this mapper will exist in.
    UserSession bool
    Is Attribute related to a User Session.
    AttributeName string
    The name of the IDP attribute to set.
    AttributeValue string
    The value to set to the attribute. You can hardcode any value like 'foo'.
    ExtraConfig map[string]interface{}
    Name string
    Display name of this mapper when displayed in the console.
    identityProviderAlias String
    The IDP alias of the attribute to set.
    realm String
    The realm ID that this mapper will exist in.
    userSession Boolean
    Is Attribute related to a User Session.
    attributeName String
    The name of the IDP attribute to set.
    attributeValue String
    The value to set to the attribute. You can hardcode any value like 'foo'.
    extraConfig Map<String,Object>
    name String
    Display name of this mapper when displayed in the console.
    identityProviderAlias string
    The IDP alias of the attribute to set.
    realm string
    The realm ID that this mapper will exist in.
    userSession boolean
    Is Attribute related to a User Session.
    attributeName string
    The name of the IDP attribute to set.
    attributeValue string
    The value to set to the attribute. You can hardcode any value like 'foo'.
    extraConfig {[key: string]: any}
    name string
    Display name of this mapper when displayed in the console.
    identity_provider_alias str
    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, Any]
    name str
    Display name of this mapper when displayed in the console.
    identityProviderAlias String
    The IDP alias of the attribute to set.
    realm String
    The realm ID that this mapper will exist in.
    userSession Boolean
    Is Attribute related to a User Session.
    attributeName String
    The name of the IDP attribute to set.
    attributeValue String
    The value to set to the attribute. You can hardcode any value like 'foo'.
    extraConfig Map<Any>
    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, Any]] = 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.
    The following state arguments are supported:
    AttributeName string
    The name of the IDP attribute to set.
    AttributeValue string
    The value to set to the attribute. You can hardcode any value like 'foo'.
    ExtraConfig Dictionary<string, object>
    IdentityProviderAlias string
    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.
    UserSession bool
    Is Attribute related to a User Session.
    AttributeName string
    The name of the IDP attribute to set.
    AttributeValue string
    The value to set to the attribute. You can hardcode any value like 'foo'.
    ExtraConfig map[string]interface{}
    IdentityProviderAlias string
    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.
    UserSession bool
    Is Attribute related to a User Session.
    attributeName String
    The name of the IDP attribute to set.
    attributeValue String
    The value to set to the attribute. You can hardcode any value like 'foo'.
    extraConfig Map<String,Object>
    identityProviderAlias String
    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.
    userSession Boolean
    Is Attribute related to a User Session.
    attributeName string
    The name of the IDP attribute to set.
    attributeValue string
    The value to set to the attribute. You can hardcode any value like 'foo'.
    extraConfig {[key: string]: any}
    identityProviderAlias string
    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.
    userSession 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, Any]
    identity_provider_alias str
    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.
    attributeName String
    The name of the IDP attribute to set.
    attributeValue String
    The value to set to the attribute. You can hardcode any value like 'foo'.
    extraConfig Map<Any>
    identityProviderAlias String
    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.
    userSession 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.
    keycloak logo
    Keycloak v5.3.1 published on Monday, Mar 11, 2024 by Pulumi