Scoop API

scoop:scoop.http.client:0.1.0

src/authentication/bearer/options.scoop

Selected production source · src/authentication/bearer/options.scoop

1package scoop.http.client
3import scoop.http.HttpAuthChallenge
4import scoop.url.Url
6/**
7 * An access token and optional provider-owned refresh token. The refresh token is passed to
8 * callbacks rather than sent as Authorization.
9 */
10public class HttpBearerTokens public constructor(
11 /**
12 * The token used in Bearer Authorization.
13 */
14 public val accessToken: String,
15 /**
16 * Optional provider metadata passed back when refreshing the access token.
17 */
18 public val refreshToken: String? = None)
20/**
21 * A rejected Bearer challenge with the previous token pair and current origin/proxy authentication
22 * context.
23 */
24public class HttpBearerRefreshRequest internal constructor(
25 /**
26 * The request requiring credentials or refreshed tokens.
27 */
28 public val request: HttpRequest,
29 /**
30 * The selected peer challenge; optional for preemptive credential loading.
31 */
32 public val challenge: HttpAuthChallenge,
33 /**
34 * The authentication attempt number for this request sequence.
35 */
36 public val attempt: Long,
37 /**
38 * The previously loaded tokens being refreshed.
39 */
40 public val tokens: HttpBearerTokens,
41 /**
42 * The proxy endpoint when handling proxy authentication, otherwise None.
43 */
44 public val proxyUrl: Url? = None
47internal class ClientBearerAuthentication(
48 val loadTokens: suspend (HttpAuthenticationRequest) -> HttpBearerTokens,
49 val refreshTokens: suspend (HttpBearerRefreshRequest) -> HttpBearerTokens?