keycloak.authentication.Flow
Explore with Pulumi AI
Allows for creating and managing an authentication flow within Keycloak.
Authentication flows describe a sequence of actions that a user or service must perform in order to be authenticated to Keycloak. The authentication flow itself is a container for these actions, which are otherwise known as executions.
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 flow = new keycloak.authentication.Flow("flow", {
realmId: realm.id,
alias: "my-flow-alias",
});
const execution = new keycloak.authentication.Execution("execution", {
realmId: realm.id,
parentFlowAlias: flow.alias,
authenticator: "identity-provider-redirector",
requirement: "REQUIRED",
});
import pulumi
import pulumi_keycloak as keycloak
realm = keycloak.Realm("realm",
realm="my-realm",
enabled=True)
flow = keycloak.authentication.Flow("flow",
realm_id=realm.id,
alias="my-flow-alias")
execution = keycloak.authentication.Execution("execution",
realm_id=realm.id,
parent_flow_alias=flow.alias,
authenticator="identity-provider-redirector",
requirement="REQUIRED")
package main
import (
"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak"
"github.com/pulumi/pulumi-keycloak/sdk/v5/go/keycloak/authentication"
"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
}
flow, err := authentication.NewFlow(ctx, "flow", &authentication.FlowArgs{
RealmId: realm.ID(),
Alias: pulumi.String("my-flow-alias"),
})
if err != nil {
return err
}
_, err = authentication.NewExecution(ctx, "execution", &authentication.ExecutionArgs{
RealmId: realm.ID(),
ParentFlowAlias: flow.Alias,
Authenticator: pulumi.String("identity-provider-redirector"),
Requirement: pulumi.String("REQUIRED"),
})
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 = "my-realm",
Enabled = true,
});
var flow = new Keycloak.Authentication.Flow("flow", new()
{
RealmId = realm.Id,
Alias = "my-flow-alias",
});
var execution = new Keycloak.Authentication.Execution("execution", new()
{
RealmId = realm.Id,
ParentFlowAlias = flow.Alias,
Authenticator = "identity-provider-redirector",
Requirement = "REQUIRED",
});
});
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.authentication.Flow;
import com.pulumi.keycloak.authentication.FlowArgs;
import com.pulumi.keycloak.authentication.Execution;
import com.pulumi.keycloak.authentication.ExecutionArgs;
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 flow = new Flow("flow", FlowArgs.builder()
.realmId(realm.id())
.alias("my-flow-alias")
.build());
var execution = new Execution("execution", ExecutionArgs.builder()
.realmId(realm.id())
.parentFlowAlias(flow.alias())
.authenticator("identity-provider-redirector")
.requirement("REQUIRED")
.build());
}
}
resources:
realm:
type: keycloak:Realm
properties:
realm: my-realm
enabled: true
flow:
type: keycloak:authentication:Flow
properties:
realmId: ${realm.id}
alias: my-flow-alias
execution:
type: keycloak:authentication:Execution
properties:
realmId: ${realm.id}
parentFlowAlias: ${flow.alias}
authenticator: identity-provider-redirector
requirement: REQUIRED
Create Flow Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Flow(name: string, args: FlowArgs, opts?: CustomResourceOptions);
@overload
def Flow(resource_name: str,
args: FlowArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Flow(resource_name: str,
opts: Optional[ResourceOptions] = None,
alias: Optional[str] = None,
realm_id: Optional[str] = None,
description: Optional[str] = None,
provider_id: Optional[str] = None)
func NewFlow(ctx *Context, name string, args FlowArgs, opts ...ResourceOption) (*Flow, error)
public Flow(string name, FlowArgs args, CustomResourceOptions? opts = null)
type: keycloak:authentication:Flow
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 FlowArgs
- 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 FlowArgs
- 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 FlowArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FlowArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FlowArgs
- 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 flowResource = new Keycloak.Authentication.Flow("flowResource", new()
{
Alias = "string",
RealmId = "string",
Description = "string",
ProviderId = "string",
});
example, err := authentication.NewFlow(ctx, "flowResource", &authentication.FlowArgs{
Alias: pulumi.String("string"),
RealmId: pulumi.String("string"),
Description: pulumi.String("string"),
ProviderId: pulumi.String("string"),
})
var flowResource = new Flow("flowResource", FlowArgs.builder()
.alias("string")
.realmId("string")
.description("string")
.providerId("string")
.build());
flow_resource = keycloak.authentication.Flow("flowResource",
alias="string",
realm_id="string",
description="string",
provider_id="string")
const flowResource = new keycloak.authentication.Flow("flowResource", {
alias: "string",
realmId: "string",
description: "string",
providerId: "string",
});
type: keycloak:authentication:Flow
properties:
alias: string
description: string
providerId: string
realmId: string
Flow 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 Flow resource accepts the following input properties:
- Alias string
- The alias for this authentication flow.
- Realm
Id string - The realm that the authentication flow exists in.
- Description string
- A description for the authentication flow.
- Provider
Id string - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
.
- Alias string
- The alias for this authentication flow.
- Realm
Id string - The realm that the authentication flow exists in.
- Description string
- A description for the authentication flow.
- Provider
Id string - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
.
- alias String
- The alias for this authentication flow.
- realm
Id String - The realm that the authentication flow exists in.
- description String
- A description for the authentication flow.
- provider
Id String - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
.
- alias string
- The alias for this authentication flow.
- realm
Id string - The realm that the authentication flow exists in.
- description string
- A description for the authentication flow.
- provider
Id string - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
.
- alias str
- The alias for this authentication flow.
- realm_
id str - The realm that the authentication flow exists in.
- description str
- A description for the authentication flow.
- provider_
id str - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
.
- alias String
- The alias for this authentication flow.
- realm
Id String - The realm that the authentication flow exists in.
- description String
- A description for the authentication flow.
- provider
Id String - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
.
Outputs
All input properties are implicitly available as output properties. Additionally, the Flow 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 Flow Resource
Get an existing Flow 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?: FlowState, opts?: CustomResourceOptions): Flow
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
alias: Optional[str] = None,
description: Optional[str] = None,
provider_id: Optional[str] = None,
realm_id: Optional[str] = None) -> Flow
func GetFlow(ctx *Context, name string, id IDInput, state *FlowState, opts ...ResourceOption) (*Flow, error)
public static Flow Get(string name, Input<string> id, FlowState? state, CustomResourceOptions? opts = null)
public static Flow get(String name, Output<String> id, FlowState 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.
- Alias string
- The alias for this authentication flow.
- Description string
- A description for the authentication flow.
- Provider
Id string - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
. - Realm
Id string - The realm that the authentication flow exists in.
- Alias string
- The alias for this authentication flow.
- Description string
- A description for the authentication flow.
- Provider
Id string - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
. - Realm
Id string - The realm that the authentication flow exists in.
- alias String
- The alias for this authentication flow.
- description String
- A description for the authentication flow.
- provider
Id String - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
. - realm
Id String - The realm that the authentication flow exists in.
- alias string
- The alias for this authentication flow.
- description string
- A description for the authentication flow.
- provider
Id string - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
. - realm
Id string - The realm that the authentication flow exists in.
- alias str
- The alias for this authentication flow.
- description str
- A description for the authentication flow.
- provider_
id str - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
. - realm_
id str - The realm that the authentication flow exists in.
- alias String
- The alias for this authentication flow.
- description String
- A description for the authentication flow.
- provider
Id String - The type of authentication flow to create. Valid choices include
basic-flow
andclient-flow
. Defaults tobasic-flow
. - realm
Id String - The realm that the authentication flow exists in.
Import
Authentication flows can be imported using the format {{realmId}}/{{authenticationFlowId}}
. The authentication flow ID is
typically a GUID which is autogenerated when the flow is created via Keycloak.
Unfortunately, it is not trivial to retrieve the authentication flow ID from the UI. The best way to do this is to visit the
“Authentication” page in Keycloak, and use the network tab of your browser to view the response of the API call to /auth/admin/realms/${realm}/authentication/flows
,
which will be a list of authentication flows.
Example:
bash
$ pulumi import keycloak:authentication/flow:Flow flow my-realm/e9a5641e-778c-4daf-89c0-f4ef617987d1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Keycloak pulumi/pulumi-keycloak
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
keycloak
Terraform Provider.