1. Packages
  2. Kong
  3. API Docs
  4. ConsumerJwtAuth
Kong v4.5.2 published on Thursday, Mar 21, 2024 by Pulumi

kong.ConsumerJwtAuth

Explore with Pulumi AI

kong logo
Kong v4.5.2 published on Thursday, Mar 21, 2024 by Pulumi

    # 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("myConsumer", {
        customId: "123",
        username: "User1",
    });
    const jwtPlugin = new kong.Plugin("jwtPlugin", {configJson: `	{
    		"claims_to_verify": ["exp"]
    	}
    
    `});
    const consumerJwtConfig = new kong.ConsumerJwtAuth("consumerJwtConfig", {
        algorithm: "HS256",
        consumerId: myConsumer.id,
        key: "my_key",
        rsaPublicKey: "foo",
        secret: "my_secret",
    });
    
    import pulumi
    import pulumi_kong as kong
    
    my_consumer = kong.Consumer("myConsumer",
        custom_id="123",
        username="User1")
    jwt_plugin = kong.Plugin("jwtPlugin", config_json="""	{
    		"claims_to_verify": ["exp"]
    	}
    
    """)
    consumer_jwt_config = kong.ConsumerJwtAuth("consumerJwtConfig",
        algorithm="HS256",
        consumer_id=my_consumer.id,
        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, "myConsumer", &kong.ConsumerArgs{
    			CustomId: pulumi.String("123"),
    			Username: pulumi.String("User1"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kong.NewPlugin(ctx, "jwtPlugin", &kong.PluginArgs{
    			ConfigJson: pulumi.String("	{\n		\"claims_to_verify\": [\"exp\"]\n	}\n\n"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = kong.NewConsumerJwtAuth(ctx, "consumerJwtConfig", &kong.ConsumerJwtAuthArgs{
    			Algorithm:    pulumi.String("HS256"),
    			ConsumerId:   myConsumer.ID(),
    			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("myConsumer", new()
        {
            CustomId = "123",
            Username = "User1",
        });
    
        var jwtPlugin = new Kong.Plugin("jwtPlugin", new()
        {
            ConfigJson = @"	{
    		""claims_to_verify"": [""exp""]
    	}
    
    ",
        });
    
        var consumerJwtConfig = new Kong.ConsumerJwtAuth("consumerJwtConfig", new()
        {
            Algorithm = "HS256",
            ConsumerId = myConsumer.Id,
            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()        
                .customId("123")
                .username("User1")
                .build());
    
            var jwtPlugin = new Plugin("jwtPlugin", PluginArgs.builder()        
                .configJson("""
    	{
    		"claims_to_verify": ["exp"]
    	}
    
                """)
                .build());
    
            var consumerJwtConfig = new ConsumerJwtAuth("consumerJwtConfig", ConsumerJwtAuthArgs.builder()        
                .algorithm("HS256")
                .consumerId(myConsumer.id())
                .key("my_key")
                .rsaPublicKey("foo")
                .secret("my_secret")
                .build());
    
        }
    }
    
    resources:
      myConsumer:
        type: kong:Consumer
        properties:
          customId: '123'
          username: User1
      jwtPlugin:
        type: kong:Plugin
        properties:
          configJson: |+
            	{
            		"claims_to_verify": ["exp"]
            	}        
    
      consumerJwtConfig:
        type: kong:ConsumerJwtAuth
        properties:
          algorithm: HS256
          consumerId: ${myConsumer.id}
          key: my_key
          rsaPublicKey: foo
          secret: my_secret
    

    Create ConsumerJwtAuth Resource

    new ConsumerJwtAuth(name: string, args: ConsumerJwtAuthArgs, opts?: CustomResourceOptions);
    @overload
    def ConsumerJwtAuth(resource_name: 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)
    @overload
    def ConsumerJwtAuth(resource_name: str,
                        args: ConsumerJwtAuthArgs,
                        opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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

    The ConsumerJwtAuth resource accepts the following input properties:

    ConsumerId string
    the id of the consumer to be configured with jwt auth
    RsaPublicKey string
    If algorithm is RS256 or ES256, 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 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    Tags List<string>
    A list of strings associated with the consumer JWT auth for grouping and filtering
    ConsumerId string
    the id of the consumer to be configured with jwt auth
    RsaPublicKey string
    If algorithm is RS256 or ES256, 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 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    Tags []string
    A list of strings associated with the consumer JWT auth for grouping and filtering
    consumerId String
    the id of the consumer to be configured with jwt auth
    rsaPublicKey String
    If algorithm is RS256 or ES256, 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 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    tags List<String>
    A list of strings associated with the consumer JWT auth for grouping and filtering
    consumerId string
    the id of the consumer to be configured with jwt auth
    rsaPublicKey string
    If algorithm is RS256 or ES256, 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 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    tags 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_key str
    If algorithm is RS256 or ES256, 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 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    tags Sequence[str]
    A list of strings associated with the consumer JWT auth for grouping and filtering
    consumerId String
    the id of the consumer to be configured with jwt auth
    rsaPublicKey String
    If algorithm is RS256 or ES256, 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 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    tags 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.
    The following state arguments are supported:
    Algorithm string
    The algorithm used to verify the token’s signature. Can be HS256, HS384, HS512, RS256, or ES256, Default is HS256
    ConsumerId 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.
    RsaPublicKey string
    If algorithm is RS256 or ES256, the public key (in PEM format) to use to verify the token’s signature
    Secret string
    If algorithm is HS256 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    Tags 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
    ConsumerId 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.
    RsaPublicKey string
    If algorithm is RS256 or ES256, the public key (in PEM format) to use to verify the token’s signature
    Secret string
    If algorithm is HS256 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    Tags []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
    consumerId 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.
    rsaPublicKey String
    If algorithm is RS256 or ES256, the public key (in PEM format) to use to verify the token’s signature
    secret String
    If algorithm is HS256 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    tags 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
    consumerId 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.
    rsaPublicKey string
    If algorithm is RS256 or ES256, the public key (in PEM format) to use to verify the token’s signature
    secret string
    If algorithm is HS256 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    tags 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_key str
    If algorithm is RS256 or ES256, the public key (in PEM format) to use to verify the token’s signature
    secret str
    If algorithm is HS256 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    tags 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
    consumerId 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.
    rsaPublicKey String
    If algorithm is RS256 or ES256, the public key (in PEM format) to use to verify the token’s signature
    secret String
    If algorithm is HS256 or ES256, the secret used to sign JWTs for this credential. If left out, will be auto-generated
    tags 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.
    kong logo
    Kong v4.5.2 published on Thursday, Mar 21, 2024 by Pulumi