Skip to content
Connect2id

OpenID provider configuration

OpenID Connect providers publish a JSON document listing their endpoints, supported token encryption algorithms and other useful information for developers to configure their clients (relying parties).

This OpenID provider metadata is made available at a well-known URL which can be derived from the URL identifying the token issuing authority.

For example, if the OpenID provider (issuer) URL is

https://demo.c2id.com

then its metadata will be made available at

https://demo.c2id.com/.well-known/openid-configuration

Example request to obtain an OpenID provider’s metadata:

import com.nimbusds.oauth2.sdk.id.*;
import com.nimbusds.openid.connect.sdk.op.*;

// The OpenID provider issuer URL
Issuer issuer = new Issuer("https://demo.c2id.com");

// Will resolve the OpenID provider metadata automatically
OIDCProviderMetadata opMetadata = OIDCProviderMetadata.resolve(issuer);

// Print the metadata
System.out.println(opMetadata.toJSONObject());

With HTTP connect and read timeouts:

int httpConnectTimeout = 1000; // milliseconds
int httpReadTimeout = 1000; // milliseconds
OIDCProviderMetadata opMetadata = OIDCProviderMetadata.resolve(
    issuer,
    httpConnectTimeout,
    httpReadTimeout);