<p>In my opinion this does not make sense.</p>
<p>The username value is taken from the <code>username</code> field of <code>(Proxy-)Authorization</code> header and that is the value the UAC used to build the Digest response. If you use a different value, practically the authentication fails. The Digest response has the username hashed inside, the HA1 being <code>MD5(username:realm:password)</code>. To have a successful authentication, the same username must be used by server side as well.</p>
<p>If you just need to load the password by matching a different username, then sqlops can be used to do any kind of query. Anyhow pv_www_authenticate() doesn't do any database query.</p>
<p>In case you want to achieve something else, I would suggest to discuss first on sr-users mailing list to properly understand the needs. Again, this one with a custom username contradicts the authentication algorithm specs. I am closing this one for now, it can be reopened if there is a different conclusion after discussions on sr-users mailing list.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1817#issuecomment-457508046">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZdTX0oyLTShx-k38s4Z0IG6SAObLks5vGswigaJpZM4aMCOS">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZZuQFqj0I3od3viCwqOkOqv7oitLks5vGswigaJpZM4aMCOS.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@miconda in #1817: In my opinion this does not make sense.\r\n\r\nThe username value is taken from the `username` field of `(Proxy-)Authorization` header and that is the value the UAC used to build the Digest response. If you use a different value, practically the authentication fails. The Digest response has the username hashed inside, the HA1 being `MD5(username:realm:password)`. To have a successful authentication, the same username must be used by server side as well.\r\n\r\nIf you just need to load the password by matching a different username, then sqlops can be used to do any kind of query. Anyhow pv_www_authenticate() doesn't do any database query.\r\n\r\nIn case you want to achieve something else, I would suggest to discuss first on sr-users mailing list to properly understand the needs. Again, this one with a custom username contradicts the authentication algorithm specs. I am closing this one for now, it can be reopened if there is a different conclusion after discussions on sr-users mailing list."}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1817#issuecomment-457508046"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1817#issuecomment-457508046",
"url": "https://github.com/kamailio/kamailio/issues/1817#issuecomment-457508046",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>