#nore OpenID に関連した実装をすることになったので OpenID についてついでに勉強した際の関連情報など 基本的な仕様書 [OpenID Connect Core 1.0 incorporating errata set 1](https://openid.net/specs/openid-connect-core-1_0.html) OpenID Connect 自体は OAuth 2.0 の拡張であると書かれている > OpenID Connect 1.0 is a simple identity layer on top of the OAuth 2.0 protocol. It allows Clients to verify the identity of the End-User based on the authentication performed by an Authorization Server, as well as to obtain basic profile information about the End-User in an interoperable and REST-like manner. [https://openid.net/connect/](https://openid.net/connect/) したがって、以下の RFC の上に OpenID Connect は構築されている [RFC6749 The OAuth 2.0 Authorization Framework (日本語)](https://openid-foundation-japan.github.io/rfc6749.ja.html) [RFC6750 The OAuth 2.0 Authorization Framework: Bearer Token Usage(日本語)](https://openid-foundation-japan.github.io/rfc6750.ja.html) OpenID の拡張ポイントとしては、アプリケーションなどから簡単に利用可能にするということらしい。 > OpenID Connect performs many of the same tasks as OpenID 2.0, but does so in a way that is API-friendly, and usable by native and mobile applications. OpenID Connect defines optional mechanisms for robust signing and encryption. Whereas integration of OAuth 1.0a and OpenID 2.0 required an extension, in OpenID Connect, OAuth 2.0 capabilities are integrated with the protocol itself. IDトークンというのが特殊であり、これは JSON Web Token (JWT, ジョット) 形式で表現されている。 ちなみに JWT は [RFC7519](https://tex2e.github.io/rfc-translater/html/rfc7519.html) にて仕様がまとめられている。 > The primary extension that OpenID Connect makes to OAuth 2.0 to enable End-Users to be Authenticated is the ID Token data structure. The ID Token is a security token that contains Claims about the Authentication of an End-User by an Authorization Server when using a Client, and potentially other requested Claims. The ID Token is represented as a JSON Web Token (JWT). OAuth2.0 に対しての拡張ポイントとしては、IDトークンのデータ構造が主なコミットメントになっている IDトークンは、OAuth2.0 で定義されている claim のいくつかの必須に設定している ## Required - iss (issuer) - sub (subject) - aud (audience) - exp (expiration time) - iat (issued at) - auth_time - Time when the End-User authentication occurred ## Optional - nonce - acr (Authentication Context Class Reference) - amr (Authentication Methods References) - azp (Authorized Party) [ユーザー属性 claim](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) - sub - name - given_name - family_name - middle_name - nickname - preferred_username - profile - picture - website - email - email_verified - gender - birthdate - zoneinfo - locale - phone_number - phone_number_verified - address - updated_at また多言語への対応として、 [http://openid.net/specs/openid-connect-core-1_0.html#ClaimsLanguagesAndScripts](http://openid.net/specs/openid-connect-core-1_0.html#ClaimsLanguagesAndScripts) のように `#言語タグ` を付与することがある ## その他の参考文献 [一番分かりやすい OpenID Connect の説明](https://qiita.com/TakahikoKawasaki/items/498ca08bbfcc341691fe) [IDトークンが分かれば OpenID Connect が分かる](https://qiita.com/TakahikoKawasaki/items/8f0e422c7edd2d220e06) [OpenID Connect 全フロー解説](https://qiita.com/TakahikoKawasaki/items/4ee9b55db9f7ef352b47) [https://www.youtube.com/watch?v=PKPj_MmLq5E](https://www.youtube.com/watch?v=PKPj_MmLq5E) [【電子版】雰囲気でOAuth2.0を使っているエンジニアがOAuth2.0を整理して、手を動かしながら学べる本](https://booth.pm/ja/items/1296585) [多分わかりやすいOpenID Connect](https://tech-lab.sios.jp/archives/8651)