CredentialImpl

Default cross-platform immutable implementation of Credential.

Each instance is a point-in-time snapshot: token and tags are val and never change. Methods that modify credential state return a Result wrapping a new CredentialImpl snapshot with the updated values.

Shared mutable state (deletion tracking, token flows, refresh deduplication) is managed by CredentialDataSource, keyed by credential id.

Used on JVM and other non-Android KMP targets. On Android, the existing com.okta.authfoundation.credential.Credential class provides a mutable adapter.

Properties

Link copied to clipboard
open override val id: String

Unique identifier for this credential.

Link copied to clipboard
open override val tags: Map<String, String>

The tags associated with this credential (point-in-time snapshot).

Link copied to clipboard
open override val token: TokenData

The token associated with this credential (point-in-time snapshot).

Functions

Link copied to clipboard
open override fun accessTokenIfNotExpired(): String?

Returns the access token string if it has not expired, or null if it has.

Link copied to clipboard
open suspend override fun deleteAsync(): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Deletes this credential from storage.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun getTokenFlow(): ERROR CLASS: Symbol not found for Flow<com/okta/authfoundation/credential/kmp/TokenData>

Returns a Flow that emits the current token and subsequent updates.

Link copied to clipboard
open suspend override fun getUserInfo(): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/client/dto/OidcUserInfo>

Fetches user info from the authorization server.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun idToken(): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/jwt/Jwt>

Retrieves the parsed Jwt from the ID token.

Link copied to clipboard
open suspend override fun introspectToken(tokenType: TokenType): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/client/dto/IntrospectInfo>

Introspects a specific token type at the authorization server.

Link copied to clipboard
open suspend override fun refreshIfExpired(): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/credential/kmp/Credential>

Ensures the credential has a non-expired access token, refreshing if necessary.

Link copied to clipboard
open suspend override fun refreshToken(): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/credential/kmp/Credential>

Refreshes the token and returns a new credential snapshot.

Link copied to clipboard
open suspend override fun revokeAllTokens(): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Revokes all available token types (access token, refresh token, device secret).

Link copied to clipboard
open suspend override fun revokeToken(tokenType: RevokeTokenType): ERROR CLASS: Symbol not found for Result<kotlin/Unit>

Revokes a specific token type at the authorization server.

Link copied to clipboard
open override fun scope(): String

Returns the scopes associated with the token, or the client's default scopes. Pure read.

Link copied to clipboard
open suspend override fun setTagsAsync(tags: Map<String, String>): ERROR CLASS: Symbol not found for Result<com/okta/authfoundation/credential/kmp/Credential>

Updates the tags for this credential and returns a new snapshot.