Credential

Convenience object that wraps a Token, providing methods and properties for interacting with credential resources.

This class can be used as a convenience mechanism for managing stored credentials, performing operations on or for a user using their credentials, and interacting with resources scoped to the credential.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
sealed interface Security

Convenience object for specifying security level for storing Token objects

Properties

Link copied to clipboard
val id: String

Identifier for this credential.

Link copied to clipboard

The tags associated with this Credential.

Link copied to clipboard

The current Token that's stored and associated with this Credential.

Functions

Link copied to clipboard
fun accessTokenInterceptor(): Interceptor

Returns an Interceptor that can be can be added to an OkHttpClient via OkHttpClient.Builder.addInterceptor to access a Resource Server.

Link copied to clipboard
fun delete()

Removes this Credential from the associated CredentialDataSource. This Credential should not be used after it's been removed.

Link copied to clipboard
suspend fun deleteAsync()

Removes this Credential from the associated CredentialDataSource. This Credential should not be used after it's been removed.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard

Checks to see if the current access token is valid, and if it is, returns it. If there is no Token associated with the Credential, null is returned.

Link copied to clipboard
fun getTokenFlow(): Flow<Token>

Returns a Flow that emits the current Token that's stored and associated with this Credential.

Link copied to clipboard

Performs the OIDC User Info call, which returns claims associated with this Credential.

Link copied to clipboard
suspend fun getValidAccessToken(): String?

Returns a valid access token if one is present. If the access token is invalid, and there is a refresh token, a Token refresh is attempted via Credential.refreshToken. If the refresh results in a valid access token, it is returned.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun idToken(): Jwt?

Retrieve the Jwt associated with the Token.idToken field.

Link copied to clipboard

Performs a call to the Authorization Server to validate the specified TokenType.

Link copied to clipboard

Attempt to refresh the Token associated with this Credential.

Link copied to clipboard

Attempt to revoke all available tokens.

Link copied to clipboard

Attempt to revoke the specified TokenType.

Link copied to clipboard
fun scope(): String

Returns the scopes associated with the associated Token if present, otherwise the default scopes associated with the OAuth2Client.

Link copied to clipboard
suspend fun setTagsAsync(tags: Map<String, String>)

Set tags for this Credential.