Role

With this resource, you can created and manage collections of permissions that can be assigned to users, which are otherwise known as roles. Permissions (scopes) are created on auth0_resource_server, then associated with roles and optionally, users using this resource.

Example Usage

using Pulumi;
using Auth0 = Pulumi.Auth0;

class MyStack : Stack
{
    public MyStack()
    {
        var myResourceServer = new Auth0.ResourceServer("myResourceServer", new Auth0.ResourceServerArgs
        {
            EnforcePolicies = true,
            Identifier = "my-resource-server-identifier",
            Scopes = 
            {
                new Auth0.Inputs.ResourceServerScopeArgs
                {
                    Description = "read something",
                    Value = "read:something",
                },
            },
            SigningAlg = "RS256",
            SkipConsentForVerifiableFirstPartyClients = true,
            TokenLifetime = 86400,
        });
        var myRole = new Auth0.Role("myRole", new Auth0.RoleArgs
        {
            Description = "Role Description...",
            Permissions = 
            {
                new Auth0.Inputs.RolePermissionArgs
                {
                    Name = "read:something",
                    ResourceServerIdentifier = myResourceServer.Identifier,
                },
            },
        });
        var myUser = new Auth0.User("myUser", new Auth0.UserArgs
        {
            ConnectionName = "Username-Password-Authentication",
            Email = "test@test.com",
            Nickname = "testnick",
            Password = "passpass$$12$$12",
            Roles = 
            {
                myRole.Id,
            },
            UserId = "auth0|1234567890",
            Username = "testnick",
        });
    }

}

Coming soon!

import pulumi
import pulumi_auth0 as auth0

my_resource_server = auth0.ResourceServer("myResourceServer",
    enforce_policies=True,
    identifier="my-resource-server-identifier",
    scopes=[{
        "description": "read something",
        "value": "read:something",
    }],
    signing_alg="RS256",
    skip_consent_for_verifiable_first_party_clients=True,
    token_lifetime=86400)
my_role = auth0.Role("myRole",
    description="Role Description...",
    permissions=[{
        "name": "read:something",
        "resourceServerIdentifier": my_resource_server.identifier,
    }])
my_user = auth0.User("myUser",
    connection_name="Username-Password-Authentication",
    email="test@test.com",
    nickname="testnick",
    password="passpass$$12$$12",
    roles=[my_role.id],
    user_id="auth0|1234567890",
    username="testnick")
import * as pulumi from "@pulumi/pulumi";
import * as auth0 from "@pulumi/auth0";

const myResourceServer = new auth0.ResourceServer("my_resource_server", {
    enforcePolicies: true,
    identifier: "my-resource-server-identifier",
    scopes: [{
        description: "read something",
        value: "read:something",
    }],
    signingAlg: "RS256",
    skipConsentForVerifiableFirstPartyClients: true,
    tokenLifetime: 86400,
});
const myRole = new auth0.Role("my_role", {
    description: "Role Description...",
    permissions: [{
        name: "read:something",
        resourceServerIdentifier: myResourceServer.identifier,
    }],
});
const myUser = new auth0.User("my_user", {
    connectionName: "Username-Password-Authentication",
    email: "test@test.com",
    nickname: "testnick",
    password: "passpass$12$12",
    roles: [myRole.id],
    userId: "auth0|1234567890",
    username: "testnick",
});

Create a Role Resource

new Role(name: string, args?: RoleArgs, opts?: CustomResourceOptions);
def Role(resource_name, opts=None, description=None, name=None, permissions=None, __props__=None);
func NewRole(ctx *Context, name string, args *RoleArgs, opts ...ResourceOption) (*Role, error)
public Role(string name, RoleArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args RoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args RoleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Role Resource Properties

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

Inputs

The Role resource accepts the following input properties:

Description string

String. Description of the role.

Name string

String. Name for this role.

Permissions List<RolePermissionArgs>

Set(Resource). Configuration settings for permissions (scopes) attached to the role. For details, see Permissions.

Description string

String. Description of the role.

Name string

String. Name for this role.

Permissions []RolePermission

Set(Resource). Configuration settings for permissions (scopes) attached to the role. For details, see Permissions.

description string

String. Description of the role.

name string

String. Name for this role.

permissions RolePermission[]

Set(Resource). Configuration settings for permissions (scopes) attached to the role. For details, see Permissions.

description str

String. Description of the role.

name str

String. Name for this role.

permissions List[RolePermission]

Set(Resource). Configuration settings for permissions (scopes) attached to the role. For details, see Permissions.

Outputs

All input properties are implicitly available as output properties. Additionally, the Role 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 Role Resource

Get an existing Role 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?: RoleState, opts?: CustomResourceOptions): Role
static get(resource_name, id, opts=None, description=None, name=None, permissions=None, __props__=None);
func GetRole(ctx *Context, name string, id IDInput, state *RoleState, opts ...ResourceOption) (*Role, error)
public static Role Get(string name, Input<string> id, RoleState? 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:

Description string

String. Description of the role.

Name string

String. Name for this role.

Permissions List<RolePermissionArgs>

Set(Resource). Configuration settings for permissions (scopes) attached to the role. For details, see Permissions.

Description string

String. Description of the role.

Name string

String. Name for this role.

Permissions []RolePermission

Set(Resource). Configuration settings for permissions (scopes) attached to the role. For details, see Permissions.

description string

String. Description of the role.

name string

String. Name for this role.

permissions RolePermission[]

Set(Resource). Configuration settings for permissions (scopes) attached to the role. For details, see Permissions.

description str

String. Description of the role.

name str

String. Name for this role.

permissions List[RolePermission]

Set(Resource). Configuration settings for permissions (scopes) attached to the role. For details, see Permissions.

Supporting Types

RolePermission

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string

String. Name of the permission (scope).

ResourceServerIdentifier string

String. Unique identifier for the resource server.

Name string

String. Name of the permission (scope).

ResourceServerIdentifier string

String. Unique identifier for the resource server.

name string

String. Name of the permission (scope).

resourceServerIdentifier string

String. Unique identifier for the resource server.

name str

String. Name of the permission (scope).

resourceServerIdentifier str

String. Unique identifier for the resource server.

Package Details

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