userHashResolver

Configures a resolver function for userhash support.

When a client sends userhash=true, the username parameter contains H(username:realm) instead of the actual username. This resolver is called to find the actual username from the hash.

When set, the server will include userhash=true in the WWW-Authenticate challenge header, indicating to clients that they may send hashed usernames.

Example implementation using a list of known users:

val users = listOf("alice", "bob", "charlie")

userHashResolver { userhash, realm, algorithm ->
users.find { username ->
computeUserHash(username, realm, algorithm) == userhash
}
}

Report a problem