Introduction à OpenID Connect

A propos de moi

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

A propos de moi

  • Néo conférencier
  • Pensée à l'équipe de Volcamp

On va parler de ...

  • OAuth2.0
  • Authentification
  • Autorisation
  • OpenID Connect

Ce qu'on ne fera pas

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

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

Implémentations

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 ?

Implémentations

  • https://github.com/bshaffer/oauth2-server-php
  • https://github.com/thephpleague/oauth2-server (en cours...)

En PHP il y en a peu...

Pour résumer...

Merci à

Pascal Martin

https://blog.pascal-martin.fr/tags/conference/

Pour ses articles qui m'ont aidé à préparer cette conférence

Merci à

Vincent Chalamon

https://afup.org/p/1061-accompagnement-speakers

Pour son accompagnement et ses conseils

Merci à

l'AFUP et à son bureau

Karim PINCHON - @kpn13

Merci pour votre attention !

https://joind.in/talk/a2e65

A table !