DefaultCodeService

class DefaultCodeService @JvmOverloads constructor(nonceService: NonceService = DefaultNonceService()) : CodeService(source)

Holds valid codes in memory, delegating to nonceService, i.e. entries are protected with a mutex and expire after the lifetime of that service.

RFC 6749 4.1.2 requires authorization codes to be short-lived and single-use.

Constructors

Link copied to clipboard
constructor(nonceService: NonceService = DefaultNonceService())

Functions

Link copied to clipboard
open suspend override fun provideCode(): String

Implementers: Generate a new random string, store it for later verification.

Link copied to clipboard
open suspend override fun verifyAndRemove(it: String): Boolean

Implementers: Verify the value has been generated by this instance, and remove it, i.e. codes are single-use.