.. index:: single: open_id_discovery
.. _open_id_discovery/0:

.. rst-class:: right

**object**

``open_id_discovery``
=====================

OpenID Provider discovery metadata helpers.

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

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-07-08

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Imports:**
|    ``public`` :ref:`open_id_helpers <open_id_helpers/0>`
| **Uses:**
|    :ref:`list <list/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  

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

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

.. index:: discovery_url/2
.. _open_id_discovery/0::discovery_url/2:

``discovery_url/2``
^^^^^^^^^^^^^^^^^^^

Builds the discovery metadata URL for an issuer.

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

| **Template:**
|    ``discovery_url(Issuer,URL)``
| **Mode and number of proofs:**
|    ``discovery_url(+atom,-atom)`` - ``one_or_error``

| **Exceptions:**
|    ``Issuer`` is a variable:
|        ``instantiation_error``
|    ``Issuer`` is not an absolute issuer URL:
|        ``domain_error(open_id_issuer,Issuer)``


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

.. index:: provider/3
.. _open_id_discovery/0::provider/3:

``provider/3``
^^^^^^^^^^^^^^

Builds validated provider metadata from discovery JSON using default options.

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

| **Template:**
|    ``provider(ExpectedIssuer,JSON,Provider)``
| **Mode and number of proofs:**
|    ``provider(+atom,+term,-compound)`` - ``one_or_error``

| **Exceptions:**
|    The discovered issuer does not match ``ExpectedIssuer``:
|        ``domain_error(open_id_issuer,Issuer)``
|    A provider metadata URL is not secure:
|        ``domain_error(open_id_provider_metadata_url,URL)``


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

.. index:: provider/4
.. _open_id_discovery/0::provider/4:

``provider/4``
^^^^^^^^^^^^^^

Builds validated provider metadata from discovery JSON using the given options.

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

| **Template:**
|    ``provider(ExpectedIssuer,JSON,Provider,Options)``
| **Mode and number of proofs:**
|    ``provider(+atom,+term,-compound,+list(compound))`` - ``one_or_error``

| **Exceptions:**
|    ``Options`` is a variable or a partial list:
|        ``instantiation_error``
|    ``Options`` is neither a variable nor a list:
|        ``type_error(list,Options)``
|    An element ``Option`` of the list ``Options`` is neither a variable nor a compound term:
|        ``type_error(compound,Option)``
|    An element ``Option`` of the list ``Options`` is a compound term but not a valid option:
|        ``domain_error(option,Option)``
|    The discovered issuer does not match ``ExpectedIssuer``:
|        ``domain_error(open_id_issuer,Issuer)``
|    A provider metadata URL is not secure:
|        ``domain_error(open_id_provider_metadata_url,URL)``


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

.. index:: property/3
.. _open_id_discovery/0::property/3:

``property/3``
^^^^^^^^^^^^^^

Looks up a property in validated provider metadata.

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

| **Template:**
|    ``property(Provider,Name,Value)``
| **Mode and number of proofs:**
|    ``property(+compound,+atom,-term)`` - ``zero_or_one``


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

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

(no local declarations; see entity ancestors if any)

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

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

