CustomHeadersAuthProvider

Attaches a fixed set of headers to every request. Useful for in-house tilesets that authenticate via a non-Bearer scheme (e.g. an internal X-API-Key header), and as a compositional building block under CompositeAuthProvider.

Constructors

Link copied to clipboard
constructor(staticHeaders: Map<String, String>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val discriminator: String

Hard-coded identifier used as the discriminator when serializing the provider via Ogc3dAuthCredentials; must survive R8 / ProGuard / Kotlin-Native obfuscation.

Link copied to clipboard

Whether re-bootstrapping can ever change an auth rejection's outcome — i.e. the provider derives fresh session state from server responses (Google's session=, Cesium Ion's per-asset token). Gates TileFetchQueue's session recovery: for static-credential providers (custom headers, bearer token) a 401/403 is final, and recovery would loop refetch-root → reject → recover forever. Default false; only providers with a meaningful invalidateSessionState should return true.

Link copied to clipboard

Functions

Link copied to clipboard

Drop in-memory auth state derived from a prior response (Google's captured session= token, Cesium Ion's per-asset access token) so the next fetch is forced through the full auth bootstrap. Called when the caller detects auth rejection (e.g. 401/403 on a content fetch) and is about to refetch root.json to obtain a new session/token. Default no-op for stateless providers.

Link copied to clipboard
open fun isAuthRejection(statusCode: Int): Boolean

Whether statusCode on a fetch means the credential is stale and the session must be rebootstrapped. Default 401/403; providers override for their own codes (Google returns 400 on an expired/mismatched session=).

Link copied to clipboard

Whether a successful tileset.json body for url should be persisted to the blob cache. Providers whose first response is a redirect envelope rather than a real tileset (Cesium Ion's /endpoint returns {type, url, accessToken}) return false so it never gets cached as if it were tileset content. Default true — root and subtree tileset.json bodies cache normally and replay across sessions, with the embedded session/auth tokens reused as long as the server still accepts them.

Link copied to clipboard
open fun observeTilesetResponse(requestedUrl: String, responseUrl: String, body: String)

Inspect a successful tileset.json fetch result so the provider can update its internal state from the response (e.g. Google's session query parameter on the response URL, Cesium Ion's asset endpoint URL + access token in the response body). Default no-op.

Link copied to clipboard
open fun redirectFor(responseUrl: String, body: String): String?

Ask the provider whether a successful tileset fetch should redirect to a different URL. Returns the new URL when the response is itself a redirect envelope (e.g. Cesium Ion's api.cesium.com/v1/assets/<id>/endpoint returns JSON with url + accessToken fields; the actual tileset.json lives at the returned URL), or null when body is the final tileset.json content.

Link copied to clipboard
open fun rewriteChildUri(parentUri: String, childUri: String): String

Rewrite a child URI discovered while parsing a tileset. Lets providers propagate persistent query parameters (Google's session token) onto every child URI as soon as the tree is built, instead of waiting until each child fetch fires. Default returns the URI unchanged.

Link copied to clipboard
open override fun rewriteRequest(url: String, headers: MutableMap<String, String> = mutableMapOf()): AuthedRequest

Rewrite an outgoing request. Called once per HTTP fetch immediately before the GET. Implementations may mutate the URL (e.g. append a token) and/or supply extra headers. Returning the input unchanged is fine — see NoAuthProvider.