From cfed3445de6460bfe6b26c6385d36da6769a0cbf Mon Sep 17 00:00:00 2001 From: Alice Poggioli <alice.poggioli@paca.happy-dev.fr> Date: Tue, 11 Aug 2020 15:19:59 +0200 Subject: [PATCH] add solid-auth --- .../Components/Solid-Auth.rst | 70 +++++++++++++++++++ source/index.rst | 7 ++ 2 files changed, 77 insertions(+) create mode 100644 source/import_documentation/Components/Solid-Auth.rst diff --git a/source/import_documentation/Components/Solid-Auth.rst b/source/import_documentation/Components/Solid-Auth.rst new file mode 100644 index 0000000..12d8f6d --- /dev/null +++ b/source/import_documentation/Components/Solid-Auth.rst @@ -0,0 +1,70 @@ +solid-auth +================ + +Allows your users to login via a given OIDC provider. + +Installation +-------------- + Add the following within the <head> of your HTML: + + .. note:: + + Indeed, It doesn't matter where you put the solid-auth. + + .. code:: html + + <script type="module" src="https://unpkg.com/@startinblox/oidc@latest"></script> + <solid-auth> + <solid-auth-provider + class="solid-auth-provider" + data-authority="https://test-paris.happy-dev.fr/openid/" + data-client_id="833925" + data-id="paris" + data-client-name="SIB App" + > + </solid-auth-provider> + </solid-auth> + + + `You'll find here the detail of the attributes configuration.<https://github.com/IdentityModel/oidc-client-js/wiki#usermanager>`__ + + +bind-user +------------ + To associate the currently logged in user to a component, add the bind-user attribute to it. + It will set its `data-src` attribute to the currently logged in user's resource URL. + Example: + + .. code:: html + + <sib-conversation bind-user></sib-conversation> + + will result in : + + .. code:: html + + <sib-conversation data-src="https://your-domain/your-user-uri/3" bind-user></sib-conversation> + +Methods available +------------------ + + Login + ~~~~~~~~~~~~~ + + .. code:: js + + document.querySelector('sib-auth').login(); + + Logout + ~~~~~~~~~~~~~ + + .. code:: js + + document.querySelector('sib-auth').logout(); + + Get user info + ~~~~~~~~~~~~~ + + code:: js + + document.querySelector('sib-auth').getUser(); \ No newline at end of file diff --git a/source/index.rst b/source/index.rst index 849aec5..ad9b50a 100644 --- a/source/index.rst +++ b/source/index.rst @@ -51,6 +51,13 @@ Welcome to Startinblox's documentation! import_documentation/Components/SiB-Ac-Checker import_documentation/Components/SiB-Widget +.. toctree:: + :maxdepth: 2 + :caption: Extend components: + + import_documentation/Components/Solid-Auth + + .. toctree:: :maxdepth: 2 :caption: Mixins: -- GitLab