Keycloak

v4.11.0 published on Thursday, Aug 4, 2022 by Pulumi

ClientScope

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

Client Scopes can be used to share common protocol and role mappings between multiple clients within a realm.

Example Usage

using Pulumi;
using Keycloak = Pulumi.Keycloak;

class MyStack : Stack
{
    public MyStack()
    {
        var realm = new Keycloak.Realm("realm", new Keycloak.RealmArgs
        {
            RealmName = "my-realm",
            Enabled = true,
        });
        var samlClientScope = new Keycloak.Saml.ClientScope("samlClientScope", new Keycloak.Saml.ClientScopeArgs
        {
            RealmId = realm.Id,
            Description = "This scope will map a user's group memberships to SAML assertion",
            GuiOrder = 1,
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-keycloak/sdk/v4/go/keycloak"
	"github.com/pulumi/pulumi-keycloak/sdk/v4/go/keycloak/saml"
	"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
		}
		_, err = saml.NewClientScope(ctx, "samlClientScope", &saml.ClientScopeArgs{
			RealmId:     realm.ID(),
			Description: pulumi.String("This scope will map a user's group memberships to SAML assertion"),
			GuiOrder:    pulumi.Int(1),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
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.saml.ClientScope;
import com.pulumi.keycloak.saml.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()        
            .realm("my-realm")
            .enabled(true)
            .build());

        var samlClientScope = new ClientScope("samlClientScope", ClientScopeArgs.builder()        
            .realmId(realm.id())
            .description("This scope will map a user's group memberships to SAML assertion")
            .guiOrder(1)
            .build());

    }
}
import pulumi
import pulumi_keycloak as keycloak

realm = keycloak.Realm("realm",
    realm="my-realm",
    enabled=True)
saml_client_scope = keycloak.saml.ClientScope("samlClientScope",
    realm_id=realm.id,
    description="This scope will map a user's group memberships to SAML assertion",
    gui_order=1)
import * as pulumi from "@pulumi/pulumi";
import * as keycloak from "@pulumi/keycloak";

const realm = new keycloak.Realm("realm", {
    realm: "my-realm",
    enabled: true,
});
const samlClientScope = new keycloak.saml.ClientScope("samlClientScope", {
    realmId: realm.id,
    description: "This scope will map a user's group memberships to SAML assertion",
    guiOrder: 1,
});
resources:
  realm:
    type: keycloak:Realm
    properties:
      realm: my-realm
      enabled: true
  samlClientScope:
    type: keycloak:saml:ClientScope
    properties:
      realmId: ${realm.id}
      description: This scope will map a user's group memberships to SAML assertion
      guiOrder: 1

Create a ClientScope Resource

new ClientScope(name: string, args: ClientScopeArgs, opts?: CustomResourceOptions);
@overload
def ClientScope(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                consent_screen_text: Optional[str] = None,
                description: Optional[str] = None,
                gui_order: Optional[int] = None,
                name: Optional[str] = None,
                realm_id: Optional[str] = None)
@overload
def ClientScope(resource_name: str,
                args: ClientScopeArgs,
                opts: Optional[ResourceOptions] = 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:saml:ClientScope
properties: # The arguments to resource properties.
options: # 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.
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.

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

The realm this client scope belongs to.

ConsentScreenText string

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.

Description string

The description of this client scope in the GUI.

GuiOrder int

Specify order of the client scope in GUI (such as in Consent page) as integer.

Name string

The display name of this client scope in the GUI.

RealmId string

The realm this client scope belongs to.

ConsentScreenText string

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.

Description string

The description of this client scope in the GUI.

GuiOrder int

Specify order of the client scope in GUI (such as in Consent page) as integer.

Name string

The display name of this client scope in the GUI.

realmId String

The realm this client scope belongs to.

consentScreenText String

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.

description String

The description of this client scope in the GUI.

guiOrder Integer

Specify order of the client scope in GUI (such as in Consent page) as integer.

name String

The display name of this client scope in the GUI.

realmId string

The realm this client scope belongs to.

consentScreenText string

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.

description string

The description of this client scope in the GUI.

guiOrder number

Specify order of the client scope in GUI (such as in Consent page) as integer.

name string

The display name of this client scope in the GUI.

realm_id str

The realm this client scope belongs to.

consent_screen_text str

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.

description str

The description of this client scope in the GUI.

gui_order int

Specify order of the client scope in GUI (such as in Consent page) as integer.

name str

The display name of this client scope in the GUI.

realmId String

The realm this client scope belongs to.

consentScreenText String

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.

description String

The description of this client scope in the GUI.

guiOrder Number

Specify order of the client scope in GUI (such as in Consent page) as integer.

name String

The display name of this client scope in the GUI.

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 an 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,
        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

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.

Description string

The description of this client scope in the GUI.

GuiOrder int

Specify order of the client scope in GUI (such as in Consent page) as integer.

Name string

The display name of this client scope in the GUI.

RealmId string

The realm this client scope belongs to.

ConsentScreenText string

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.

Description string

The description of this client scope in the GUI.

GuiOrder int

Specify order of the client scope in GUI (such as in Consent page) as integer.

Name string

The display name of this client scope in the GUI.

RealmId string

The realm this client scope belongs to.

consentScreenText String

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.

description String

The description of this client scope in the GUI.

guiOrder Integer

Specify order of the client scope in GUI (such as in Consent page) as integer.

name String

The display name of this client scope in the GUI.

realmId String

The realm this client scope belongs to.

consentScreenText string

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.

description string

The description of this client scope in the GUI.

guiOrder number

Specify order of the client scope in GUI (such as in Consent page) as integer.

name string

The display name of this client scope in the GUI.

realmId string

The realm this client scope belongs to.

consent_screen_text str

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.

description str

The description of this client scope in the GUI.

gui_order int

Specify order of the client scope in GUI (such as in Consent page) as integer.

name str

The display name of this client scope in the GUI.

realm_id str

The realm this client scope belongs to.

consentScreenText String

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.

description String

The description of this client scope in the GUI.

guiOrder Number

Specify order of the client scope in GUI (such as in Consent page) as integer.

name String

The display name of this client scope in the GUI.

realmId String

The realm this client scope belongs to.

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. Examplebash

 $ pulumi import keycloak:saml/clientScope:ClientScope saml_client_scope my-realm/e8a5d115-6985-4de3-a0f5-732e1be4525e

Package Details

Repository
https://github.com/pulumi/pulumi-keycloak
License
Apache-2.0
Notes

This Pulumi package is based on the keycloak Terraform Provider.