Skip to main content

OpenID Connect Authentication

OpenID Connect Authentication is built on top of the OAuth2 Authorization Code Flow (defined in OAuth 2.0 RFC 6749, section 4.1). It allows an application to be secured by delegating authentication to an external provider (Keycloak, Okta etc.) and obtaining the end user's session claims and scopes for authorization purposes.

To authenticate the user, the middleware redirects through the authentication provider. Once the authentication is complete, users are redirected back to the middleware before being authorized to access the upstream application, as described in the diagram below:


To allow the OAuth2 Client Credential Middleware to use the credentials provided by the requests, apply the following configuration:

---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: oidc-login
namespace: apps
spec:
plugin:
oidc:
issuer: MY_ISSUER_URL
clientId: "urn:k8s:secret:oidc-client:client_id"
clientSecret: "urn:k8s:secret:oidc-client:client_secret"
redirectUrl: /oidc/callback
Advanced Configuration

Advanced options are described in the reference page.

For example, you can find how to customize the session storage: