1. Packages
  2. Keycloak
  3. API Docs
  4. CustomUserFederation
Keycloak v5.3.2 published on Friday, May 10, 2024 by Pulumi

keycloak.CustomUserFederation

Explore with Pulumi AI

keycloak logo
Keycloak v5.3.2 published on Friday, May 10, 2024 by Pulumi

    # keycloak.CustomUserFederation

    Allows for creating and managing custom user federation providers within Keycloak.

    A custom user federation provider is an implementation of Keycloak’s User Storage SPI. An example of this implementation can be found here.

    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 customUserFederation = new keycloak.CustomUserFederation("custom_user_federation", {
        name: "custom",
        realmId: realm.id,
        providerId: "custom",
        enabled: true,
    });
    
    import pulumi
    import pulumi_keycloak as keycloak
    
    realm = keycloak.Realm("realm",
        realm="test",
        enabled=True)
    custom_user_federation = keycloak.CustomUserFederation("custom_user_federation",
        name="custom",
        realm_id=realm.id,
        provider_id="custom",
        enabled=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak"
    	"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("test"),
    			Enabled: pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = keycloak.NewCustomUserFederation(ctx, "custom_user_federation", &keycloak.CustomUserFederationArgs{
    			Name:       pulumi.String("custom"),
    			RealmId:    realm.ID(),
    			ProviderId: pulumi.String("custom"),
    			Enabled:    pulumi.Bool(true),
    		})
    		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 = "test",
            Enabled = true,
        });
    
        var customUserFederation = new Keycloak.CustomUserFederation("custom_user_federation", new()
        {
            Name = "custom",
            RealmId = realm.Id,
            ProviderId = "custom",
            Enabled = true,
        });
    
    });
    
    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.CustomUserFederation;
    import com.pulumi.keycloak.CustomUserFederationArgs;
    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("test")
                .enabled(true)
                .build());
    
            var customUserFederation = new CustomUserFederation("customUserFederation", CustomUserFederationArgs.builder()        
                .name("custom")
                .realmId(realm.id())
                .providerId("custom")
                .enabled(true)
                .build());
    
        }
    }
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          realm: test
          enabled: true
      customUserFederation:
        type: keycloak:CustomUserFederation
        name: custom_user_federation
        properties:
          name: custom
          realmId: ${realm.id}
          providerId: custom
          enabled: true
    

    Argument Reference

    The following arguments are supported:

    • realm_id - (Required) The realm that this provider will provide user federation for.
    • name - (Required) Display name of the provider when displayed in the console.
    • provider_id - (Required) The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface.
    • enabled - (Optional) When false, this provider will not be used when performing queries for users. Defaults to true.
    • priority - (Optional) Priority of this provider when looking up users. Lower values are first. Defaults to 0.
    • cache_policy - (Optional) Can be one of DEFAULT, EVICT_DAILY, EVICT_WEEKLY, MAX_LIFESPAN, or NO_CACHE. Defaults to DEFAULT.

    Import

    Custom user federation providers can be imported using the format {{realm_id}}/{{custom_user_federation_id}}. The ID of the custom user federation provider can be found within the Keycloak GUI and is typically a GUID:

    $ terraform import keycloak_custom_user_federation.custom_user_federation my-realm/af2a6ca3-e4d7-49c3-b08b-1b3c70b4b860
    

    Create CustomUserFederation Resource

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

    Constructor syntax

    new CustomUserFederation(name: string, args: CustomUserFederationArgs, opts?: CustomResourceOptions);
    @overload
    def CustomUserFederation(resource_name: str,
                             args: CustomUserFederationArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def CustomUserFederation(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             provider_id: Optional[str] = None,
                             realm_id: Optional[str] = None,
                             cache_policy: Optional[str] = None,
                             changed_sync_period: Optional[int] = None,
                             config: Optional[Mapping[str, Any]] = None,
                             enabled: Optional[bool] = None,
                             full_sync_period: Optional[int] = None,
                             name: Optional[str] = None,
                             parent_id: Optional[str] = None,
                             priority: Optional[int] = None)
    func NewCustomUserFederation(ctx *Context, name string, args CustomUserFederationArgs, opts ...ResourceOption) (*CustomUserFederation, error)
    public CustomUserFederation(string name, CustomUserFederationArgs args, CustomResourceOptions? opts = null)
    public CustomUserFederation(String name, CustomUserFederationArgs args)
    public CustomUserFederation(String name, CustomUserFederationArgs args, CustomResourceOptions options)
    
    type: keycloak:CustomUserFederation
    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 CustomUserFederationArgs
    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 CustomUserFederationArgs
    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 CustomUserFederationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CustomUserFederationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CustomUserFederationArgs
    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 customUserFederationResource = new Keycloak.CustomUserFederation("customUserFederationResource", new()
    {
        ProviderId = "string",
        RealmId = "string",
        CachePolicy = "string",
        ChangedSyncPeriod = 0,
        Config = 
        {
            { "string", "any" },
        },
        Enabled = false,
        FullSyncPeriod = 0,
        Name = "string",
        ParentId = "string",
        Priority = 0,
    });
    
    example, err := keycloak.NewCustomUserFederation(ctx, "customUserFederationResource", &keycloak.CustomUserFederationArgs{
    	ProviderId:        pulumi.String("string"),
    	RealmId:           pulumi.String("string"),
    	CachePolicy:       pulumi.String("string"),
    	ChangedSyncPeriod: pulumi.Int(0),
    	Config: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	Enabled:        pulumi.Bool(false),
    	FullSyncPeriod: pulumi.Int(0),
    	Name:           pulumi.String("string"),
    	ParentId:       pulumi.String("string"),
    	Priority:       pulumi.Int(0),
    })
    
    var customUserFederationResource = new CustomUserFederation("customUserFederationResource", CustomUserFederationArgs.builder()
        .providerId("string")
        .realmId("string")
        .cachePolicy("string")
        .changedSyncPeriod(0)
        .config(Map.of("string", "any"))
        .enabled(false)
        .fullSyncPeriod(0)
        .name("string")
        .parentId("string")
        .priority(0)
        .build());
    
    custom_user_federation_resource = keycloak.CustomUserFederation("customUserFederationResource",
        provider_id="string",
        realm_id="string",
        cache_policy="string",
        changed_sync_period=0,
        config={
            "string": "any",
        },
        enabled=False,
        full_sync_period=0,
        name="string",
        parent_id="string",
        priority=0)
    
    const customUserFederationResource = new keycloak.CustomUserFederation("customUserFederationResource", {
        providerId: "string",
        realmId: "string",
        cachePolicy: "string",
        changedSyncPeriod: 0,
        config: {
            string: "any",
        },
        enabled: false,
        fullSyncPeriod: 0,
        name: "string",
        parentId: "string",
        priority: 0,
    });
    
    type: keycloak:CustomUserFederation
    properties:
        cachePolicy: string
        changedSyncPeriod: 0
        config:
            string: any
        enabled: false
        fullSyncPeriod: 0
        name: string
        parentId: string
        priority: 0
        providerId: string
        realmId: string
    

    CustomUserFederation 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 CustomUserFederation resource accepts the following input properties:

    ProviderId string
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    RealmId string
    The realm (name) this provider will provide user federation for.
    CachePolicy string
    ChangedSyncPeriod int
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    Config Dictionary<string, object>
    Enabled bool
    When false, this provider will not be used when performing queries for users.
    FullSyncPeriod int
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    Name string
    Display name of the provider when displayed in the console.
    ParentId string
    The parent_id of the generated component. will use realm_id if not specified.
    Priority int
    Priority of this provider when looking up users. Lower values are first.
    ProviderId string
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    RealmId string
    The realm (name) this provider will provide user federation for.
    CachePolicy string
    ChangedSyncPeriod int
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    Config map[string]interface{}
    Enabled bool
    When false, this provider will not be used when performing queries for users.
    FullSyncPeriod int
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    Name string
    Display name of the provider when displayed in the console.
    ParentId string
    The parent_id of the generated component. will use realm_id if not specified.
    Priority int
    Priority of this provider when looking up users. Lower values are first.
    providerId String
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    realmId String
    The realm (name) this provider will provide user federation for.
    cachePolicy String
    changedSyncPeriod Integer
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    config Map<String,Object>
    enabled Boolean
    When false, this provider will not be used when performing queries for users.
    fullSyncPeriod Integer
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    name String
    Display name of the provider when displayed in the console.
    parentId String
    The parent_id of the generated component. will use realm_id if not specified.
    priority Integer
    Priority of this provider when looking up users. Lower values are first.
    providerId string
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    realmId string
    The realm (name) this provider will provide user federation for.
    cachePolicy string
    changedSyncPeriod number
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    config {[key: string]: any}
    enabled boolean
    When false, this provider will not be used when performing queries for users.
    fullSyncPeriod number
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    name string
    Display name of the provider when displayed in the console.
    parentId string
    The parent_id of the generated component. will use realm_id if not specified.
    priority number
    Priority of this provider when looking up users. Lower values are first.
    provider_id str
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    realm_id str
    The realm (name) this provider will provide user federation for.
    cache_policy str
    changed_sync_period int
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    config Mapping[str, Any]
    enabled bool
    When false, this provider will not be used when performing queries for users.
    full_sync_period int
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    name str
    Display name of the provider when displayed in the console.
    parent_id str
    The parent_id of the generated component. will use realm_id if not specified.
    priority int
    Priority of this provider when looking up users. Lower values are first.
    providerId String
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    realmId String
    The realm (name) this provider will provide user federation for.
    cachePolicy String
    changedSyncPeriod Number
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    config Map<Any>
    enabled Boolean
    When false, this provider will not be used when performing queries for users.
    fullSyncPeriod Number
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    name String
    Display name of the provider when displayed in the console.
    parentId String
    The parent_id of the generated component. will use realm_id if not specified.
    priority Number
    Priority of this provider when looking up users. Lower values are first.

    Outputs

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

    Get an existing CustomUserFederation 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?: CustomUserFederationState, opts?: CustomResourceOptions): CustomUserFederation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cache_policy: Optional[str] = None,
            changed_sync_period: Optional[int] = None,
            config: Optional[Mapping[str, Any]] = None,
            enabled: Optional[bool] = None,
            full_sync_period: Optional[int] = None,
            name: Optional[str] = None,
            parent_id: Optional[str] = None,
            priority: Optional[int] = None,
            provider_id: Optional[str] = None,
            realm_id: Optional[str] = None) -> CustomUserFederation
    func GetCustomUserFederation(ctx *Context, name string, id IDInput, state *CustomUserFederationState, opts ...ResourceOption) (*CustomUserFederation, error)
    public static CustomUserFederation Get(string name, Input<string> id, CustomUserFederationState? state, CustomResourceOptions? opts = null)
    public static CustomUserFederation get(String name, Output<String> id, CustomUserFederationState 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:
    CachePolicy string
    ChangedSyncPeriod int
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    Config Dictionary<string, object>
    Enabled bool
    When false, this provider will not be used when performing queries for users.
    FullSyncPeriod int
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    Name string
    Display name of the provider when displayed in the console.
    ParentId string
    The parent_id of the generated component. will use realm_id if not specified.
    Priority int
    Priority of this provider when looking up users. Lower values are first.
    ProviderId string
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    RealmId string
    The realm (name) this provider will provide user federation for.
    CachePolicy string
    ChangedSyncPeriod int
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    Config map[string]interface{}
    Enabled bool
    When false, this provider will not be used when performing queries for users.
    FullSyncPeriod int
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    Name string
    Display name of the provider when displayed in the console.
    ParentId string
    The parent_id of the generated component. will use realm_id if not specified.
    Priority int
    Priority of this provider when looking up users. Lower values are first.
    ProviderId string
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    RealmId string
    The realm (name) this provider will provide user federation for.
    cachePolicy String
    changedSyncPeriod Integer
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    config Map<String,Object>
    enabled Boolean
    When false, this provider will not be used when performing queries for users.
    fullSyncPeriod Integer
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    name String
    Display name of the provider when displayed in the console.
    parentId String
    The parent_id of the generated component. will use realm_id if not specified.
    priority Integer
    Priority of this provider when looking up users. Lower values are first.
    providerId String
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    realmId String
    The realm (name) this provider will provide user federation for.
    cachePolicy string
    changedSyncPeriod number
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    config {[key: string]: any}
    enabled boolean
    When false, this provider will not be used when performing queries for users.
    fullSyncPeriod number
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    name string
    Display name of the provider when displayed in the console.
    parentId string
    The parent_id of the generated component. will use realm_id if not specified.
    priority number
    Priority of this provider when looking up users. Lower values are first.
    providerId string
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    realmId string
    The realm (name) this provider will provide user federation for.
    cache_policy str
    changed_sync_period int
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    config Mapping[str, Any]
    enabled bool
    When false, this provider will not be used when performing queries for users.
    full_sync_period int
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    name str
    Display name of the provider when displayed in the console.
    parent_id str
    The parent_id of the generated component. will use realm_id if not specified.
    priority int
    Priority of this provider when looking up users. Lower values are first.
    provider_id str
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    realm_id str
    The realm (name) this provider will provide user federation for.
    cachePolicy String
    changedSyncPeriod Number
    How frequently Keycloak should sync changed users, in seconds. Omit this property to disable periodic changed users sync.
    config Map<Any>
    enabled Boolean
    When false, this provider will not be used when performing queries for users.
    fullSyncPeriod Number
    How frequently Keycloak should sync all users, in seconds. Omit this property to disable periodic full sync.
    name String
    Display name of the provider when displayed in the console.
    parentId String
    The parent_id of the generated component. will use realm_id if not specified.
    priority Number
    Priority of this provider when looking up users. Lower values are first.
    providerId String
    The unique ID of the custom provider, specified in the getId implementation for the UserStorageProviderFactory interface
    realmId String
    The realm (name) this provider will provide user federation for.

    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.2 published on Friday, May 10, 2024 by Pulumi