FakeAuthorizationProvider

class FakeAuthorizationProvider(initialToken: String? = "token", refreshedToken: String? = "refreshed-token", refreshSucceeds: Boolean = true) : AuthorizationProvider

A scriptable AuthorizationProvider for tests. Tracks how many times a refresh was requested and can simulate refresh success or failure.

Parameters

initialToken

the token returned before any refresh, or null for no authorization.

refreshedToken

the token to switch to on a successful refresh.

refreshSucceeds

whether refreshAuthorizationIfNeeded reports success.

Constructors

Link copied to clipboard
constructor(initialToken: String? = "token", refreshedToken: String? = "refreshed-token", refreshSucceeds: Boolean = true)

Properties

Link copied to clipboard

The token currently handed out.

Link copied to clipboard

How many times refreshAuthorizationIfNeeded has been invoked.

Functions

Link copied to clipboard
open suspend override fun currentAuthorization(): AuthorizationType
Link copied to clipboard
open suspend override fun refreshAuthorizationIfNeeded(): Boolean