Auth0
Hook
Hooks are secure, self-contained functions that allow you to customize the behavior of Auth0 when executed for selected extensibility points of the Auth0 platform. Auth0 invokes Hooks during runtime to execute your custom Node.js code.
Depending on the extensibility point, you can use Hooks with Database Connections and/or Passwordless Connections.
Example Usage
using Pulumi;
using Auth0 = Pulumi.Auth0;
class MyStack : Stack
{
public MyStack()
{
var myHook = new Auth0.Hook("myHook", new Auth0.HookArgs
{
Dependencies =
{
{ "auth0", "2.30.0" },
},
Enabled = true,
Script = @"function (user, context, callback) {
callback(null, { user });
}
",
Secrets =
{
{ "foo", "bar" },
},
TriggerId = "pre-user-registration",
});
}
}
package main
import (
"fmt"
"github.com/pulumi/pulumi-auth0/sdk/v2/go/auth0"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := auth0.NewHook(ctx, "myHook", &auth0.HookArgs{
Dependencies: pulumi.AnyMap{
"auth0": pulumi.Any("2.30.0"),
},
Enabled: pulumi.Bool(true),
Script: pulumi.String(fmt.Sprintf("%v%v%v%v", "function (user, context, callback) {\n", " callback(null, { user });\n", "}\n", "\n")),
Secrets: pulumi.AnyMap{
"foo": pulumi.Any("bar"),
},
TriggerId: pulumi.String("pre-user-registration"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var myHook = new Hook("myHook", HookArgs.builder()
.dependencies(Map.of("auth0", "2.30.0"))
.enabled(true)
.script("""
function (user, context, callback) {
callback(null, { user });
}
""")
.secrets(Map.of("foo", "bar"))
.triggerId("pre-user-registration")
.build());
}
}
import pulumi
import pulumi_auth0 as auth0
my_hook = auth0.Hook("myHook",
dependencies={
"auth0": "2.30.0",
},
enabled=True,
script="""function (user, context, callback) {
callback(null, { user });
}
""",
secrets={
"foo": "bar",
},
trigger_id="pre-user-registration")
import * as pulumi from "@pulumi/pulumi";
import * as auth0 from "@pulumi/auth0";
const myHook = new auth0.Hook("my_hook", {
dependencies: {
auth0: "2.30.0",
},
enabled: true,
script: `function (user, context, callback) {
callback(null, { user });
}
`,
secrets: {
foo: "bar",
},
triggerId: "pre-user-registration",
});
resources:
myHook:
type: auth0:Hook
properties:
dependencies:
auth0: 2.30.0
enabled: true
script: |+
function (user, context, callback) {
callback(null, { user });
}
secrets:
foo: bar
triggerId: pre-user-registration
Create a Hook Resource
new Hook(name: string, args: HookArgs, opts?: CustomResourceOptions);
@overload
def Hook(resource_name: str,
opts: Optional[ResourceOptions] = None,
dependencies: Optional[Mapping[str, Any]] = None,
enabled: Optional[bool] = None,
name: Optional[str] = None,
script: Optional[str] = None,
secrets: Optional[Mapping[str, Any]] = None,
trigger_id: Optional[str] = None)
@overload
def Hook(resource_name: str,
args: HookArgs,
opts: Optional[ResourceOptions] = None)
func NewHook(ctx *Context, name string, args HookArgs, opts ...ResourceOption) (*Hook, error)
public Hook(string name, HookArgs args, CustomResourceOptions? opts = null)
type: auth0:Hook
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HookArgs
- 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 HookArgs
- 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 HookArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HookArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args HookArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Hook 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 Hook resource accepts the following input properties:
- Script string
Code to be executed when this hook runs.
- Trigger
Id string Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.- Dependencies Dictionary<string, object>
Dependencies of this hook used by the WebTask server.
- Enabled bool
Whether the hook is enabled, or disabled.
- Name string
Name of this hook.
- Secrets Dictionary<string, object>
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- Script string
Code to be executed when this hook runs.
- Trigger
Id string Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.- Dependencies map[string]interface{}
Dependencies of this hook used by the WebTask server.
- Enabled bool
Whether the hook is enabled, or disabled.
- Name string
Name of this hook.
- Secrets map[string]interface{}
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- script String
Code to be executed when this hook runs.
- trigger
Id String Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.- dependencies Map<String,Object>
Dependencies of this hook used by the WebTask server.
- enabled Boolean
Whether the hook is enabled, or disabled.
- name String
Name of this hook.
- secrets Map<String,Object>
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- script string
Code to be executed when this hook runs.
- trigger
Id string Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.- dependencies {[key: string]: any}
Dependencies of this hook used by the WebTask server.
- enabled boolean
Whether the hook is enabled, or disabled.
- name string
Name of this hook.
- secrets {[key: string]: any}
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- script str
Code to be executed when this hook runs.
- trigger_
id str Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.- dependencies Mapping[str, Any]
Dependencies of this hook used by the WebTask server.
- enabled bool
Whether the hook is enabled, or disabled.
- name str
Name of this hook.
- secrets Mapping[str, Any]
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- script String
Code to be executed when this hook runs.
- trigger
Id String Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.- dependencies Map<Any>
Dependencies of this hook used by the WebTask server.
- enabled Boolean
Whether the hook is enabled, or disabled.
- name String
Name of this hook.
- secrets Map<Any>
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
Outputs
All input properties are implicitly available as output properties. Additionally, the Hook 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 Hook Resource
Get an existing Hook 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?: HookState, opts?: CustomResourceOptions): Hook
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
dependencies: Optional[Mapping[str, Any]] = None,
enabled: Optional[bool] = None,
name: Optional[str] = None,
script: Optional[str] = None,
secrets: Optional[Mapping[str, Any]] = None,
trigger_id: Optional[str] = None) -> Hook
func GetHook(ctx *Context, name string, id IDInput, state *HookState, opts ...ResourceOption) (*Hook, error)
public static Hook Get(string name, Input<string> id, HookState? state, CustomResourceOptions? opts = null)
public static Hook get(String name, Output<String> id, HookState 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.
- Dependencies Dictionary<string, object>
Dependencies of this hook used by the WebTask server.
- Enabled bool
Whether the hook is enabled, or disabled.
- Name string
Name of this hook.
- Script string
Code to be executed when this hook runs.
- Secrets Dictionary<string, object>
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- Trigger
Id string Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.
- Dependencies map[string]interface{}
Dependencies of this hook used by the WebTask server.
- Enabled bool
Whether the hook is enabled, or disabled.
- Name string
Name of this hook.
- Script string
Code to be executed when this hook runs.
- Secrets map[string]interface{}
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- Trigger
Id string Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.
- dependencies Map<String,Object>
Dependencies of this hook used by the WebTask server.
- enabled Boolean
Whether the hook is enabled, or disabled.
- name String
Name of this hook.
- script String
Code to be executed when this hook runs.
- secrets Map<String,Object>
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- trigger
Id String Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.
- dependencies {[key: string]: any}
Dependencies of this hook used by the WebTask server.
- enabled boolean
Whether the hook is enabled, or disabled.
- name string
Name of this hook.
- script string
Code to be executed when this hook runs.
- secrets {[key: string]: any}
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- trigger
Id string Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.
- dependencies Mapping[str, Any]
Dependencies of this hook used by the WebTask server.
- enabled bool
Whether the hook is enabled, or disabled.
- name str
Name of this hook.
- script str
Code to be executed when this hook runs.
- secrets Mapping[str, Any]
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- trigger_
id str Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.
- dependencies Map<Any>
Dependencies of this hook used by the WebTask server.
- enabled Boolean
Whether the hook is enabled, or disabled.
- name String
Name of this hook.
- script String
Code to be executed when this hook runs.
- secrets Map<Any>
Map(String), sets the hook secrets associated with this hook. If specified, any secrets not listed here will be removed from the hook.
- trigger
Id String Execution stage of this rule. Can be
credentials-exchange
,pre-user-registration
,post-user-registration
,post-change-password
, orsend-phone-message
.
Import
A hook can be imported using the hook’s ID, e.g.
$ pulumi import auth0:index/hook:Hook my_hook 00001
Package Details
- Repository
- https://github.com/pulumi/pulumi-auth0
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
auth0
Terraform Provider.