Client Scope
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
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("saml_client_scope", {
realmId: realm.id,
name: "groups",
description: "This scope will map a user's group memberships to SAML assertion",
guiOrder: 1,
});
Content copied to clipboard
import pulumi
import pulumi_keycloak as keycloak
realm = keycloak.Realm("realm",
realm="my-realm",
enabled=True)
saml_client_scope = keycloak.saml.ClientScope("saml_client_scope",
realm_id=realm.id,
name="groups",
description="This scope will map a user's group memberships to SAML assertion",
gui_order=1)
Content copied to clipboard
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 samlClientScope = new Keycloak.Saml.ClientScope("saml_client_scope", new()
{
RealmId = realm.Id,
Name = "groups",
Description = "This scope will map a user's group memberships to SAML assertion",
GuiOrder = 1,
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-keycloak/sdk/v6/go/keycloak"
"github.com/pulumi/pulumi-keycloak/sdk/v6/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, "saml_client_scope", &saml.ClientScopeArgs{
RealmId: realm.ID(),
Name: pulumi.String("groups"),
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
})
}
Content copied to clipboard
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())
.name("groups")
.description("This scope will map a user's group memberships to SAML assertion")
.guiOrder(1)
.build());
}
}
Content copied to clipboard
resources:
realm:
type: keycloak:Realm
properties:
realm: my-realm
enabled: true
samlClientScope:
type: keycloak:saml:ClientScope
name: saml_client_scope
properties:
realmId: ${realm.id}
name: groups
description: This scope will map a user's group memberships to SAML assertion
guiOrder: 1
Content copied to clipboard
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: bash
$ pulumi import keycloak:saml/clientScope:ClientScope saml_client_scope my-realm/e8a5d115-6985-4de3-a0f5-732e1be4525e
Content copied to clipboard
Properties
Link copied to clipboard
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.
Link copied to clipboard
The description of this client scope in the GUI.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard