diff --git a/source/import_documentation/Components/Solid-Auth.rst b/source/import_documentation/Components/Solid-Auth.rst new file mode 100644 index 0000000000000000000000000000000000000000..12d8f6d3a457ea3d7b102fc4874231118902181f --- /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 849aec510bd3915c793cc3b4783c9a5c6f469ccf..ad9b50a1ec1be46bf398f059d6e6224c7950def4 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: