toHttpResponse

Converts the authorization server metadata to the response of /.well-known/oauth-authorization-server (and /.well-known/openid-configuration): status 200 with the metadata as JSON (RFC 8414 3.2).


Converts the challenge to the response of the challenge endpoint: status 200 with the challenge as JSON, and Cache-Control: no-store (OA-ABCA 6.1).


Converts the result of the pushed authorization request endpoint to its response: status 201 with the parameters as JSON (RFC 9126 2.2), and the headers DPoP-Nonce and OAuth-Client-Attestation-Challenge, if present.


Converts the result of the authorization endpoint to its response: a redirect with status 302 to the client's redirect URI in Location (RFC 6749 4.1.2).


Converts the result of the token endpoint to its response: status 200 with the token response as JSON, the headers Cache-Control: no-store and Pragma: no-cache (RFC 6749 5.1), and the headers DPoP-Nonce and OAuth-Client-Attestation-Challenge, if present.


Converts the result of the token introspection endpoint to its response: status 200 with the TokenIntrospectionResponse as JSON (RFC 7662 2.2), or the JWT of the TokenIntrospectionJwtResponse as application/token-introspection+jwt (RFC 9701 5.).


@JvmName(name = "userInfoToHttpResponse")
fun ResponseWithDpopNonce<JsonObject>.toHttpResponse(): PreparedHttpResponse(source)

Converts the result of the userinfo endpoint to its response: status 200 with the user info as JSON (OpenID Connect Core 5.3.2), and the header DPoP-Nonce, if present.


Converts this error of an authorization server endpoint (pushed authorization request, token, token introspection, attestation challenge, authorization) to the response to send: status 400 with the toOAuth2Error as JSON (RFC 6749 5.2), including the header DPoP-Nonce for OAuth2Exception.UseDpopNonce (RFC 9449 8.) and OAuth-Client-Attestation-Challenge for OAuth2Exception.UseAttestationChallenge (OA-ABCA 7.4).

invalid_client stays at 400: RFC 6749 5.2 requires 401 only for clients that authenticated with the Authorization header, which neither attestation-based client authentication nor public clients use.

Use toResourceServerHttpResponse for errors of endpoints accessed with an access token.