ClientGrant

Auth0 uses various grant types, or methods by which you grant limited access to your resources to another entity without exposing credentials. The OAuth 2.0 protocol supports several types of grants, which allow different types of access. This resource allows you to create and manage client grants used with configured Auth0 clients.

Example Usage

using Pulumi;
using Auth0 = Pulumi.Auth0;

class MyStack : Stack
{
    public MyStack()
    {
        var myClient = new Auth0.Client("myClient", new Auth0.ClientArgs
        {
        });
        var myResourceServer = new Auth0.ResourceServer("myResourceServer", new Auth0.ResourceServerArgs
        {
            Identifier = "https://api.example.com/client-grant",
            Scopes = 
            {
                new Auth0.Inputs.ResourceServerScopeArgs
                {
                    Description = "Create foos",
                    Value = "create:foo",
                },
                new Auth0.Inputs.ResourceServerScopeArgs
                {
                    Description = "Create bars",
                    Value = "create:bar",
                },
            },
        });
        var myClientGrant = new Auth0.ClientGrant("myClientGrant", new Auth0.ClientGrantArgs
        {
            Audience = myResourceServer.Identifier,
            ClientId = myClient.Id,
            Scopes = 
            {
                "create:foo",
            },
        });
    }

}
package main

import (
	"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 {
		myClient, err := auth0.NewClient(ctx, "myClient", nil)
		if err != nil {
			return err
		}
		myResourceServer, err := auth0.NewResourceServer(ctx, "myResourceServer", &auth0.ResourceServerArgs{
			Identifier: pulumi.String("https://api.example.com/client-grant"),
			Scopes: auth0.ResourceServerScopeArray{
				&auth0.ResourceServerScopeArgs{
					Description: pulumi.String("Create foos"),
					Value:       pulumi.String("create:foo"),
				},
				&auth0.ResourceServerScopeArgs{
					Description: pulumi.String("Create bars"),
					Value:       pulumi.String("create:bar"),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = auth0.NewClientGrant(ctx, "myClientGrant", &auth0.ClientGrantArgs{
			Audience: myResourceServer.Identifier,
			ClientId: myClient.ID(),
			Scopes: pulumi.StringArray{
				pulumi.String("create:foo"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_auth0 as auth0

my_client = auth0.Client("myClient")
my_resource_server = auth0.ResourceServer("myResourceServer",
    identifier="https://api.example.com/client-grant",
    scopes=[
        auth0.ResourceServerScopeArgs(
            description="Create foos",
            value="create:foo",
        ),
        auth0.ResourceServerScopeArgs(
            description="Create bars",
            value="create:bar",
        ),
    ])
my_client_grant = auth0.ClientGrant("myClientGrant",
    audience=my_resource_server.identifier,
    client_id=my_client.id,
    scopes=["create:foo"])
import * as pulumi from "@pulumi/pulumi";
import * as auth0 from "@pulumi/auth0";

const myClient = new auth0.Client("my_client", {});
const myResourceServer = new auth0.ResourceServer("my_resource_server", {
    identifier: "https://api.example.com/client-grant",
    scopes: [
        {
            description: "Create foos",
            value: "create:foo",
        },
        {
            description: "Create bars",
            value: "create:bar",
        },
    ],
});
const myClientGrant = new auth0.ClientGrant("my_client_grant", {
    audience: myResourceServer.identifier,
    clientId: myClient.id,
    scopes: ["create:foo"],
});

Create a ClientGrant Resource

new ClientGrant(name: string, args: ClientGrantArgs, opts?: CustomResourceOptions);
@overload
def ClientGrant(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                audience: Optional[str] = None,
                client_id: Optional[str] = None,
                scopes: Optional[Sequence[str]] = None)
@overload
def ClientGrant(resource_name: str,
                args: ClientGrantArgs,
                opts: Optional[ResourceOptions] = None)
func NewClientGrant(ctx *Context, name string, args ClientGrantArgs, opts ...ResourceOption) (*ClientGrant, error)
public ClientGrant(string name, ClientGrantArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ClientGrantArgs
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 ClientGrantArgs
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 ClientGrantArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ClientGrantArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ClientGrant Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The ClientGrant resource accepts the following input properties:

Audience string
String. Audience or API Identifier for this grant.
ClientId string
String. ID of the client for this grant.
Scopes List<string>
List(String). Permissions (scopes) included in this grant.
Audience string
String. Audience or API Identifier for this grant.
ClientId string
String. ID of the client for this grant.
Scopes []string
List(String). Permissions (scopes) included in this grant.
audience string
String. Audience or API Identifier for this grant.
clientId string
String. ID of the client for this grant.
scopes string[]
List(String). Permissions (scopes) included in this grant.
audience str
String. Audience or API Identifier for this grant.
client_id str
String. ID of the client for this grant.
scopes Sequence[str]
List(String). Permissions (scopes) included in this grant.

Outputs

All input properties are implicitly available as output properties. Additionally, the ClientGrant 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing ClientGrant Resource

Get an existing ClientGrant 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?: ClientGrantState, opts?: CustomResourceOptions): ClientGrant
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        audience: Optional[str] = None,
        client_id: Optional[str] = None,
        scopes: Optional[Sequence[str]] = None) -> ClientGrant
func GetClientGrant(ctx *Context, name string, id IDInput, state *ClientGrantState, opts ...ResourceOption) (*ClientGrant, error)
public static ClientGrant Get(string name, Input<string> id, ClientGrantState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Audience string
String. Audience or API Identifier for this grant.
ClientId string
String. ID of the client for this grant.
Scopes List<string>
List(String). Permissions (scopes) included in this grant.
Audience string
String. Audience or API Identifier for this grant.
ClientId string
String. ID of the client for this grant.
Scopes []string
List(String). Permissions (scopes) included in this grant.
audience string
String. Audience or API Identifier for this grant.
clientId string
String. ID of the client for this grant.
scopes string[]
List(String). Permissions (scopes) included in this grant.
audience str
String. Audience or API Identifier for this grant.
client_id str
String. ID of the client for this grant.
scopes Sequence[str]
List(String). Permissions (scopes) included in this grant.

Package Details

Repository
https://github.com/pulumi/pulumi-auth0
License
Apache-2.0
Notes
This Pulumi package is based on the auth0 Terraform Provider.