kong.ConsumerJwtAuth
Explore with Pulumi AI
# kong.ConsumerJwtAuth
Consumer jwt auth is a resource that allows you to configure the jwt auth plugin 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 jwtPlugin = new kong.Plugin("jwt_plugin", {
name: "jwt",
configJson: `\x09{
\x09\x09"claims_to_verify": ["exp"]
\x09}
`,
});
const consumerJwtConfig = new kong.ConsumerJwtAuth("consumer_jwt_config", {
consumerId: myConsumer.id,
algorithm: "HS256",
key: "my_key",
rsaPublicKey: "foo",
secret: "my_secret",
});
import pulumi
import pulumi_kong as kong
my_consumer = kong.Consumer("my_consumer",
username="User1",
custom_id="123")
jwt_plugin = kong.Plugin("jwt_plugin",
name="jwt",
config_json="""\x09{
\x09\x09"claims_to_verify": ["exp"]
\x09}
""")
consumer_jwt_config = kong.ConsumerJwtAuth("consumer_jwt_config",
consumer_id=my_consumer.id,
algorithm="HS256",
key="my_key",
rsa_public_key="foo",
secret="my_secret")
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, "jwt_plugin", &kong.PluginArgs{
Name: pulumi.String("jwt"),
ConfigJson: pulumi.String(" {\n \"claims_to_verify\": [\"exp\"]\n }\n"),
})
if err != nil {
return err
}
_, err = kong.NewConsumerJwtAuth(ctx, "consumer_jwt_config", &kong.ConsumerJwtAuthArgs{
ConsumerId: myConsumer.ID(),
Algorithm: pulumi.String("HS256"),
Key: pulumi.String("my_key"),
RsaPublicKey: pulumi.String("foo"),
Secret: pulumi.String("my_secret"),
})
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 jwtPlugin = new Kong.Plugin("jwt_plugin", new()
{
Name = "jwt",
ConfigJson = @" {
""claims_to_verify"": [""exp""]
}
",
});
var consumerJwtConfig = new Kong.ConsumerJwtAuth("consumer_jwt_config", new()
{
ConsumerId = myConsumer.Id,
Algorithm = "HS256",
Key = "my_key",
RsaPublicKey = "foo",
Secret = "my_secret",
});
});
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.ConsumerJwtAuth;
import com.pulumi.kong.ConsumerJwtAuthArgs;
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 jwtPlugin = new Plugin("jwtPlugin", PluginArgs.builder()
.name("jwt")
.configJson("""
{
"claims_to_verify": ["exp"]
}
""")
.build());
var consumerJwtConfig = new ConsumerJwtAuth("consumerJwtConfig", ConsumerJwtAuthArgs.builder()
.consumerId(myConsumer.id())
.algorithm("HS256")
.key("my_key")
.rsaPublicKey("foo")
.secret("my_secret")
.build());
}
}
resources:
myConsumer:
type: kong:Consumer
name: my_consumer
properties:
username: User1
customId: '123'
jwtPlugin:
type: kong:Plugin
name: jwt_plugin
properties:
name: jwt
configJson: |
{
"claims_to_verify": ["exp"]
}
consumerJwtConfig:
type: kong:ConsumerJwtAuth
name: consumer_jwt_config
properties:
consumerId: ${myConsumer.id}
algorithm: HS256
key: my_key
rsaPublicKey: foo
secret: my_secret
Create ConsumerJwtAuth Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ConsumerJwtAuth(name: string, args: ConsumerJwtAuthArgs, opts?: CustomResourceOptions);
@overload
def ConsumerJwtAuth(resource_name: str,
args: ConsumerJwtAuthArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ConsumerJwtAuth(resource_name: str,
opts: Optional[ResourceOptions] = None,
consumer_id: Optional[str] = None,
rsa_public_key: Optional[str] = None,
algorithm: Optional[str] = None,
key: Optional[str] = None,
secret: Optional[str] = None,
tags: Optional[Sequence[str]] = None)
func NewConsumerJwtAuth(ctx *Context, name string, args ConsumerJwtAuthArgs, opts ...ResourceOption) (*ConsumerJwtAuth, error)
public ConsumerJwtAuth(string name, ConsumerJwtAuthArgs args, CustomResourceOptions? opts = null)
public ConsumerJwtAuth(String name, ConsumerJwtAuthArgs args)
public ConsumerJwtAuth(String name, ConsumerJwtAuthArgs args, CustomResourceOptions options)
type: kong:ConsumerJwtAuth
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 ConsumerJwtAuthArgs
- 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 ConsumerJwtAuthArgs
- 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 ConsumerJwtAuthArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ConsumerJwtAuthArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ConsumerJwtAuthArgs
- 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 consumerJwtAuthResource = new Kong.ConsumerJwtAuth("consumerJwtAuthResource", new()
{
ConsumerId = "string",
RsaPublicKey = "string",
Algorithm = "string",
Key = "string",
Secret = "string",
Tags = new[]
{
"string",
},
});
example, err := kong.NewConsumerJwtAuth(ctx, "consumerJwtAuthResource", &kong.ConsumerJwtAuthArgs{
ConsumerId: pulumi.String("string"),
RsaPublicKey: pulumi.String("string"),
Algorithm: pulumi.String("string"),
Key: pulumi.String("string"),
Secret: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
})
var consumerJwtAuthResource = new ConsumerJwtAuth("consumerJwtAuthResource", ConsumerJwtAuthArgs.builder()
.consumerId("string")
.rsaPublicKey("string")
.algorithm("string")
.key("string")
.secret("string")
.tags("string")
.build());
consumer_jwt_auth_resource = kong.ConsumerJwtAuth("consumerJwtAuthResource",
consumer_id="string",
rsa_public_key="string",
algorithm="string",
key="string",
secret="string",
tags=["string"])
const consumerJwtAuthResource = new kong.ConsumerJwtAuth("consumerJwtAuthResource", {
consumerId: "string",
rsaPublicKey: "string",
algorithm: "string",
key: "string",
secret: "string",
tags: ["string"],
});
type: kong:ConsumerJwtAuth
properties:
algorithm: string
consumerId: string
key: string
rsaPublicKey: string
secret: string
tags:
- string
ConsumerJwtAuth 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 ConsumerJwtAuth resource accepts the following input properties:
- Consumer
Id string - the id of the consumer to be configured with jwt auth
- Rsa
Public stringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - Algorithm string
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- Key string
- A unique string identifying the credential. If left out, it will be auto-generated.
- Secret string
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - List<string>
- A list of strings associated with the consumer JWT auth for grouping and filtering
- Consumer
Id string - the id of the consumer to be configured with jwt auth
- Rsa
Public stringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - Algorithm string
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- Key string
- A unique string identifying the credential. If left out, it will be auto-generated.
- Secret string
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - []string
- A list of strings associated with the consumer JWT auth for grouping and filtering
- consumer
Id String - the id of the consumer to be configured with jwt auth
- rsa
Public StringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - algorithm String
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- key String
- A unique string identifying the credential. If left out, it will be auto-generated.
- secret String
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - List<String>
- A list of strings associated with the consumer JWT auth for grouping and filtering
- consumer
Id string - the id of the consumer to be configured with jwt auth
- rsa
Public stringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - algorithm string
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- key string
- A unique string identifying the credential. If left out, it will be auto-generated.
- secret string
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - string[]
- A list of strings associated with the consumer JWT auth for grouping and filtering
- consumer_
id str - the id of the consumer to be configured with jwt auth
- rsa_
public_ strkey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - algorithm str
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- key str
- A unique string identifying the credential. If left out, it will be auto-generated.
- secret str
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - Sequence[str]
- A list of strings associated with the consumer JWT auth for grouping and filtering
- consumer
Id String - the id of the consumer to be configured with jwt auth
- rsa
Public StringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - algorithm String
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- key String
- A unique string identifying the credential. If left out, it will be auto-generated.
- secret String
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - List<String>
- A list of strings associated with the consumer JWT auth for grouping and filtering
Outputs
All input properties are implicitly available as output properties. Additionally, the ConsumerJwtAuth 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 ConsumerJwtAuth Resource
Get an existing ConsumerJwtAuth 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?: ConsumerJwtAuthState, opts?: CustomResourceOptions): ConsumerJwtAuth
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
algorithm: Optional[str] = None,
consumer_id: Optional[str] = None,
key: Optional[str] = None,
rsa_public_key: Optional[str] = None,
secret: Optional[str] = None,
tags: Optional[Sequence[str]] = None) -> ConsumerJwtAuth
func GetConsumerJwtAuth(ctx *Context, name string, id IDInput, state *ConsumerJwtAuthState, opts ...ResourceOption) (*ConsumerJwtAuth, error)
public static ConsumerJwtAuth Get(string name, Input<string> id, ConsumerJwtAuthState? state, CustomResourceOptions? opts = null)
public static ConsumerJwtAuth get(String name, Output<String> id, ConsumerJwtAuthState 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.
- Algorithm string
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- Consumer
Id string - the id of the consumer to be configured with jwt auth
- Key string
- A unique string identifying the credential. If left out, it will be auto-generated.
- Rsa
Public stringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - Secret string
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - List<string>
- A list of strings associated with the consumer JWT auth for grouping and filtering
- Algorithm string
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- Consumer
Id string - the id of the consumer to be configured with jwt auth
- Key string
- A unique string identifying the credential. If left out, it will be auto-generated.
- Rsa
Public stringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - Secret string
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - []string
- A list of strings associated with the consumer JWT auth for grouping and filtering
- algorithm String
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- consumer
Id String - the id of the consumer to be configured with jwt auth
- key String
- A unique string identifying the credential. If left out, it will be auto-generated.
- rsa
Public StringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - secret String
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - List<String>
- A list of strings associated with the consumer JWT auth for grouping and filtering
- algorithm string
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- consumer
Id string - the id of the consumer to be configured with jwt auth
- key string
- A unique string identifying the credential. If left out, it will be auto-generated.
- rsa
Public stringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - secret string
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - string[]
- A list of strings associated with the consumer JWT auth for grouping and filtering
- algorithm str
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- consumer_
id str - the id of the consumer to be configured with jwt auth
- key str
- A unique string identifying the credential. If left out, it will be auto-generated.
- rsa_
public_ strkey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - secret str
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - Sequence[str]
- A list of strings associated with the consumer JWT auth for grouping and filtering
- algorithm String
- The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is
HS256
- consumer
Id String - the id of the consumer to be configured with jwt auth
- key String
- A unique string identifying the credential. If left out, it will be auto-generated.
- rsa
Public StringKey - If algorithm is
RS256
orES256
, the public key (in PEM format) to use to verify the token’s signature - secret String
- If algorithm is
HS256
orES256
, the secret used to sign JWTs for this credential. If left out, will be auto-generated - List<String>
- A list of strings associated with the consumer JWT auth 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.