OAuth2KtorClient

constructor(httpClient: HttpClient, oAuth2Client: OAuth2Client, clientAttestation: ClientAttestation? = null, dpopKeyMaterial: KeyMaterial = clientAttestation?.keyMaterial ?: EphemeralKeyWithoutCert(), randomSource: RandomSource = RandomSource.Secure, verifyTokenIntrospectionJwt: VerifyJwsObjectFun? = null)(source)

Parameters

httpClient

the app's ktor client, i.e. with its engine, cookie storage (advised to be persistent, to keep the session at the authorization server alive after receiving the auth code) and logging. This class sends its requests with a copy that does not follow redirects (see HttpClient.config), setting content type and status handling per request. Plugins must not re-send requests or react to error statuses, e.g. by caching failures: retries after a use_dpop_nonce error re-send the same request, and DPoP proofs and client attestation PoPs are single-use.

oAuth2Client

implements the OAuth 2.0 protocol, redirectUrl needs to be registered by the OS for this application, so redirection back from browser works

clientAttestation

authenticates the client with OAuth 2.0 Attestation-Based Client Authentication, e.g. with a Wallet Instance Attestation (WIA), or null to not use it

dpopKeyMaterial

the key material the access tokens and refresh tokens get bound to, used for calculating DPoP proofs; by default the key of clientAttestation, as EUDI TS3 requires, so that refresh tokens remain usable after the app restarts, else an ephemeral key

randomSource

source for random bytes, i.e., nonces for proof-of-possession of key material for sender-constrained tokens

verifyTokenIntrospectionJwt

verifies the signature of JWT responses of token introspection (RFC 9701) against the keys of the authorization server; when set, token introspection requests and accepts only JWT responses, when null (the default) plain JSON responses


constructor(engine: HttpClientEngine, cookiesStorage: CookiesStorage? = null, httpClientConfig: HttpClientConfig<*>.() -> Unit? = null, keyMaterial: KeyMaterial = EphemeralKeyWithoutCert(), dpopKeyMaterial: KeyMaterial = EphemeralKeyWithoutCert(), oAuth2Client: OAuth2Client, randomSource: RandomSource = RandomSource.Secure, verifyTokenIntrospectionJwt: VerifyJwsObjectFun? = null, loadInstanceAttestation: suspend (OAuth2ProtocolClient.LoadInstanceAttestationInput) -> KmmResult<JwsCompactTyped<JsonWebToken>>? = null)(source)

Deprecated

Pass the app's HttpClient instead of engine, cookiesStorage and httpClientConfig, and the instance attestation loader together with its key material as ClientAttestation; the DPoP key then defaults to the attested key

Parameters

engine

ktor engine to use to make requests to issuing service.

cookiesStorage

Callers are advised to implement a persistent cookie storage, to keep the session at the issuing service alive after receiving the auth code.

httpClientConfig

Additional configuration for building the HTTP client, e.g. callers may enable logging.

keyMaterial

Used to prove possession of the key material for the instance attestation, see loadInstanceAttestation.

dpopKeyMaterial

The key material the access tokens and refresh tokens get bound to, used for calculating DPoP proofs.

oAuth2Client

Implements OAuth2 protocol, redirectUrl needs to be registered by the OS for this application, so redirection back from browser works

randomSource

Source for random bytes, i.e., nonces for proof-of-possession of key material for sender-constrained tokens.

verifyTokenIntrospectionJwt

verifies the signature of JWT responses of token introspection (RFC 9701) against the keys of the authorization server; when set, token introspection requests and accepts only JWT responses, when null (the default) plain JSON responses

loadInstanceAttestation

Return a new Wallet Instance Attestation (WIA) to authenticate the Wallet App to the Authorization Service with OAuth Attestation Based Client Auth. Returned JWT MUST reference keyMaterial in JsonWebToken.confirmationClaim.