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

keycloak.openid.ClientScope

Explore with Pulumi AI

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

    # keycloak.openid.ClientScope

    Allows for creating and managing Keycloak client scopes that can be attached to clients that use the OpenID Connect protocol.

    Client Scopes can be used to share common protocol and role mappings between multiple clients within a realm. They can also be used by clients to conditionally request claims or roles for a user based on the OAuth 2.0 scope parameter.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as keycloak from "@pulumi/keycloak";
    
    const realm = new keycloak.Realm("realm", {
        enabled: true,
        realm: "my-realm",
    });
    const openidClientScope = new keycloak.openid.ClientScope("openidClientScope", {
        description: "When requested, this scope will map a user's group memberships to a claim",
        realmId: realm.id,
    });
    
    import pulumi
    import pulumi_keycloak as keycloak
    
    realm = keycloak.Realm("realm",
        enabled=True,
        realm="my-realm")
    openid_client_scope = keycloak.openid.ClientScope("openidClientScope",
        description="When requested, this scope will map a user's group memberships to a claim",
        realm_id=realm.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak"
    	"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak/openid"
    	"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("my-realm"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = openid.NewClientScope(ctx, "openidClientScope", &openid.ClientScopeArgs{
    			Description: pulumi.String("When requested, this scope will map a user's group memberships to a claim"),
    			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 = "my-realm",
        });
    
        var openidClientScope = new Keycloak.OpenId.ClientScope("openidClientScope", new()
        {
            Description = "When requested, this scope will map a user's group memberships to a claim",
            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.openid.ClientScope;
    import com.pulumi.keycloak.openid.ClientScopeArgs;
    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("my-realm")
                .build());
    
            var openidClientScope = new ClientScope("openidClientScope", ClientScopeArgs.builder()        
                .description("When requested, this scope will map a user's group memberships to a claim")
                .realmId(realm.id())
                .build());
    
        }
    }
    
    resources:
      realm:
        type: keycloak:Realm
        properties:
          enabled: true
          realm: my-realm
      openidClientScope:
        type: keycloak:openid:ClientScope
        properties:
          description: When requested, this scope will map a user's group memberships to a claim
          realmId: ${realm.id}
    

    Argument Reference

    The following arguments are supported:

    • realm_id - (Required) The realm this client scope belongs to.
    • name - (Required) The display name of this client scope in the GUI.
    • description - (Optional) The description of this client scope in the GUI.
    • consent_screen_text - (Optional) When set, a consent screen will be displayed to users authenticating to clients with this scope attached. The consent screen will display the string value of this attribute.

    Import

    Client scopes can be imported using the format {{realm_id}}/{{client_scope_id}}, where client_scope_id is the unique ID that Keycloak assigns to the client scope upon creation. This value can be found in the URI when editing this client scope in the GUI, and is typically a GUID.

    Example:

    $ terraform import keycloak_openid_client_scope.openid_client_scope my-realm/8e8f7fe1-df9b-40ed-bed3-4597aa0dac52
    

    Create ClientScope Resource

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

    Constructor syntax

    new ClientScope(name: string, args: ClientScopeArgs, opts?: CustomResourceOptions);
    @overload
    def ClientScope(resource_name: str,
                    args: ClientScopeArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def ClientScope(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    realm_id: Optional[str] = None,
                    consent_screen_text: Optional[str] = None,
                    description: Optional[str] = None,
                    gui_order: Optional[int] = None,
                    include_in_token_scope: Optional[bool] = None,
                    name: Optional[str] = None)
    func NewClientScope(ctx *Context, name string, args ClientScopeArgs, opts ...ResourceOption) (*ClientScope, error)
    public ClientScope(string name, ClientScopeArgs args, CustomResourceOptions? opts = null)
    public ClientScope(String name, ClientScopeArgs args)
    public ClientScope(String name, ClientScopeArgs args, CustomResourceOptions options)
    
    type: keycloak:openid:ClientScope
    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 ClientScopeArgs
    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 ClientScopeArgs
    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 ClientScopeArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ClientScopeArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ClientScopeArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var clientScopeResource = new Keycloak.OpenId.ClientScope("clientScopeResource", new()
    {
        RealmId = "string",
        ConsentScreenText = "string",
        Description = "string",
        GuiOrder = 0,
        IncludeInTokenScope = false,
        Name = "string",
    });
    
    example, err := openid.NewClientScope(ctx, "clientScopeResource", &openid.ClientScopeArgs{
    	RealmId:             pulumi.String("string"),
    	ConsentScreenText:   pulumi.String("string"),
    	Description:         pulumi.String("string"),
    	GuiOrder:            pulumi.Int(0),
    	IncludeInTokenScope: pulumi.Bool(false),
    	Name:                pulumi.String("string"),
    })
    
    var clientScopeResource = new ClientScope("clientScopeResource", ClientScopeArgs.builder()        
        .realmId("string")
        .consentScreenText("string")
        .description("string")
        .guiOrder(0)
        .includeInTokenScope(false)
        .name("string")
        .build());
    
    client_scope_resource = keycloak.openid.ClientScope("clientScopeResource",
        realm_id="string",
        consent_screen_text="string",
        description="string",
        gui_order=0,
        include_in_token_scope=False,
        name="string")
    
    const clientScopeResource = new keycloak.openid.ClientScope("clientScopeResource", {
        realmId: "string",
        consentScreenText: "string",
        description: "string",
        guiOrder: 0,
        includeInTokenScope: false,
        name: "string",
    });
    
    type: keycloak:openid:ClientScope
    properties:
        consentScreenText: string
        description: string
        guiOrder: 0
        includeInTokenScope: false
        name: string
        realmId: string
    

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

    realmId String
    consentScreenText String
    description String
    guiOrder Integer
    includeInTokenScope Boolean
    name String

    Outputs

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

    Get an existing ClientScope 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?: ClientScopeState, opts?: CustomResourceOptions): ClientScope
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            consent_screen_text: Optional[str] = None,
            description: Optional[str] = None,
            gui_order: Optional[int] = None,
            include_in_token_scope: Optional[bool] = None,
            name: Optional[str] = None,
            realm_id: Optional[str] = None) -> ClientScope
    func GetClientScope(ctx *Context, name string, id IDInput, state *ClientScopeState, opts ...ResourceOption) (*ClientScope, error)
    public static ClientScope Get(string name, Input<string> id, ClientScopeState? state, CustomResourceOptions? opts = null)
    public static ClientScope get(String name, Output<String> id, ClientScopeState 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:
    consentScreenText String
    description String
    guiOrder Integer
    includeInTokenScope Boolean
    name String
    realmId String

    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