Class ClientRegistrations
java.lang.Object
org.springframework.security.oauth2.client.registration.ClientRegistrations
Allows creating a
ClientRegistration.Builder from an OpenID
Provider Configuration or
Authorization Server
Metadata based on provided issuer.- Since:
- 5.1
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClientRegistration.BuilderfromIssuerLocation(String issuer) Creates aClientRegistration.Builderusing the provided Issuer by querying three different discovery endpoints serially, using the values in the first successful response to initialize.static ClientRegistration.BuilderfromOidcIssuerLocation(String issuer) Creates aClientRegistration.Builderusing the provided Issuer by making an OpenID Provider Configuration Request and using the values in the OpenID Provider Configuration Response to initialize theClientRegistration.Builder.
-
Method Details
-
fromOidcIssuerLocation
Creates aClientRegistration.Builderusing the provided Issuer by making an OpenID Provider Configuration Request and using the values in the OpenID Provider Configuration Response to initialize theClientRegistration.Builder.For example, if the issuer provided is "https://example.com", then an "OpenID Provider Configuration Request" will be made to "https://example.com/.well-known/openid-configuration". The result is expected to be an "OpenID Provider Configuration Response".
Example usage:
ClientRegistration registration = ClientRegistrations.fromOidcIssuerLocation("https://example.com") .clientId("client-id") .clientSecret("client-secret") .build();- Parameters:
issuer- the Issuer- Returns:
- a
ClientRegistration.Builderthat was initialized by the OpenID Provider Configuration.
-
fromIssuerLocation
Creates aClientRegistration.Builderusing the provided Issuer by querying three different discovery endpoints serially, using the values in the first successful response to initialize. If an endpoint returns anything other than a 200 or a 4xx, the method will exit without attempting subsequent endpoints. The three endpoints are computed as follows, given that theissueris composed of ahostand apath:host/.well-known/openid-configuration/path, as defined in RFC 8414's Compatibility Notes.issuer/.well-known/openid-configuration, as defined in OpenID Provider Configuration.host/.well-known/oauth-authorization-server/path, as defined in Authorization Server Metadata Request.
fromOidcIssuerLocation(String).Example usage:
ClientRegistration registration = ClientRegistrations.fromIssuerLocation("https://example.com") .clientId("client-id") .clientSecret("client-secret") .build();- Parameters:
issuer-- Returns:
- a
ClientRegistration.Builderthat was initialized by one of the described endpoints
-