DigestCredential

data class DigestCredential : Credential

Represents Digest credentials

For details see RFC2617

Constructors

<init>

DigestCredential(
    realm: String,
    userName: String,
    digestUri: String,
    nonce: String,
    opaque: String?,
    nonceCount: String?,
    algorithm: String?,
    response: String,
    cnonce: String?,
    qop: String?)

Represents Digest credentials

Properties

algorithm

val algorithm: String?

digest algorithm name

cnonce

val cnonce: String?

must be sent if qop is specified and must be null otherwise. Should be passed through unchanged.

digestUri

val digestUri: String

may be an absolute URI or *

nonce

val nonce: String

nonceCount

val nonceCount: String?

must be sent if qop is specified and must be null otherwise

opaque

val opaque: String?

a string of data that is passed through unchanged

qop

val qop: String?

quality of protection sign

realm

val realm: String

digest auth realm

response

val response: String

consist of 32 hex digits (digested password and other fields as per RFC)

userName

val userName: String

Extension Functions

expectedDigest

fun DigestCredential.expectedDigest(
    method: HttpMethod,
    digester: MessageDigest,
    userNameRealmPasswordDigest: ByteArray
): ByteArray

Calculates expected digest bytes for this DigestCredential

verifier

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

Verifies credentials are valid for given method and digester and userNameRealmPasswordDigest