AuthCredential

A credential that a tool uses to call a service: an ApiKey, an Http credential, an OAuth2 or OpenID Connect credential, or a ServiceAccount.

Secret fields are Secrets, so a credential's toString() prints them as <redacted>. OAuth2 also redacts its state, nonce, authUri and redirectUri, which are plain strings.

Inheritors

Types

Link copied to clipboard
data class ApiKey(val apiKey: Secret? = null) : AuthCredential

An API key, which the tool sends where the service's auth scheme says, such as in a header.

Link copied to clipboard
data class Http(val scheme: String, val credentials: AuthCredential.Http.Credentials, val additionalHeaders: Map<String, Secret>? = null) : AuthCredential

An HTTP authentication credential, usually sent in the Authorization header.

Link copied to clipboard
data class OAuth2(val variant: AuthCredential.OAuth2.Variant = Variant.OAUTH2, val clientId: String? = null, val clientSecret: Secret? = null, val authUri: String? = null, val nonce: String? = null, val state: String? = null, val redirectUri: String? = null, val authResponseUri: Secret? = null, val authCode: Secret? = null, val accessToken: Secret? = null, val refreshToken: Secret? = null, val idToken: Secret? = null, val expiresAt: Instant? = null, val expiresIn: Duration? = null, val audience: String? = null, val prompt: String? = null, val codeVerifier: Secret? = null, val codeChallengeMethod: String? = null, val tokenEndpointAuthMethod: AuthCredential.OAuth2.TokenEndpointAuthMethod? = TokenEndpointAuthMethod.CLIENT_SECRET_BASIC) : AuthCredential

An OAuth2 or OpenID Connect credential: the client's configuration, the sign-in state and, once the user has signed in, the tokens.

Link copied to clipboard
data class ServiceAccount(val serviceAccountCredential: AuthCredential.ServiceAccount.Credential? = null, val scopes: List<String>? = null, val useDefaultCredential: Boolean = false, val useIdToken: Boolean = false, val audience: String? = null) : AuthCredential

A Google Cloud credential: a service account key, or Application Default Credentials.