DigestCredential

class DigestCredential(val realm: String, val userName: String, val digestUri: String, val nonce: String, val opaque: String?, val nonceCount: String?, val digestAlgorithm: DigestAlgorithm, val response: String, val cnonce: String?, val qop: String?, val userHash: Boolean = false, val charset: Charset = Charsets.UTF_8)(source)

Digest credentials.

Report a problem

See also

Constructors

Link copied to clipboard
constructor(realm: String, userName: String, digestUri: String, nonce: String, opaque: String?, nonceCount: String?, digestAlgorithm: DigestAlgorithm, response: String, cnonce: String?, qop: String?, userHash: Boolean = false, charset: Charset = Charsets.UTF_8)
constructor(realm: String, userName: String, digestUri: String, nonce: String, opaque: String?, nonceCount: String?, algorithm: String?, response: String, cnonce: String?, qop: String?)

Properties

Link copied to clipboard

The digest algorithm name (e.g., "SHA-512-256", "SHA-256", "MD5")

Link copied to clipboard
Link copied to clipboard

Client nonce, must be sent if qop is specified

Link copied to clipboard
Link copied to clipboard

The request URI (an absolute URI or *)

Link copied to clipboard

A server-specified unique value for this authentication round

Link copied to clipboard

The request counter (nc); must be sent if qop is specified

Link copied to clipboard

A string of data that should be returned by the client unchanged

Link copied to clipboard
val qop: String?

Quality of protection ("auth" or "auth-int")

Link copied to clipboard

A digest authentication realm identifying the protection space

Link copied to clipboard

The client's digest response, consisting of hex digits

Link copied to clipboard

Whether the userName field contains a hashed username instead of plaintext

Link copied to clipboard

The username, or userHash if userHash is true

Functions

Link copied to clipboard
operator fun component1(): String
Link copied to clipboard
operator fun component10(): String?
Link copied to clipboard
operator fun component2(): String
Link copied to clipboard
operator fun component3(): String
Link copied to clipboard
operator fun component4(): String
Link copied to clipboard
operator fun component5(): String?
Link copied to clipboard
operator fun component6(): String?
Link copied to clipboard
operator fun component7(): String
Link copied to clipboard
operator fun component8(): String
Link copied to clipboard
operator fun component9(): String?
Link copied to clipboard
fun copy(realm: String = this.realm, userName: String = this.userName, digestUri: String = this.digestUri, nonce: String = this.nonce, opaque: String? = this.opaque, nonceCount: String? = this.nonceCount, algorithm: String? = this.digestAlgorithm.name, response: String = this.response, cnonce: String? = this.cnonce, qop: String? = this.qop): DigestCredential
fun copy(realm: String = this.realm, userName: String = this.userName, digestUri: String = this.digestUri, nonce: String = this.nonce, opaque: String? = this.opaque, nonceCount: String? = this.nonceCount, digestAlgorithm: DigestAlgorithm = this.digestAlgorithm, response: String = this.response, cnonce: String? = this.cnonce, qop: String? = this.qop, userHash: Boolean = this.userHash, charset: Charset = this.charset): DigestCredential
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun DigestCredential.expectedDigest(method: HttpMethod, digester: MessageDigest, userNameRealmPasswordDigest: ByteArray): ByteArray

Calculates the expected digest bytes for this DigestCredential.

fun DigestCredential.expectedDigest(method: HttpMethod, userNameRealmPasswordDigest: ByteArray, entityBodyHash: ByteArray? = null): ByteArray

Calculates the expected digest bytes for this DigestCredential per RFC 7616.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
suspend fun DigestCredential.verifier(method: HttpMethod, userNameRealmPasswordDigest: suspend (String, String) -> ByteArray?): Boolean

Verifies that credentials are valid for a given method, and userNameRealmPasswordDigest. The algorithm from DigestCredential.algorithm is used to compute the HA1 value.

suspend fun DigestCredential.verifier(method: HttpMethod, digester: MessageDigest, userNameRealmPasswordDigest: suspend (String, String) -> ByteArray?): Boolean

Verifies that credentials are valid for a given method, digester, and userNameRealmPasswordDigest.