# Configurer l’OIDC sur keycloack pour un Service Web

Cette section vous guidera dans la configuration de l'authentification via OIDC avec Keycloak

## Configuration du client

1. Allez sur la page "Clients" et cliquez sur le bouton "Create" :&#x20;

<figure><img src="https://lh7-qw.googleusercontent.com/docsz/AD_4nXe9a2pi_LxpcglWT41sxYZ3ROj_Wf5cskXibw86_BwCHsC7TukpRunrd1wyy0lrLjCBzzl5_RbjG4eQx-rrCsZuKnXSZmlOL1kF81cO6FflmRgyzuBhupI7y3Xki1zXzqs3PEBRm6yMv9tUvmYOcx9kDPE?key=_7omhS_ZQ-TvWJo5H9s0Bg" alt="" width="563"><figcaption></figcaption></figure>

2. &#x20;Attribuez un nom au “Client ID” (nécessaire pour la configuration sur le BMS).
3. &#x20;Définissez le “Access Type” sur “confidential”.
4. Définissez “Service Accounts Enabled” sur “true”.

<figure><img src="https://lh7-qw.googleusercontent.com/docsz/AD_4nXceD1tGfXSSDh9C9o1AsoPtJSZjw62g7zoW_tBa_xL9VM9woW1exjymRsnFtjDk0cuVuC2Up8bHPNbT0xN7JCDsCaxFAxpylbdb9q283kUATnILcgtorKSsLJkpVixaY5eV3k2x59JCw4VlAE72io0o0pbw?key=_7omhS_ZQ-TvWJo5H9s0Bg" alt="" width="563"><figcaption></figcaption></figure>

5. &#x20;Ajoutez “Root URL”, “Valid Redirect URLs”, “Admin URL”, et “Web Origins” avec l’adresse du BMS où se trouve le Web Service. Dans l'exemple ci-dessous, dev.mars :

<figure><img src="https://lh7-qw.googleusercontent.com/docsz/AD_4nXexInzhoHAblJAHL7U5s3DcxArbyoB7-eX8aZTIoFBO9kNuSkRHUHQiXcUdp4ORJ0B7f_4C7oBj9xyjbuzDEmflXaZSOpcY4UeBzh4uUKa4W19Ss22zYxIaN0oyuWIxgNW9Cnwakand__x6Nn4ErdniHuBZ?key=_7omhS_ZQ-TvWJo5H9s0Bg" alt="" width="563"><figcaption></figcaption></figure>

6. Cliquez sur “Save” en bas de la page.

<figure><img src="https://lh7-qw.googleusercontent.com/docsz/AD_4nXfyrCJa-7LziPfuRNvfQ5acng3PZsI9nC_yoSVNaUda366b9J2nmztNULl_jGiEmgi2ZpXq-oEo4-gT6BsNMJywSDNRke4c75mmEpAiTsZaNNhnR4tFLUo6G7FKq3TwFTGLmUjTs862CC1TyFEKys8NWNch?key=_7omhS_ZQ-TvWJo5H9s0Bg" alt="" width="563"><figcaption></figcaption></figure>

## Configuration de l'authentification du Service Web du BMS

#### Récupérer le Client Secret

Accédez à l'onglet “Credentials” du client et récupérez le secret (nécessaire pour la configuration dans le BMS).

<figure><img src="https://lh7-qw.googleusercontent.com/docsz/AD_4nXfdW3OBIYRR5lpcsbmZ3pLlZVGLHDBIOwLFmiO7gNcDz5Sv28UPEEsvE_YSLI7ma0tZjDmATaE1mxyjPfXBCDgD5SoctVYdTTBXFVjuHNH_yISW4FpJjtHKyxPYwG51HlZNfRUj5BWYezxpw7q0542Bs7Dd?key=_7omhS_ZQ-TvWJo5H9s0Bg" alt="" width="563"><figcaption></figcaption></figure>

#### Récupérer l'URL du token

1. Accédez à “Realm Settings”.

<figure><img src="https://lh7-qw.googleusercontent.com/docsz/AD_4nXf11fGkTEpM_VmC9dZJVjWVaqQ-YEgq6xq7AhtNZ_PGDcO3gTYqn5ucdauXcDDDPQLoFNEZ4i76akLr0mMrvl4_oPGzTQ42EAj0EEasD51U2dZepT6-7zc_Yq70AEBkP5o-I-Y19ed9HDDSiSXNNKsVEtXc?key=_7omhS_ZQ-TvWJo5H9s0Bg" alt="" width="563"><figcaption></figcaption></figure>

2. Cliquez sur “OpenID Endpoint Configuration”.

<figure><img src="https://lh7-qw.googleusercontent.com/docsz/AD_4nXdXo7UdLWltBlJeqC1xe_1ZCD8_N5IY0U3cIcyFwM7DY1UU6nmM9WExoREmiGuJK25au-VaaN9Wr6DOu36OqjBDhfNBEZnphIl-81MpVI9UbI5j8EBo_NjHric_p6jwy9e954pXGfZS7jt_nBofNGnxlX7P?key=_7omhS_ZQ-TvWJo5H9s0Bg" alt="" width="563"><figcaption></figcaption></figure>

3. En bas du fichier, localisez “token\_endpoint”.
4. Copiez la valeur pour la configurer dans le BMS.

<figure><img src="https://lh7-qw.googleusercontent.com/docsz/AD_4nXcYz5JGn1W1__OnKm0vOx9IWfO60cSOYEZoawNIk5wHQAsbqOD77h6HrgtAMqiqxuh5T6XO8qEcCWRJLAOhRz3-HsME0qlSNduUfi2nwj9x0mRw0ZXX9Y5QBFId7mwpth7I7U-EqyBSsV_d3qrjJmpLzdb9?key=_7omhS_ZQ-TvWJo5H9s0Bg" alt=""><figcaption></figcaption></figure>

Il ne vous reste plus qu'à vous rendre sur le BMS et remplir les champs suivants :

<figure><img src="https://lh7-qw.googleusercontent.com/docsz/AD_4nXe7tm2tJhB7mY2KWEkULB4eUbaOXPtXNseE2mjW1yhC__dq2FASIv8r3IMoZRogTlYv_tUOJkBdtqtr_ZHWewkdICtQ5qiwY0Vp8qXmYh6_O0y18iZDNPVlGyUBsu7FR-1QxBW6w7_eUp4H7oqc8M8yIsgq?key=_7omhS_ZQ-TvWJo5H9s0Bg" alt="" width="563"><figcaption></figcaption></figure>

* **URL du token** : Pour le récupérer il suffit de suivre ces [étapes](#recuperer-lurl-du-token)
* **ID du Client** : Configuré lors de la [création du Client](#configuration-du-client)
* **Client Secret** : Pour le récupérer il suffit de suivre cette [étape](#recuperer-le-client-secret)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dydu.ai/contenus/web-services/configurer-loidc-sur-keycloack-pour-un-service-web.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
