BasicAuthProvider

class BasicAuthProvider(credentials: suspend () -> BasicAuthCredentials?, realm: String? = null, sendWithoutRequestCallback: (HttpRequestBuilder) -> Boolean = { false }) : AuthProvider

An authentication provider for the Basic HTTP authentication scheme. The Basic authentication scheme can be used for logging in users.

You can learn more from Basic authentication.

Constructors

Link copied to clipboard
constructor(username: String, password: String, realm: String? = null, sendWithoutRequest: Boolean = false)
constructor(credentials: suspend () -> BasicAuthCredentials?, realm: String? = null, sendWithoutRequestCallback: (HttpRequestBuilder) -> Boolean = { false })

Properties

Link copied to clipboard
open override val sendWithoutRequest: Boolean

Waits for HttpStatusCode.Unauthorized to send credentials.

Functions

Link copied to clipboard
open suspend override fun addRequestHeaders(request: HttpRequestBuilder, authHeader: HttpAuthHeader?)

Adds an authentication method headers and credentials.

Link copied to clipboard
open override fun isApplicable(auth: HttpAuthHeader): Boolean

Checks if the current provider is applicable to a request.

Link copied to clipboard
open suspend override fun refreshToken(response: HttpResponse): Boolean

Refreshes a token if required.

Link copied to clipboard
open override fun sendWithoutRequest(request: HttpRequestBuilder): Boolean