.. index:: single: http_router_digest_auth(Verifier,ProtectOptions,AuthenticationInfoOptions)
.. _http_router_digest_auth/3:

.. rst-class:: right

**category**

``http_router_digest_auth(Verifier,ProtectOptions,AuthenticationInfoOptions)``
==============================================================================

* ``Verifier`` - Verifier object passed to ``http_digest::protect_request/4`` when a routed request declares ``digest_auth/1`` metadata.
* ``ProtectOptions`` - Base protect-request options merged with any route-specific ``digest_auth/1`` metadata options.
* ``AuthenticationInfoOptions`` - Base options passed to ``http_digest::add_authentication_info/4`` when a routed request was successfully verified using Digest authentication.


Optional Digest-auth router helpers for objects importing the ``http_router`` category.

| **Availability:** 
|    ``logtalk_load(http_digest(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-06-03

| **Compilation flags:**
|    ``static``


| **Uses:**
|    :ref:`http_core <http_core/0>`
|    :ref:`http_digest <http_digest/0>`
|    :ref:`list <list/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

(no local declarations; see entity ancestors if any)

Protected predicates
--------------------

.. index:: authorize_digest_auth_request/2
.. _http_router_digest_auth/3::authorize_digest_auth_request/2:

``authorize_digest_auth_request/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Router helper that applies Digest-auth route metadata to a routed request and returns either ``continue(Request)`` or ``respond(Response)``.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``authorize_digest_auth_request(Request,Action)``
| **Mode and number of proofs:**
|    ``authorize_digest_auth_request(+compound,-compound)`` - ``one_or_error``

| **Exceptions:**
|    ``RouteOptions`` is not a proper list of Digest protection options:
|        ``domain_error(http_router_digest_auth_options,RouteOptions)``
|    ``ProtectOptions`` is not a proper list of Digest protection options:
|        ``domain_error(http_router_digest_auth_options,ProtectOptions)``
|    ``Request`` is not a normalized HTTP request term:
|        ``domain_error(http_request,Request)``
|    ``Verifier`` is a variable:
|        ``instantiation_error``
|    ``Verifier`` does not name an existing object:
|        ``existence_error(http_digest_verifier,Verifier)``
|    ``Verifier`` names an object that does not implement ``http_digest_verifier_protocol``:
|        ``domain_error(http_digest_verifier,Verifier)``
|    An element ``Option`` of the effective Digest protection options list is a variable:
|        ``instantiation_error``
|    An element ``Option`` of the effective Digest protection options list is neither a variable nor a compound term:
|        ``type_error(compound,Option)``
|    An element ``Option`` of the effective Digest protection options list is a compound term but not a valid Digest option:
|        ``domain_error(option,Option)``
|    An element ``Option`` of the effective Digest protection options list is not accepted by ``http_digest::protect_request/4``:
|        ``domain_error(http_digest_protect_request_option,Option)``
|    The effective Digest protection options omit ``realm/1``:
|        ``domain_error(http_digest_term(challenge),missing(realm))``
|    The effective Digest protection options omit ``nonce_secret/1``:
|        ``domain_error(http_digest_protect_request_option,nonce_secret(A))``
|    The effective Digest protection options request unsupported ``userhash`` support:
|        ``domain_error(http_digest_term(challenge),invalid(userhash))``
|    The effective Digest protection options request an unsupported Digest algorithm:
|        ``domain_error(http_digest_algorithm,Algorithm)``
|    The effective Digest protection options request an unsupported Digest qop:
|        ``domain_error(http_digest_qop,Qop)``
|    The effective Digest protection options request a non-401 failure status:
|        ``domain_error(http_digest_status,Status)``


------------

.. index:: add_digest_authentication_info/3
.. _http_router_digest_auth/3::add_digest_authentication_info/3:

``add_digest_authentication_info/3``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Router helper that decorates a response with ``Authentication-Info`` when the routed request was successfully verified using Digest authentication.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``add_digest_authentication_info(Request,Response0,Response)``
| **Mode and number of proofs:**
|    ``add_digest_authentication_info(+compound,+compound,-compound)`` - ``one_or_error``

| **Exceptions:**
|    ``AuthenticationInfoOptions`` is not a proper list of Digest authentication-info options:
|        ``domain_error(http_router_digest_auth_authentication_info_options,AuthenticationInfoOptions)``
|    ``Request`` is not a normalized HTTP request term:
|        ``domain_error(http_request,Request)``
|    ``Response0`` is not a normalized HTTP response term:
|        ``domain_error(http_response,Response0)``
|    An element ``Option`` of the Digest authentication-info options list is a variable:
|        ``instantiation_error``
|    An element ``Option`` of the Digest authentication-info options list is neither a variable nor a compound term:
|        ``type_error(compound,Option)``
|    An element ``Option`` of the Digest authentication-info options list is a compound term but not a valid Digest option:
|        ``domain_error(option,Option)``
|    An element ``Option`` of the Digest authentication-info options list is not accepted by ``http_digest::add_authentication_info/4``:
|        ``domain_error(http_digest_add_authentication_info_option,Option)``
|    The routed request carries an invalid Digest authorization term:
|        ``domain_error(http_digest_term(authorization),Cause)``
|    The routed request carries a Digest authorization with an unsupported response qop:
|        ``domain_error(http_digest_qop,Qop)``
|    The routed request carries a Digest authorization with an unsupported algorithm:
|        ``domain_error(http_digest_algorithm,Algorithm)``
|    Automatic ``nextnonce`` generation is requested without ``nonce_secret/1``:
|        ``domain_error(http_digest_add_authentication_info_option,nonce_secret(A))``


------------

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

