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

keycloak.CustomUserFederation

Explore with Pulumi AI

keycloak logo
Keycloak v5.3.1 published on Monday, Mar 11, 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", {
        enabled: true,
        realm: "test",
    });
    const customUserFederation = new keycloak.CustomUserFederation("customUserFederation", {
        enabled: true,
        providerId: "custom",
        realmId: realm.id,
    });
    
    import pulumi
    import pulumi_keycloak as keycloak
    
    realm = keycloak.Realm("realm",
        enabled=True,
        realm="test")
    custom_user_federation = keycloak.CustomUserFederation("customUserFederation",
        enabled=True,
        provider_id="custom",
        realm_id=realm.id)
    
    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{
    			Enabled: pulumi.Bool(true),
    			Realm:   pulumi.String("test"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = keycloak.NewCustomUserFederation(ctx, "customUserFederation", &keycloak.CustomUserFederationArgs{
    			Enabled:    pulumi.Bool(true),
    			ProviderId: pulumi.String("custom"),
    			RealmId:    realm.ID(),
    		})
    		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()
        {
            Enabled = true,
            RealmName = "test",
        });
    
        var customUserFederation = new Keycloak.CustomUserFederation("customUserFederation", new()
        {
            Enabled = true,
            ProviderId = "custom",
            RealmId = realm.Id,
        });
    
    });
    
    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()        
                .enabled(true)
                .realm("test")
                .build());
    
            var customUserFederation = new CustomUserFederation("customUserFederation", CustomUserFederationArgs.builder()        
                .enabled(true)
                .providerId("custom")
                .realmId(realm.id())
                .build());
    
        }
    }
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          enabled: true
          realm: test
      customUserFederation:
        type: keycloak:CustomUserFederation
        properties:
          enabled: true
          providerId: custom
          realmId: ${realm.id}
    

    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

    new CustomUserFederation(name: string, args: CustomUserFederationArgs, opts?: CustomResourceOptions);
    @overload
    def CustomUserFederation(resource_name: 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)
    @overload
    def CustomUserFederation(resource_name: str,
                             args: CustomUserFederationArgs,
                             opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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.1 published on Monday, Mar 11, 2024 by Pulumi