Package-level declarations

Types

Link copied to clipboard
data class HttpBody(val contentType: ContentType, val text: String)

An encoded body, e.g. form, JSON or JWT, with its media type, which is sent as Content-Type with it. Bodies are always text, as is every body of the protocols covered here.

Link copied to clipboard
open class HttpErrorResponseException(val status: HttpStatusCode, val headers: Headers, val responseBody: String, val oauth2Error: OAuth2Error?, val problemDetails: ProblemDetails?) : IllegalStateException

A non-success HTTP response with its OAuth or RFC 9457 error details, when available.

Link copied to clipboard
interface HttpExchange<T>

One logical call of a protocol, which may need more than one HTTP request, e.g. to fetch an attestation challenge or to retry with a nonce the server asked for. The method returning the exchange documents which ProtocolRequests it sends.

Link copied to clipboard
sealed interface HttpStep<out T>

One step of an HttpExchange.

Link copied to clipboard
data class PreparedHttpRequest(val url: String, val method: HttpMethod, val headers: Headers = Headers.Empty, val body: HttpBody? = null)

A request to send. Send every header in headers, and body with its HttpBody.contentType as Content-Type; headers never contain Content-Type.

Link copied to clipboard
data class PreparedHttpResponse(val status: HttpStatusCode, val headers: Headers = Headers.Empty, val body: HttpBody? = null)

A response to send, whatever the HTTP server stack. Write out status, every header in headers, and body unchanged with its HttpBody.contentType as Content-Type; headers never contain Content-Type.

Link copied to clipboard
data class ProblemDetails(val type: String = "about:blank", val status: Int? = null, val title: String? = null, val detail: String? = null, val instance: String? = null, val extensions: JsonObject = JsonObject(emptyMap()))

Standard members of an RFC 9457 problem details object. type defaults to about:blank; problem-specific members are retained in extensions.

Link copied to clipboard
sealed class ProtocolRequest

Every HTTP request the OAuth 2.0, OpenID4VCI and OpenID4VP protocol clients hand out, see at.asitplus.wallet.lib.oauth2.OAuth2ProtocolClient and at.asitplus.wallet.lib.openid.OpenId4VpProtocolClient. Each method returning an HttpExchange documents which of these kinds it sends, in which order, and how often. Requests that are retried are Retryable.

Link copied to clipboard
data class ReceivedHttpResponse(val status: HttpStatusCode, val headers: Headers, val body: String)

The server's answer, whatever the status code. Callers must not follow redirects.

Link copied to clipboard

Implementations need to fetch the url passed in, and return either the body, if there is one, or the HTTP header Location, i.e. if the server sends the request object as a redirect.

Link copied to clipboard
data class RemoteResourceRetrieverInput @JvmOverloads constructor(val url: String, val method: HttpMethod = HttpMethod.Get, val headers: Map<String, String> = emptyMap<String, String>(), val requestObjectParameters: RequestObjectParameters? = null)

Fetch the url with the method, send requestObjectParameters and set headers for that HTTP request.