Open ID Connect security provider

Config key
oidc

This type provides the following service implementations:

  • io.helidon.security.spi.AuthenticationProvider

  • io.helidon.security.spi.SecurityProvider

Configuration options

Table 1. Optional configuration options
key type default value description

access-token-ip-check

boolean

true

Whether to check if current IP address matches the one access token was issued for. This check helps with cookie replay attack prevention.

audience

string

 

Audience of issued tokens.

authorization-endpoint-uri

URI

 

URI of an authorization endpoint used to redirect users to for logging-in.

If not defined, it is obtained from oidcMetadata(Resource), if that is not defined an attempt is made to use identityUri(URI)/oauth2/v1/authorize.

base-scopes

string

openid

Configure base scopes. By default, this is DEFAULT_BASE_SCOPES. If scope has a qualifier, it must be used here.

check-audience

boolean

true

Configure audience claim check.

client-credentials-config

 

Set the configuration related to the client credentials flow.

client-id

string

 

Client ID as generated by OIDC server.

client-secret

string

 

Client secret as generated by OIDC server. Used to authenticate this application with the server when requesting JWT based on a code.

client-timeout-millis

Duration

30000

Timeout of calls using web client.

cookie-domain

string

 

Domain the cookie is valid for. Not used by default.

cookie-encryption-enabled

boolean

false

Whether to encrypt token cookie created by this microservice. Defaults to false.

cookie-encryption-id-enabled

boolean

true

Whether to encrypt id token cookie created by this microservice. Defaults to true.

cookie-encryption-name

string

 

Name of the encryption configuration available through Security.encrypt(String, byte[]) and Security.decrypt(String, String). If configured and encryption is enabled for any cookie, Security MUST be configured in global or current io.helidon.common.context.Context (this is done automatically in Helidon MP).

cookie-encryption-password

char[]

 

Master password for encryption/decryption of cookies. This must be configured to the same value on each microservice using the cookie.

cookie-encryption-refresh-enabled

boolean

true

Whether to encrypt refresh token cookie created by this microservice. Defaults to true.

cookie-encryption-state-enabled

boolean

true

Whether to encrypt state cookie created by this microservice. Defaults to true.

cookie-encryption-tenant-enabled

boolean

true

Whether to encrypt tenant name cookie created by this microservice. Defaults to true.

cookie-http-only

boolean

true

When using cookie, if set to true, the HttpOnly attribute will be configured. Defaults to OidcCookieHandler.Builder.DEFAULT_HTTP_ONLY.

cookie-max-age-seconds

long

 

When using cookie, used to set MaxAge attribute of the cookie, defining how long the cookie is valid. Not used by default.

cookie-name

string

JSESSIONID

Name of the cookie to use. Defaults to DEFAULT_COOKIE_NAME.

cookie-name-id-token

string

JSESSIONID_2

Name of the cookie to use for id token. Defaults to DEFAULT_COOKIE_NAME_2.

This cookie is only used when logout is enabled, as otherwise it is not needed. Content of this cookie is encrypted.

cookie-name-refresh-token

string

JSESSIONID_3

The name of the cookie to use for the refresh token. Defaults to DEFAULT_REFRESH_COOKIE_NAME.

cookie-name-state

string

JSESSIONID_3

The name of the cookie to use for the state storage. Defaults to DEFAULT_STATE_COOKIE_NAME.

cookie-name-tenant

string

HELIDON_TENANT

The name of the cookie to use for the tenant name. Defaults to DEFAULT_TENANT_COOKIE_NAME.

cookie-path

string

/

Path the cookie is valid for. Defaults to "/".

cookie-same-site

SameSite (LAX, STRICT, NONE)

LAX

When using cookie, used to set the SameSite cookie value. Can be "Strict" or "Lax".

cookie-secure

boolean

false

When using cookie, if set to true, the Secure attribute will be configured. Defaults to false.

cookie-use

boolean

true

Whether to use cookie to store JWT between requests. Defaults to DEFAULT_COOKIE_USE.

cors

 

Assign cross-origin resource sharing settings.

force-https-redirects

boolean

false

Force HTTPS for redirects to identity provider. Defaults to false.

frontend-uri

string

 

Full URI of this application that is visible from user browser. Used to redirect request back from identity server after successful login.

header-token

 

A TokenHandler to process header containing a JWT. Default is "Authorization" header with a prefix "bearer ".

header-use

boolean

true

Whether to expect JWT in a header field.

id-token-signature-validation

boolean

true

Whether id token signature check should be enabled. Signature check is enabled by default, and it is highly recommended to not change that. Change this setting only when you really know what you are doing, otherwise it could case security issues.

identity-uri

URI

 

URI of the identity server, base used to retrieve OIDC metadata.

introspect-endpoint-uri

URI

 

Endpoint to use to validate JWT. Either use this or set signJwk(JwkKeys) or signJwk(Resource).

issuer

string

 

Issuer of issued tokens.

max-redirects

int

5

Configure maximal number of redirects when redirecting to an OIDC provider within a single authentication attempt.

Defaults to DEFAULT_MAX_REDIRECTS

oidc-metadata-well-known

boolean

true

If set to true, metadata will be loaded from default (well known) location, unless it is explicitly defined using oidc-metadata-resource. If set to false, it would not be loaded even if oidc-metadata-resource is not defined. In such a case all URIs must be explicitly defined (e.g. token-endpoint-uri).

oidc-metadata.resource

 

Resource configuration for OIDC Metadata containing endpoints to various identity services, as well as information about the identity server.

optional

boolean

false

Whether authentication is required. By default, request will fail if the authentication cannot be verified. If set to true, request will process and this provider will abstain.

optional-audience

boolean

false

Allow audience claim to be optional.

outbound

 

Add a new target configuration.

pkce-challenge-method

PkceChallengeMethod (PLAIN, S256)

S256

Proof Key Code Exchange (PKCE) challenge creation method. Default value is PkceChallengeMethod.S256.

Allowed values:

  • PLAIN: No hashing will be applied. Challenge string will be the same as verifier.

  • S256: SHA-256 algorithm is used to hash the verifier value.

pkce-enabled

boolean

false

Whether this provider should support PKCE. Default value is false.

propagate

boolean

false

Whether to propagate identity.

proxy-host

string

 

Deprecated Proxy host to use. When defined, triggers usage of proxy for HTTP requests. Setting to empty String has the same meaning as setting to null - disables proxy.

proxy-port

int

80

Proxy port. Defaults to DEFAULT_PROXY_PORT

proxy-protocol

string

http

Deprecated Proxy protocol to use when proxy is used. Defaults to DEFAULT_PROXY_PROTOCOL.

query-id-token-param-name

string

id_token

Name of a query parameter that contains the JWT id token when parameter is used.

query-param-name

string

accessToken

Name of a query parameter that contains the JWT access token when parameter is used.

query-param-tenant-name

string

h_tenant

Name of a query parameter that contains the tenant name when the parameter is used. Defaults to DEFAULT_TENANT_PARAM_NAME.

query-param-use

boolean

false

Whether to use a query parameter to send JWT token from application to this server.

redirect

boolean

false

By default, the client should redirect to the identity server for the user to log in. This behavior can be overridden by setting redirect to false. When token is not present in the request, the client will not redirect and just return appropriate error response code.

redirect-attempt-param

string

h_ra

Configure the parameter used to store the number of attempts in redirect.

Defaults to DEFAULT_ATTEMPT_PARAM

redirect-uri

string

/oidc/redirect

URI to register web server component on, used by the OIDC server to redirect authorization requests to after a user logs in or approves scopes. Note that usually the redirect URI configured here must be the same one as configured on OIDC server.

Defaults to DEFAULT_REDIRECT_URI

relative-uris

boolean

false

Deprecated Can be set to true to force the use of relative URIs in all requests, regardless of the presence or absence of proxies or no-proxy lists. By default, requests that use the Proxy will have absolute URIs. Set this flag to true if the host is unable to accept absolute URIs. Defaults to DEFAULT_RELATIVE_URIS.

scope-audience

string

 

Audience of the scope required by this application. This is prefixed to the scope name when requesting scopes from the identity server. Defaults to empty string.

server-type

string

@default

Configure one of the supported types of identity servers.

If the type does not have an explicit mapping, a warning is logged and the default implementation is used.

sign-jwk.resource

 

A resource pointing to JWK with public keys of signing certificates used to validate JWT.

tenants

 

Configurations of the tenants

token-endpoint-auth

ClientAuthentication (CLIENT_SECRET_BASIC, CLIENT_SECRET_POST, CLIENT_SECRET_JWT, PRIVATE_KEY_JWT, CLIENT_CERTIFICATE, NONE)

CLIENT_SECRET_BASIC

Type of authentication to use when invoking the token endpoint. Current supported options:

  • io.helidon.security.providers.oidc.common.OidcConfig.ClientAuthentication.CLIENT_SECRET_BASIC

  • io.helidon.security.providers.oidc.common.OidcConfig.ClientAuthentication.CLIENT_SECRET_POST

  • io.helidon.security.providers.oidc.common.OidcConfig.ClientAuthentication.NONE

Allowed values:

  • CLIENT_SECRET_BASIC: Clients that have received a client_secret value from the Authorization Server authenticate with the Authorization Server in accordance with Section 2.3.1 of OAuth 2.0 [RFC6749] using the HTTP Basic authentication scheme. This is the default client authentication.

  • CLIENT_SECRET_POST: Clients that have received a client_secret value from the Authorization Server, authenticate with the Authorization Server in accordance with Section 2.3.1 of OAuth 2.0 [RFC6749] by including the Client Credentials in the request body.

  • CLIENT_SECRET_JWT: Clients that have received a client_secret value from the Authorization Server create a JWT using an HMAC SHA algorithm, such as HMAC SHA-256. The HMAC (Hash-based Message Authentication Code) is calculated using the octets of the UTF-8 representation of the client_secret as the shared key. The Client authenticates in accordance with JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants [OAuth.JWT] and Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants [OAuth.Assertions].

The JWT MUST contain the following REQUIRED Claim Values and MAY contain the following OPTIONAL Claim Values.

Required: iss, sub, aud, jti, exp

Optional: iat - PRIVATE_KEY_JWT: Clients that have registered a public key sign a JWT using that key. The Client authenticates in accordance with JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants [OAuth.JWT] and Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants [OAuth.Assertions].

The JWT MUST contain the following REQUIRED Claim Values and MAY contain the following OPTIONAL Claim Values.

Required: iss, sub, aud, jti, exp

Optional: iat - CLIENT_CERTIFICATE: Authentication is done via the client certificate used with MTLS. The Returned access token is bound to this client certificate. The Client needs to have MTLS enabled for the OIDC. - NONE: The Client does not authenticate itself at the Token Endpoint, either because it uses only the Implicit Flow (and so does not use the Token Endpoint) or because it is a Public Client with no Client Secret or other authentication mechanism.

token-endpoint-uri

URI

 

URI of a token endpoint used to obtain a JWT based on the authentication code. If not defined, it is obtained from oidcMetadata(Resource), if that is not defined an attempt is made to use identityUri(URI)/oauth2/v1/token.

token-signature-validation

boolean

true

Whether access token signature check should be enabled. Signature check is enabled by default, and it is highly recommended to not change that. Change this setting only when you really know what you are doing, otherwise it could case security issues.

use-jwt-groups

boolean

true

Claim groups from JWT will be used to automatically add groups to current subject (may be used with jakarta.annotation.security.RolesAllowed annotation).

validate-jwt-with-jwk

boolean

true

Use JWK (a set of keys to validate signatures of JWT) to validate tokens. Use this method when you want to use default values for JWK or introspection endpoint URI.

webclient

 

WebClient configuration used for outbound requests to the identity server. This configuration sets the values to the OIDC WebClient default configuration.