diff --git a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/Auth.kt b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/Auth.kt index 73f154493d4..3cdcf925784 100644 --- a/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/Auth.kt +++ b/ktor-client/ktor-client-plugins/ktor-client-auth/common/src/io/ktor/client/plugins/auth/Auth.kt @@ -24,9 +24,19 @@ private class AtomicCounter { val atomic = atomic(0) } +/** + * Configuration used by [Auth] plugin. + */ @KtorDsl public class AuthConfig { + /** + * [AuthProvider] list to use. + */ public val providers: MutableList = mutableListOf() + + /** + * A lambda function to control whether a response is unauthorized and should trigger a refresh / re-auth. + */ public var isUnauthorized: suspend (HttpResponse) -> Boolean = { it.status == HttpStatusCode.Unauthorized } } @@ -41,8 +51,7 @@ public val AuthCircuitBreaker: AttributeKey = AttributeKey("auth-request") * * You can learn more from [Authentication and authorization](https://ktor.io/docs/auth.html). * - * [providers] - list of auth providers to use. - * [isUnauthorized] - lambda function to control whether a response is unauthorized and should trigger a re-auth. + * @see [AuthConfig] for configuration options. */ public val Auth: ClientPlugin = createClientPlugin("Auth", ::AuthConfig) { val providers = pluginConfig.providers.toList()