Introduction à OpenID Connect

A propos de moi

  • Karim Pinchon
  • Développeur depuis ~10 ans
  • Actuellement chez
  • @kpn13

On va parler de ...

  • pourquoi OAuth2 pour l'authentification c'est non
  • en quoi OIDC est différent

Ce qu'on ne fera pas

  • un cours sur OAuth2.0 ou OIDC
  • rentrer dans les détails d'implémentation

OAuth 2.0

  • délégation d’autorisation
  • authentification

Exemples

  • Tweetdeck
  • CPA
  • ...

Terminologie

  • Resource owner
  • Resource server
  • Authorization server
  • Client

Quels acteurs ?

Terminologie

  • Access Token
  • Refresh Token

Quels jetons ?

Grants

  • authorization code
  • client credentials
  • password credentials
  • implicit

Grant flow

Client

Authorization server

Resource server

Resource owner

Request client authorization

Authorize the client

Redirect with authorization code

Request access token using the code and credentials

Return access token / refresh token

Request protected resource using access token

PKCE

  • App native
  • SPA

Proof Key for Code Exchange

"PIXI"

Auth code with PKCE

Client

Authorization server

Resource server

Resource owner

Request client authorization

Authorize the client

Redirect with authorization code

Request access token using the auth code

Return access token / refresh token

Request protected resource using access token

Generate code, hash it and send with authorization request

Receive the code and save it

Send the code (not hashed)

Hash the code received and compare to the saved hashed code

Mais quel est le problème avec l'authentification ?

Et OpenID Connect, c'est quoi ?

Différences...

... de terminologie

OAuth2.0 OpenID Connect
Client Relying Party
Authorization Server Identity Provider

Différences...

... de grant flow

Mais pas tant que ça !

  • authorization code
  • implicit
  • hybrid

Différences...

... de jeton

id_token

Id_token

JWT

JWS

JWE

Id_token

{
  "typ": "JWT",
  "alg": "HS256"
}  
{
   "iss": "https://server.example.com",
   "sub": "24400320",
   "aud": "s6BhdRkqt3",
   "nonce": "n-0S6_WzA2Mj",
   "exp": 1602791273,
   "iat": 1602791273,
   "name": "Jane Doe",
   "given_name": "Jane",
   "family_name": "Doe"
}

+ signature

 

Id_token

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL3NlcnZlci5leGFtcGxlLmNvbSIsImlhdCI6MTYwMjc5MTI3MywiZXhwIjoxNjM0MzI3MjczLCJhdWQiOiJzNkJoZFJrcXQzIiwic3ViIjoiMjQ0MDAzMjAiLCJub25jZSI6Im4tMFM2X1d6QTJNaiIsIm5hbWUiOiJhbmUgRG9lIiwiZ2l2ZW5fbmFtZSI6IkphbmUiLCJmYW1pbHlfbmFtZSI6IkRvZSJ9.YMHmas3dqMLhwD9WIymIrcwnAjgyU309Aak7n1BlUb0
  • info sur l'utilisateur connecté
  • JSON ou JWT
  • autorisé via access_token

UserInfo endpoint

  • création
  • consultation
  • modification

Dynamic client registration endpoint

  • données de configuration
  • endpoints
  • scopes supportés
  • algo de signature / chiffrement

Discovery endpoint

  • accès offline
  • gestion de session
  • ...

Autres choses ?

Pour résumer...

Karim PINCHON - @kpn13

Merci pour votre attention !

Introduction à OpenID Connect - JUG Summer Camp 2021

By Karim PINCHON

Introduction à OpenID Connect - JUG Summer Camp 2021

"T'as besoin d'une application pour authentifier tes utilisateurs ? Un serveur OAuth2 c'est ce qu'il te faut !" C'est faux. Trop souvent le protocole OAuth2 est utilisé à tord pour authentifier des utilisateurs. Ce n'est pas fait pour ça. En revanche, un protocole relativement semblable existe dans ce but : OpenID Connect. Je vous propose de vous expliquer comment fonctionne le protocole OpenID Connect et en quoi il est différent d'OAuth2, pour ne plus se tromper d'usage.

  • 687