specification/authentification.md

1.9 KiB

Authentification

L'utilisation de Risotto nécessite un système d'authentification. Afin de gérer l'authentification, le système doit délivrer un jeton permettant de valider l'utilisateur avec l'IDP. Les normes Oauth2 et notamment OIDC sont a envisager.

Le token servira à authentifier l'utilisateur, récupérer ses informations, et ainsi définir sa portée et ses droits.

Le token devra être renouvellé régulièrement afin de garantir la sécurité de l'applicatif.

Exemple avec LemonLDAP et OIDC

Demande de code d'authorization

  • HTTP :
    GET /oauth2/authorize?scope=openid&response_type=code&client_id=<CLIENT-ID>&client_secret=<CLIENT-SECRET>&redirect_uri=https://test1.cadoles.lan HTTP/1.1
    Host: auth.cadoles.lan:443
  • cURL :
    curl -L -k  https://auth.cadoles.lan/oauth2/authorize?scope=openid&response_type=code&client_id=<CLIENT-ID>&rclient_secret=<CLIENT-SECRET>&redirect_uri=https://test1.cadoles.lan

Réponse :

    302 Found
    to: https://test1.cadoles.lan?
        code=61ac08c00acf2db3ec86ee3927198812&
        session_state=xSSAehr9Tw13CxwkJdD4fPK%2FdIs9bsE1svdNYPaV4Kk%3D.Q0FxaHI5TDlTVk91WHdEdm1qU1FTK3N1Q2FuZitia2dQUjcwdThsTWNsNjkxcU15bE4yQS91U2NsTFdKeUF6SDFCMEU2MTJad1M2a2lubkhMdTJqclE9PQ

Récupération du token

  • HTTP :
    GET /oauth2/authorize?scope=openid&response_type=code&client_id=<CLIENT-ID>&client_secret=<CLIENT-SECRET>&redirect_uri=https://test1.cadoles.lan HTTP/1.1
    Host: auth.cadoles.lan:443
  • cURL :
    curl -L -k --request POST \
    --url 'https://auth.cadoles.lan/oauth2/token' \
    --header 'content-type: application/x-www-form-urlencoded' \
    --data 'grant_type=authorization_code' \
    --data 'client_id=<CLIENT-ID>' \
    --data 'client_secret=<CLIENT-SECRET>' \
    --data 'code=4901feab4aead50dba657d19afbf18bf' \
    --data 'redirect_uri=https://test1.cadoles.lan'