OpenID provider configuration request

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/c2id

then its metadata will be made available at

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

Example request to obtain an OpenID provider’s metadata (requires SDK v5.45+):

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

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

// Will resolve the OpenID provider metadata automatically
OIDCProviderConfigurationRequest request = new OIDCProviderConfigurationRequest(issuer);

// Make HTTP request
HTTPRequest httpRequest = request.toHTTPRequest();
HTTPResponse httpResponse = httpRequest.send();

// Parse OpenID provider metadata
OIDCProviderMetadata opMetadata = OIDCProviderMetadata.parse(httpResponse.getContentAsJSONObject());

assert issuer.equals(opMetadata.getIssuer());

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