kong.ConsumerOauth2
Explore with Pulumi AI
# kong.ConsumerOauth2
Resource that allows you to configure the OAuth2 plugin credentials for a consumer.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as kong from "@pulumi/kong";
const myConsumer = new kong.Consumer("my_consumer", {
username: "User1",
customId: "123",
});
const oauth2Plugin = new kong.Plugin("oauth2_plugin", {
name: "oauth2",
configJson: `\x09{
\x09\x09"global_credentials": true,
\x09\x09"enable_password_grant": true,
\x09\x09"token_expiration": 180,
\x09\x09"refresh_token_ttl": 180,
\x09\x09"provision_key": "testprovisionkey"
\x09}
`,
});
const consumerOauth2 = new kong.ConsumerOauth2("consumer_oauth2", {
name: "test_application",
consumerId: myConsumer.id,
clientId: "client_id",
clientSecret: "client_secret",
redirectUris: [
"https://asdf.com/callback",
"https://test.cl/callback",
],
tags: ["myTag"],
});
import pulumi
import pulumi_kong as kong
my_consumer = kong.Consumer("my_consumer",
username="User1",
custom_id="123")
oauth2_plugin = kong.Plugin("oauth2_plugin",
name="oauth2",
config_json="""\x09{
\x09\x09"global_credentials": true,
\x09\x09"enable_password_grant": true,
\x09\x09"token_expiration": 180,
\x09\x09"refresh_token_ttl": 180,
\x09\x09"provision_key": "testprovisionkey"
\x09}
""")
consumer_oauth2 = kong.ConsumerOauth2("consumer_oauth2",
name="test_application",
consumer_id=my_consumer.id,
client_id="client_id",
client_secret="client_secret",
redirect_uris=[
"https://asdf.com/callback",
"https://test.cl/callback",
],
tags=["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, "my_consumer", &kong.ConsumerArgs{
Username: pulumi.String("User1"),
CustomId: pulumi.String("123"),
})
if err != nil {
return err
}
_, err = kong.NewPlugin(ctx, "oauth2_plugin", &kong.PluginArgs{
Name: pulumi.String("oauth2"),
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, "consumer_oauth2", &kong.ConsumerOauth2Args{
Name: pulumi.String("test_application"),
ConsumerId: myConsumer.ID(),
ClientId: pulumi.String("client_id"),
ClientSecret: pulumi.String("client_secret"),
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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Kong = Pulumi.Kong;
return await Deployment.RunAsync(() =>
{
var myConsumer = new Kong.Consumer("my_consumer", new()
{
Username = "User1",
CustomId = "123",
});
var oauth2Plugin = new Kong.Plugin("oauth2_plugin", new()
{
Name = "oauth2",
ConfigJson = @" {
""global_credentials"": true,
""enable_password_grant"": true,
""token_expiration"": 180,
""refresh_token_ttl"": 180,
""provision_key"": ""testprovisionkey""
}
",
});
var consumerOauth2 = new Kong.ConsumerOauth2("consumer_oauth2", new()
{
Name = "test_application",
ConsumerId = myConsumer.Id,
ClientId = "client_id",
ClientSecret = "client_secret",
RedirectUris = new[]
{
"https://asdf.com/callback",
"https://test.cl/callback",
},
Tags = new[]
{
"myTag",
},
});
});
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()
.username("User1")
.customId("123")
.build());
var oauth2Plugin = new Plugin("oauth2Plugin", PluginArgs.builder()
.name("oauth2")
.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()
.name("test_application")
.consumerId(myConsumer.id())
.clientId("client_id")
.clientSecret("client_secret")
.redirectUris(
"https://asdf.com/callback",
"https://test.cl/callback")
.tags("myTag")
.build());
}
}
resources:
myConsumer:
type: kong:Consumer
name: my_consumer
properties:
username: User1
customId: '123'
oauth2Plugin:
type: kong:Plugin
name: oauth2_plugin
properties:
name: oauth2
configJson: |
{
"global_credentials": true,
"enable_password_grant": true,
"token_expiration": 180,
"refresh_token_ttl": 180,
"provision_key": "testprovisionkey"
}
consumerOauth2:
type: kong:ConsumerOauth2
name: consumer_oauth2
properties:
name: test_application
consumerId: ${myConsumer.id}
clientId: client_id
clientSecret: client_secret
redirectUris:
- https://asdf.com/callback
- https://test.cl/callback
tags:
- myTag
Create ConsumerOauth2 Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ConsumerOauth2(name: string, args: ConsumerOauth2Args, opts?: CustomResourceOptions);
@overload
def ConsumerOauth2(resource_name: str,
args: ConsumerOauth2Args,
opts: Optional[ResourceOptions] = None)
@overload
def ConsumerOauth2(resource_name: str,
opts: Optional[ResourceOptions] = None,
consumer_id: Optional[str] = None,
redirect_uris: Optional[Sequence[str]] = None,
client_id: Optional[str] = None,
client_secret: Optional[str] = None,
hash_secret: Optional[bool] = None,
name: Optional[str] = None,
tags: Optional[Sequence[str]] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var consumerOauth2Resource = new Kong.ConsumerOauth2("consumerOauth2Resource", new()
{
ConsumerId = "string",
RedirectUris = new[]
{
"string",
},
ClientId = "string",
ClientSecret = "string",
HashSecret = false,
Name = "string",
Tags = new[]
{
"string",
},
});
example, err := kong.NewConsumerOauth2(ctx, "consumerOauth2Resource", &kong.ConsumerOauth2Args{
ConsumerId: pulumi.String("string"),
RedirectUris: pulumi.StringArray{
pulumi.String("string"),
},
ClientId: pulumi.String("string"),
ClientSecret: pulumi.String("string"),
HashSecret: pulumi.Bool(false),
Name: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
})
var consumerOauth2Resource = new ConsumerOauth2("consumerOauth2Resource", ConsumerOauth2Args.builder()
.consumerId("string")
.redirectUris("string")
.clientId("string")
.clientSecret("string")
.hashSecret(false)
.name("string")
.tags("string")
.build());
consumer_oauth2_resource = kong.ConsumerOauth2("consumerOauth2Resource",
consumer_id="string",
redirect_uris=["string"],
client_id="string",
client_secret="string",
hash_secret=False,
name="string",
tags=["string"])
const consumerOauth2Resource = new kong.ConsumerOauth2("consumerOauth2Resource", {
consumerId: "string",
redirectUris: ["string"],
clientId: "string",
clientSecret: "string",
hashSecret: false,
name: "string",
tags: ["string"],
});
type: kong:ConsumerOauth2
properties:
clientId: string
clientSecret: string
consumerId: string
hashSecret: false
name: string
redirectUris:
- string
tags:
- string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ConsumerOauth2 resource accepts the following input properties:
- Consumer
Id string - The id of the consumer to be configured with oauth2.
- Redirect
Uris 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).
- Client
Id string - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- Client
Secret string - 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 string
- The name associated with the credential.
- List<string>
- A list of strings associated with the consumer for grouping and filtering.
- Consumer
Id string - The id of the consumer to be configured with oauth2.
- Redirect
Uris []string - 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 string - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- Client
Secret string - 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 string
- The name associated with the credential.
- []string
- A list of strings associated with the consumer for grouping and filtering.
- consumer
Id String - The id of the consumer to be configured with oauth2.
- redirect
Uris 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).
- client
Id String - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- client
Secret String - Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
- hash
Secret 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.
- List<String>
- A list of strings associated with the consumer for grouping and filtering.
- consumer
Id string - The id of the consumer to be configured with oauth2.
- redirect
Uris string[] - 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 string - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- client
Secret string - Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
- hash
Secret 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.
- 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.
- Sequence[str]
- A list of strings associated with the consumer for grouping and filtering.
- consumer
Id String - The id of the consumer to be configured with oauth2.
- redirect
Uris 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).
- client
Id String - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- client
Secret String - Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
- hash
Secret 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.
- 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.
- Client
Id string - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- Client
Secret string - Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
- Consumer
Id string - 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 string
- The name associated with the credential.
- Redirect
Uris 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).
- List<string>
- A list of strings associated with the consumer for grouping and filtering.
- Client
Id string - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- Client
Secret string - Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
- Consumer
Id string - 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 string
- The name associated with the credential.
- Redirect
Uris []string - An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
- []string
- A list of strings associated with the consumer for grouping and filtering.
- client
Id String - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- client
Secret String - Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
- consumer
Id String - The id of the consumer to be configured with oauth2.
- hash
Secret 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.
- redirect
Uris 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).
- List<String>
- A list of strings associated with the consumer for grouping and filtering.
- client
Id string - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- client
Secret string - Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
- consumer
Id string - The id of the consumer to be configured with oauth2.
- hash
Secret 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.
- redirect
Uris string[] - An array with one or more URLs in your app where users will be sent after authorization (RFC 6742 Section 3.1.2).
- 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).
- Sequence[str]
- A list of strings associated with the consumer for grouping and filtering.
- client
Id String - Unique oauth2 client id. If not set, the oauth2 plugin will generate one
- client
Secret String - Unique oauth2 client secret. If not set, the oauth2 plugin will generate one
- consumer
Id String - The id of the consumer to be configured with oauth2.
- hash
Secret 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.
- redirect
Uris 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).
- 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.