1. Packages
  2. Kong
  3. API Docs
  4. ConsumerOauth2
Kong v4.5.1 published on Friday, Jan 19, 2024 by Pulumi

kong.ConsumerOauth2

Explore with Pulumi AI

kong logo
Kong v4.5.1 published on Friday, Jan 19, 2024 by Pulumi

    # kong.ConsumerOauth2

    Resource that allows you to configure the OAuth2 plugin credentials for a consumer.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Kong = Pulumi.Kong;
    
    return await Deployment.RunAsync(() => 
    {
        var myConsumer = new Kong.Consumer("myConsumer", new()
        {
            CustomId = "123",
            Username = "User1",
        });
    
        var oauth2Plugin = new Kong.Plugin("oauth2Plugin", new()
        {
            ConfigJson = @"	{
    		""global_credentials"": true,
    		""enable_password_grant"": true,
    		""token_expiration"": 180,
    		""refresh_token_ttl"": 180,
    		""provision_key"": ""testprovisionkey""
    	}
    
    ",
        });
    
        var consumerOauth2 = new Kong.ConsumerOauth2("consumerOauth2", new()
        {
            ClientId = "client_id",
            ClientSecret = "client_secret",
            ConsumerId = myConsumer.Id,
            RedirectUris = new[]
            {
                "https://asdf.com/callback",
                "https://test.cl/callback",
            },
            Tags = new[]
            {
                "myTag",
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-kong/sdk/v4/go/kong"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		myConsumer, err := kong.NewConsumer(ctx, "myConsumer", &kong.ConsumerArgs{
    			CustomId: pulumi.String("123"),
    			Username: pulumi.String("User1"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kong.NewPlugin(ctx, "oauth2Plugin", &kong.PluginArgs{
    			ConfigJson: pulumi.String(`	{
    		"global_credentials": true,
    		"enable_password_grant": true,
    		"token_expiration": 180,
    		"refresh_token_ttl": 180,
    		"provision_key": "testprovisionkey"
    	}
    
    `),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kong.NewConsumerOauth2(ctx, "consumerOauth2", &kong.ConsumerOauth2Args{
    			ClientId:     pulumi.String("client_id"),
    			ClientSecret: pulumi.String("client_secret"),
    			ConsumerId:   myConsumer.ID(),
    			RedirectUris: pulumi.StringArray{
    				pulumi.String("https://asdf.com/callback"),
    				pulumi.String("https://test.cl/callback"),
    			},
    			Tags: pulumi.StringArray{
    				pulumi.String("myTag"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.kong.Consumer;
    import com.pulumi.kong.ConsumerArgs;
    import com.pulumi.kong.Plugin;
    import com.pulumi.kong.PluginArgs;
    import com.pulumi.kong.ConsumerOauth2;
    import com.pulumi.kong.ConsumerOauth2Args;
    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 myConsumer = new Consumer("myConsumer", ConsumerArgs.builder()        
                .customId("123")
                .username("User1")
                .build());
    
            var oauth2Plugin = new Plugin("oauth2Plugin", PluginArgs.builder()        
                .configJson("""
    	{
    		"global_credentials": true,
    		"enable_password_grant": true,
    		"token_expiration": 180,
    		"refresh_token_ttl": 180,
    		"provision_key": "testprovisionkey"
    	}
    
                """)
                .build());
    
            var consumerOauth2 = new ConsumerOauth2("consumerOauth2", ConsumerOauth2Args.builder()        
                .clientId("client_id")
                .clientSecret("client_secret")
                .consumerId(myConsumer.id())
                .redirectUris(            
                    "https://asdf.com/callback",
                    "https://test.cl/callback")
                .tags("myTag")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_kong as kong
    
    my_consumer = kong.Consumer("myConsumer",
        custom_id="123",
        username="User1")
    oauth2_plugin = kong.Plugin("oauth2Plugin", config_json="""	{
    		"global_credentials": true,
    		"enable_password_grant": true,
    		"token_expiration": 180,
    		"refresh_token_ttl": 180,
    		"provision_key": "testprovisionkey"
    	}
    
    """)
    consumer_oauth2 = kong.ConsumerOauth2("consumerOauth2",
        client_id="client_id",
        client_secret="client_secret",
        consumer_id=my_consumer.id,
        redirect_uris=[
            "https://asdf.com/callback",
            "https://test.cl/callback",
        ],
        tags=["myTag"])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as kong from "@pulumi/kong";
    
    const myConsumer = new kong.Consumer("myConsumer", {
        customId: "123",
        username: "User1",
    });
    const oauth2Plugin = new kong.Plugin("oauth2Plugin", {configJson: `	{
    		"global_credentials": true,
    		"enable_password_grant": true,
    		"token_expiration": 180,
    		"refresh_token_ttl": 180,
    		"provision_key": "testprovisionkey"
    	}
    
    `});
    const consumerOauth2 = new kong.ConsumerOauth2("consumerOauth2", {
        clientId: "client_id",
        clientSecret: "client_secret",
        consumerId: myConsumer.id,
        redirectUris: [
            "https://asdf.com/callback",
            "https://test.cl/callback",
        ],
        tags: ["myTag"],
    });
    
    resources:
      myConsumer:
        type: kong:Consumer
        properties:
          customId: '123'
          username: User1
      oauth2Plugin:
        type: kong:Plugin
        properties:
          configJson: |+
            	{
            		"global_credentials": true,
            		"enable_password_grant": true,
            		"token_expiration": 180,
            		"refresh_token_ttl": 180,
            		"provision_key": "testprovisionkey"
            	}        
    
      consumerOauth2:
        type: kong:ConsumerOauth2
        properties:
          clientId: client_id
          clientSecret: client_secret
          consumerId: ${myConsumer.id}
          redirectUris:
            - https://asdf.com/callback
            - https://test.cl/callback
          tags:
            - myTag
    

    Create ConsumerOauth2 Resource

    new ConsumerOauth2(name: string, args: ConsumerOauth2Args, opts?: CustomResourceOptions);
    @overload
    def ConsumerOauth2(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       client_id: Optional[str] = None,
                       client_secret: Optional[str] = None,
                       consumer_id: Optional[str] = None,
                       hash_secret: Optional[bool] = None,
                       name: Optional[str] = None,
                       redirect_uris: Optional[Sequence[str]] = None,
                       tags: Optional[Sequence[str]] = None)
    @overload
    def ConsumerOauth2(resource_name: str,
                       args: ConsumerOauth2Args,
                       opts: Optional[ResourceOptions] = None)
    func NewConsumerOauth2(ctx *Context, name string, args ConsumerOauth2Args, opts ...ResourceOption) (*ConsumerOauth2, error)
    public ConsumerOauth2(string name, ConsumerOauth2Args args, CustomResourceOptions? opts = null)
    public ConsumerOauth2(String name, ConsumerOauth2Args args)
    public ConsumerOauth2(String name, ConsumerOauth2Args args, CustomResourceOptions options)
    
    type: kong:ConsumerOauth2
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args ConsumerOauth2Args
    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 ConsumerOauth2Args
    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 ConsumerOauth2Args
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ConsumerOauth2Args
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ConsumerOauth2Args
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    ConsumerOauth2 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 ConsumerOauth2 resource accepts the following input properties:

    ConsumerId string
    The id of the consumer to be configured with oauth2.
    RedirectUris List<string>
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    ClientId string
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    ClientSecret string
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    HashSecret bool
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    Name string
    The name associated with the credential.
    Tags List<string>
    A list of strings associated with the consumer for grouping and filtering.
    ConsumerId string
    The id of the consumer to be configured with oauth2.
    RedirectUris []string
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    ClientId string
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    ClientSecret string
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    HashSecret bool
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    Name string
    The name associated with the credential.
    Tags []string
    A list of strings associated with the consumer for grouping and filtering.
    consumerId String
    The id of the consumer to be configured with oauth2.
    redirectUris List<String>
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    clientId String
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    clientSecret String
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    hashSecret Boolean
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    name String
    The name associated with the credential.
    tags List<String>
    A list of strings associated with the consumer for grouping and filtering.
    consumerId string
    The id of the consumer to be configured with oauth2.
    redirectUris string[]
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    clientId string
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    clientSecret string
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    hashSecret boolean
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    name string
    The name associated with the credential.
    tags string[]
    A list of strings associated with the consumer for grouping and filtering.
    consumer_id str
    The id of the consumer to be configured with oauth2.
    redirect_uris Sequence[str]
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    client_id str
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    client_secret str
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    hash_secret bool
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    name str
    The name associated with the credential.
    tags Sequence[str]
    A list of strings associated with the consumer for grouping and filtering.
    consumerId String
    The id of the consumer to be configured with oauth2.
    redirectUris List<String>
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    clientId String
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    clientSecret String
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    hashSecret Boolean
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    name String
    The name associated with the credential.
    tags List<String>
    A list of strings associated with the consumer for grouping and filtering.

    Outputs

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

    Get an existing ConsumerOauth2 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?: ConsumerOauth2State, opts?: CustomResourceOptions): ConsumerOauth2
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            client_id: Optional[str] = None,
            client_secret: Optional[str] = None,
            consumer_id: Optional[str] = None,
            hash_secret: Optional[bool] = None,
            name: Optional[str] = None,
            redirect_uris: Optional[Sequence[str]] = None,
            tags: Optional[Sequence[str]] = None) -> ConsumerOauth2
    func GetConsumerOauth2(ctx *Context, name string, id IDInput, state *ConsumerOauth2State, opts ...ResourceOption) (*ConsumerOauth2, error)
    public static ConsumerOauth2 Get(string name, Input<string> id, ConsumerOauth2State? state, CustomResourceOptions? opts = null)
    public static ConsumerOauth2 get(String name, Output<String> id, ConsumerOauth2State 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.
    The following state arguments are supported:
    ClientId string
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    ClientSecret string
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    ConsumerId string
    The id of the consumer to be configured with oauth2.
    HashSecret bool
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    Name string
    The name associated with the credential.
    RedirectUris List<string>
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    Tags List<string>
    A list of strings associated with the consumer for grouping and filtering.
    ClientId string
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    ClientSecret string
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    ConsumerId string
    The id of the consumer to be configured with oauth2.
    HashSecret bool
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    Name string
    The name associated with the credential.
    RedirectUris []string
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    Tags []string
    A list of strings associated with the consumer for grouping and filtering.
    clientId String
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    clientSecret String
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    consumerId String
    The id of the consumer to be configured with oauth2.
    hashSecret Boolean
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    name String
    The name associated with the credential.
    redirectUris List<String>
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    tags List<String>
    A list of strings associated with the consumer for grouping and filtering.
    clientId string
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    clientSecret string
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    consumerId string
    The id of the consumer to be configured with oauth2.
    hashSecret boolean
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    name string
    The name associated with the credential.
    redirectUris string[]
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    tags string[]
    A list of strings associated with the consumer for grouping and filtering.
    client_id str
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    client_secret str
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    consumer_id str
    The id of the consumer to be configured with oauth2.
    hash_secret bool
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    name str
    The name associated with the credential.
    redirect_uris Sequence[str]
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    tags Sequence[str]
    A list of strings associated with the consumer for grouping and filtering.
    clientId String
    Unique oauth2 client id. If not set, the oauth2 plugin will generate one
    clientSecret String
    Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
    consumerId String
    The id of the consumer to be configured with oauth2.
    hashSecret Boolean
    A boolean flag that indicates whether the client_secret field will be stored in hashed form. If enabled on existing plugin instances, client secrets are hashed on the fly upon first usage. Default: false.
    name String
    The name associated with the credential.
    redirectUris List<String>
    An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
    tags List<String>
    A list of strings associated with the consumer for grouping and filtering.

    Package Details

    Repository
    Kong pulumi/pulumi-kong
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the kong Terraform Provider.
    kong logo
    Kong v4.5.1 published on Friday, Jan 19, 2024 by Pulumi