Mutual TLS client authenticationv1.0+

Configure the OpenID Connect plugin to use mutual TLS (mTLS) client authentication.

The following uses the password grant, but you can use any supported OpenID Connect auth method.

The configuration option config.tls_client_auth_ssl_verify controls whether the server (IdP) certificate is verified. When set to true (default), ensure that trusted certificate and verify depth are appropriately configured so that the IdP’s server certificate is trusted by Kong Gateway.

Prerequisites

  • A configured identity provider (IdP) configured with mTLS and X.509 client certificate authentication

  • A client certificate and key pair stored in a Certificate object

Environment variables

  • ISSUER: The issuer authentication URL for your IdP. For example, if you’re using Keycloak as your IdP, the issuer URL looks like this: http://localhost:8080/realms/example-realm.

  • CLIENT_ID: The client ID that the plugin uses when it calls authenticated endpoints of the IdP.

  • CERTIFICATE_ID: The UUID of a Certificate object in Kong Gateway, which contains a client cert and key pair.

  • TOKEN_SALT: A random string that decK requires (v1.59 and later) so session credentials aren’t regenerated on every sync. This parameter is optional for other formats. For example, generate one with openssl rand -base64 16.

Set up the plugin

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!