diff --git a/authentification.md b/authentification.md new file mode 100644 index 0000000..f439c38 --- /dev/null +++ b/authentification.md @@ -0,0 +1,54 @@ +# 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_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=&rclient_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_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=' \ + --data 'client_secret=' \ + --data 'code=4901feab4aead50dba657d19afbf18bf' \ + --data 'redirect_uri=https://test1.cadoles.lan' +```