Class OAuth2Config
java.lang.Object
com.mastercard.developer.oauth2.config.OAuth2Config
Immutable configuration for OAuth2 clients supporting DPoP-bound access tokens.
This class provides all necessary configuration parameters for establishing OAuth2
authentication with token endpoint, including client credentials, DPoP proof generation,
scope management, and access token storage.
Configuration instances are created using the builder pattern. All required fields must
be provided before building, otherwise an OAuth2ClientConfigException will be thrown.
Example usage:
OAuth2Config config = OAuth2Config.builder()
.securityProfile(SecurityProfile.FAPI2SP_PRIVATE_KEY_DPOP)
.clientId("ZvT0sklPsqzTNgKJIiex5_wppXz0Tj2wl33LUZtXmCQH8dry")
.tokenEndpoint(URI.create("https://sandbox.api.mastercard.com/oauth/token"))
.issuer(URI.create("https://sandbox.api.mastercard.com"))
.clientKey(clientKey)
.kid("302449525fad5309874b16298f3cbaaf0000000000000000")
.accessTokenStore(new InMemoryAccessTokenStore())
.scopeResolver(new StaticScopeResolver(Set.of("service:scope1", "service:scope2")))
.dpopKeyProvider(new StaticDPoPKeyProvider(dpopKeyPair))
.clockSkewTolerance(Duration.ofSeconds(10))
.build();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a new builder forOAuth2Config.getKid()toString()
-
Method Details
-
builder
Create a new builder forOAuth2Config. -
getIssuer
-
getClientId
-
getTokenEndpoint
-
getClockSkewTolerance
-
getUserAgent
-
getScopeResolver
-
getAccessTokenStore
-
getClientKey
-
getKid
-
getDPoPKeyProvider
-
toString
-