abla/jwt/remote
Generated from source.
Import with import "abla/jwt/remote".
Source: abla/jwt/remote/entry.ab
JwksLocation (class)
class JwksLocation(
val secure: bool,
val host: string,
val port: int,
val path: string,
val valid: bool
)
Carries a parsed JWKS host, port, request path and scheme flag with its validity.
JwksFetch (class)
class JwksFetch(val body: string, val error: string)
Carries the fetched JSON document or a fetch error.
JwksCache (class)
resource class JwksCache(
val url: string,
var keys: JwtKeySet,
var fetchedAtMilliseconds: int,
var lastAttemptMilliseconds: int,
var lastError: string,
val maxAgeMilliseconds: int,
val cooldownMilliseconds: int,
val timeoutMilliseconds: int,
var fetches: int
)
Stores a remote public key set and its refresh timing, errors and fetch count.
jwksParseLocation (fun)
fun jwksParseLocation(url: string): JwksLocation
Parses a JWKS HTTP or HTTPS endpoint, marking unsupported schemes, empty hosts and invalid ports as invalid.
jwksCache (fun)
fun jwksCache(
url: string,
maxAgeSeconds: int = 86400,
cooldownSeconds: int = 30,
timeoutMilliseconds: int = 10000
): JwksCache
Creates the cache and attempts its initial fetch, recording any failure in the cache.
jwksCacheFromDocument (fun)
fun jwksCacheFromDocument(document: string, maxAgeSeconds: int = 86400): JwksCache
Builds a cache from an already available document (tests, pinned keys).
JwksCache.refresh (extension fun)
fun JwksCache.refresh(): bool
Fetches now. On failure the previous keys stay in service.
JwksCache.coolingDown (extension fun)
fun JwksCache.coolingDown(now: int): bool
Reports whether the given monotonic time is still inside the fetch cooldown.
JwksCache.verify (extension fun)
fun JwksCache.verify(
token: string,
options: JwtOptions = JwtOptions()
): JwtVerification
Verifies the token with cached keys, refreshing stale or missing keys when allowed by the cooldown.
JwksCache.keyCount (extension fun)
fun JwksCache.keyCount(): int
Returns the number of keys currently cached.
Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.