Interface ExternalOAuth
Represents an RFC 7662-compliant OAuth 2.0 Token Introspection endpoint. For more information, see Requesting an access token using an external OAuth 2.0 server.
You can only configure one external OAuth 2.0 endpoint per Project. To authenticate using multiple external services (such as social network logins), use a middle layer authentication service that delegates to those services and exposes a single RFC 7662-compliant OAuth 2.0 Token Introspection endpoint to the commercetools APIs. This middle layer is a custom service that you build and host. It receives the token introspection request from the APIs, routes the token validation to the appropriate external service, and returns the introspection response in the expected format.
Example to create an instance using the builder pattern
ExternalOAuth externalOAuth = ExternalOAuth.builder()
.url("{url}")
.authorizationHeader("{authorizationHeader}")
.build()
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExternalOAuthBuilderbuilder()builder factory method for ExternalOAuthstatic ExternalOAuthBuilderbuilder(ExternalOAuth template) create builder for ExternalOAuth instancecopyDeep()static ExternalOAuthdeepCopy(ExternalOAuth template) factory method to create a deep copy of ExternalOAuth@NotNull StringMust not contain any leading or trailing whitespaces.@NotNull StringgetUrl()URL with authorization header.static ExternalOAuthof()factory methodstatic ExternalOAuthof(ExternalOAuth template) factory method to create a shallow copy ExternalOAuthvoidsetAuthorizationHeader(String authorizationHeader) Must not contain any leading or trailing whitespaces.voidURL with authorization header.static tools.jackson.core.type.TypeReference<ExternalOAuth>gives a TypeReference for usage with Jackson DataBinddefault <T> TwithExternalOAuth(Function<ExternalOAuth, T> helper) accessor map function
-
Method Details
-
getUrl
URL with authorization header.
- Returns:
- url
-
getAuthorizationHeader
Must not contain any leading or trailing whitespaces. Partially hidden on retrieval.
- Returns:
- authorizationHeader
-
setUrl
URL with authorization header.
- Parameters:
url- value to be set
-
setAuthorizationHeader
Must not contain any leading or trailing whitespaces. Partially hidden on retrieval.
- Parameters:
authorizationHeader- value to be set
-
of
factory method- Returns:
- instance of ExternalOAuth
-
of
factory method to create a shallow copy ExternalOAuth- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
ExternalOAuth copyDeep() -
deepCopy
factory method to create a deep copy of ExternalOAuth- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for ExternalOAuth- Returns:
- builder
-
builder
create builder for ExternalOAuth instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withExternalOAuth
accessor map function- Type Parameters:
T- mapped type- Parameters:
helper- function to map the object- Returns:
- mapped value
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-