LoginSignup
12
8

More than 1 year has passed since last update.

OpenID ConnectとOAuth 2.0の仕様とエンドポイント・パラメータ総まとめ(途中)

Last updated at Posted at 2021-05-07

目的

OpenID Connect (略してOIDC) の活用方法を調べていて、たくさん存在している仕様文書に埋もれて迷子になってしまったので、自分用にまとめておきます。特に、エンドポイントごとに、どういったパラメータが存在しているのかは、一覧としてまとまっている物が 見当たらなかったので、 まとめてみました。時間をかけて少しずつ付け足して行ければと思います。

なお、パラメータは、必須のもの、推奨のもの、任意のものとありますが、それぞれ、フローやプロファイルによって、必須、不要など変わってくるので、一律記載することはしません。

そもそも作る必要が無かった可能性

OAuth Parameters にほぼ全部載ってた。(大体まとめ終わった後で気付いた)

とはいえOIDC固有のものとか、Draft状態のものとか、一部載っていない物もあるので、ここにまとめる価値も少しはあると信じて。
少なくとも自分の勉強にはなりました。

一応目次(右にもあるけど)

※ 括弧書きで典型的なendpointのpathを記載していますが、実際にはMetadataで自由に指定できる物がほとんど。

参考文書

OAuth 2.0や、OpenID Connectが何たるかは、 @TakahikoKawasaki 先生のエントリを参考にしてください。私も延べ100回ぐらいは読み返していると思います。

OAuth 2.0 の仕様一覧 (IETF)

IETF OAuth WGで策定されている仕様は、 @ritou 先生がまとめてくださっているので、そちらを参照してください。

OpenID Connect の仕様一覧

OpenID Foundationが策定しているOAuth 2.0 の拡張仕様一覧

補足 仕様文書の種類

文書化された定義が見つからなくて、もしご存じの方がいたら教えて頂きたいのですが、私の理解では、大きく分けて下記4種類の仕様文書があると思います。

Core 仕様
RFC6749やOIDC Coreのように、本家本元の仕様
拡張仕様 (Extension)
本家本元の仕様にパラメータなどを追加して機能を拡張する仕様
※まぁOIDCもRFC6749の拡張ではある
プロファイル (Profile)
FAPIのように、既存の仕様(Extension含む)の設定値を取り決めたもの。OAuthやOIDCには多種多様なフロー、任意のパラメータが存在している。それらに制約を入れることで、相互接続性を向上させたり、セキュリティを強化する効果がある。
非仕様文書
ベストプラクティスや攻撃モデルなど、実装に当たり参考にすべきもの

エンドポイントの一覧

Authorization Endpoint (/authorize)

リクエスト

パラメータ 仕様 備考
response_type RFC 6749 code token など
client_id RFC 6749
redirect_uri RFC 6749 OIDCでは必須
scope RFC 6749
state RFC 6749
response_mode OIDC Core OAuth 2.0 Multiple Response Type Encoding Practices としてOAuthを拡張
nonce OIDC Core
display OIDC Core
prompt OIDC Core
max_age OIDC Core
ui_locales OIDC Core
login_hint OIDC Core
claims OIDC Core
acr_values OIDC Core
request OIDC Core
request_uri OIDC Core
registration OIDC Core
code_challenge RFC 7636 いまどき必須なPKCE
code_challenge_method RFC 7636 いまどき必須なPKCE
resource RFC 8707
login_hint_token OIDC MODRNA
binding_message OIDC MODRNA

レスポンス(正常)

※ レスポンスは redirect_uri に付加されたクエリパラメータやフラグメントとして返却される

パラメータ 仕様 備考
code RFC 6749
state RFC 6749
access_token RFC 6749 implicit flow の場合
token_type RFC 6749 implicit flow の場合
expires_in RFC 6749 implicit flow の場合
scope RFC 6749 implicit flow の場合
session_state OIDC Session Management

レスポンス(エラー)

パラメータ 仕様 備考
error RFC 6749
error_description RFC 6749
error_uri RFC 6749
state RFC 6749
interaction_required OIDC Core prompt=none の場合
login_required OIDC Core prompt=none の場合
account_selection_required OIDC Core prompt=none の場合
consent_required OIDC Core prompt=none の場合
invalid_request_uri OIDC Core
invalid_request_object OIDC Core
request_not_supported OIDC Core
request_uri_not_supported OIDC Core
registration_not_supported OIDC Core

Token Endpoint (/token)

リクエスト

パラメータ 仕様 備考
grant_type RFC 6749
code RFC 6749
redirect_uri RFC 6749
client_id RFC 6749
client_secret RFC 6749 通常はAuthorizationヘッダーを使う
username RFC 6749 Resource Owner Password Credentials Flow の場合
password RFC 6749 Resource Owner Password Credentials Flow の場合
scope RFC 6749
refresh_token RFC 6749
assertion RFC 7521 RFC 6749 にも言及はあり
client_assertion_type RFC 7521
client_assertion RFC 7521
client_assertion_type RFC 7521
code_verifier RFC 7636 いまどき必須なPKCE
resource RFC 8707
audience RFC 8693
requested_token_type RFC 8693
subject_token RFC 8693
subject_token_type RFC 8693
actor_token RFC 8693
actor_token_type RFC 8693
issued_token_type RFC 8693

レスポンス(正常)

※ レスポンスは通常JSONとして返却される

パラメータ 仕様 備考
access_token RFC 6749
token_type RFC 6749
expires_in RFC 6749
refresh_token RFC 6749
scope RFC 6749

レスポンス(エラー)

パラメータ 仕様 備考
error RFC 6749
error_description RFC 6749
error_uri RFC 6749

Userinfo Endpoint (/userinfo)

リクエスト

RFC 6750 に従い、 access_token を Authorization ヘッダーにつけてリクエストする。そのほかのパラメータは不要。

レスポンス(正常)

※ レスポンスは通常JSONまたはJWTとして返却される
中身(claim)は id_token とほぼ同様。

レスポンス(エラー)

  • RFC 6750 に従い、 WWW-Authenticate ヘッダーに記載される

IDトークン (id_token)

エンドポイントではないが、IDトークンも重要な情報なのでまとめておきます。
IDトークンの中身は、それぞれクレーム(claim)と呼ばれます。
中身の解説は IDトークンが分かれば OpenID Connect が分かる - Qiita を参照してください。

パラメータ 仕様 備考
iss OIDC Core
sub OIDC Core
aud OIDC Core
exp OIDC Core
iat OIDC Core
auth_time OIDC Core
nonce OIDC Core
acr OIDC Core
amr OIDC Core
azp OIDC Core
at_hash OIDC Core
c_hash OIDC Core
_claim_names OIDC Core
_claim_sources OIDC Core
given_name OIDC Core
family_name OIDC Core
middle_name OIDC Core
nickname OIDC Core
preferred_username OIDC Core
profile OIDC Core
picture OIDC Core
website OIDC Core
email OIDC Core
email_verified OIDC Core
gender OIDC Core
birthdate OIDC Core
zoneinfo OIDC Core
locale OIDC Core
phone_number OIDC Core
phone_number_verified OIDC Core
address OIDC Core StringではなくJSONなので注意
updated_at OIDC Core
sid OIDC Front-Channel Logout session ID ログアウト時に利用
place_of_birth OIDC eKYC-IDA
nationalities OIDC eKYC-IDA
birth_family_name OIDC eKYC-IDA
birth_given_name OIDC eKYC-IDA
birth_middle_name OIDC eKYC-IDA
salutation OIDC eKYC-IDA
title OIDC eKYC-IDA
msisdn OIDC eKYC-IDA 携帯電話番号
verified_claims OIDC eKYC-IDA
aka OIDC Account Porting

Authorization Server Metadata (/.well-known/oauth-authorization-server)

OIDC Discovery が先に出てきて、あとからOAuth 2.0 (RFC 8414)に取り込まれたタイプ。

OIDC に対応するサーバは /.well-known/openid-configuration で公開する場合もあるが、コレもRFC 8414 の規定の範囲内

あとOIDCだと/.well-knownの前にパスが含まれる事も許容される。

リクエスト

普通に GET する

レスポンス(正常)

※ レスポンスは通常JSONまたはJWTとして返却される

パラメータ 仕様 備考
issuer RFC 8414
authorization_endpoint RFC 8414
token_endpoint RFC 8414
jwks_uri RFC 8414
registration_endpoint RFC 8414
scopes_supported RFC 8414
response_types_supported RFC 8414
response_modes_supported RFC 8414
grant_types_supported RFC 8414
token_endpoint_auth_methods_supported RFC 8414
token_endpoint_auth_signing_alg_values_supported RFC 8414
service_documentation RFC 8414
ui_locales_supported RFC 8414
op_policy_uri RFC 8414
op_tos_uri RFC 8414
revocation_endpoint RFC 8414
revocation_endpoint_auth_methods_supported RFC 8414
revocation_endpoint_auth_signing_alg_values_supported RFC 8414
introspection_endpoint RFC 8414
introspection_endpoint_auth_methods_supported RFC 8414
introspection_endpoint_auth_signing_alg_values_supported RFC 8414
code_challenge_methods_supported RFC 8414
userinfo_endpoint OIDC Discovery
acr_values_supported OIDC Discovery
subject_types_supported OIDC Discovery
id_token_signing_alg_values_supported OIDC Discovery
id_token_encryption_alg_values_supported OIDC Discovery
id_token_encryption_enc_values_supported OIDC Discovery
userinfo_signing_alg_values_supported OIDC Discovery
userinfo_encryption_alg_values_supported OIDC Discovery
userinfo_encryption_enc_values_supported OIDC Discovery
request_object_signing_alg_values_supported OIDC Discovery
request_object_encryption_alg_values_supported OIDC Discovery
request_object_encryption_enc_values_supported OIDC Discovery
display_values_supported OIDC Discovery
claim_types_supported OIDC Discovery
claims_supported OIDC Discovery
claims_locales_supported OIDC Discovery
claims_parameter_supported OIDC Discovery
request_parameter_supported OIDC Discovery
request_uri_parameter_supported OIDC Discovery
require_request_uri_registration OIDC Discovery
frontchannel_logout_supported OIDC Front-Channel Logout
frontchannel_logout_session_supported OIDC Front-Channel Logout
backchannel_logout_supported OIDC Back-Channel Logout
backchannel_logout_session_supported OIDC Back-Channel Logout
end_session_endpoint OIDC RP-Initiated Logout
verified_claims_supported OIDC eKYC-IDA
trust_frameworks_supported OIDC eKYC-IDA
evidence_supported OIDC eKYC-IDA
id_documents_supported OIDC eKYC-IDA
id_documents_verification_methods_supported OIDC eKYC-IDA
claims_in_verified_claims_supported OIDC eKYC-IDA
verified_claims_supported OIDC eKYC-IDA
client_registration_types_supported OIDC Federation
organization_name OIDC Federation
federation_registration_endpoint OIDC Federation
request_authentication_methods_supported OIDC Federation
port_data_endpoint OIDC Account Porting
port_check_endpoint OIDC Account Porting
port_enc_values_supported OIDC Account Porting

Client Registration Endpoint (/register)

これも、OIDC Registration が先に出てきて、あとからOAuth 2.0 (RFC 7591)に取り込まれたタイプ。

リクエスト

JSONで送る

パラメータ 仕様 備考
redirect_uris RFC 7591
token_endpoint_auth_method RFC 7591
response_types RFC 7591
grant_types RFC 7591
application_type OIDC Registration
contacts RFC 7591
client_name RFC 7591
logo_uri RFC 7591
scope RFC 7591
client_uri RFC 7591
policy_uri RFC 7591
tos_uri RFC 7591
jwks_uri RFC 7591
jwks RFC 7591
sector_identifier_uri OIDC Registration
subject_type OIDC Registration
id_token_signed_response_alg OIDC Registration
id_token_encrypted_response_alg OIDC Registration
id_token_encrypted_response_enc OIDC Registration
userinfo_signed_response_alg OIDC Registration
userinfo_encrypted_response_alg OIDC Registration
userinfo_encrypted_response_enc OIDC Registration
request_object_signing_alg OIDC Registration
request_object_encryption_alg OIDC Registration
request_object_encryption_enc OIDC Registration
token_endpoint_auth_signing_alg OIDC Registration
default_max_age OIDC Registration
require_auth_time OIDC Registration
default_acr_values OIDC Registration
initiate_login_uri OIDC Registration
request_uris OIDC Registration
software_id RFC 7591
software_version RFC 7591
software_statement RFC 7591
frontchannel_logout_uri OIDC Front-Channel Logout
frontchannel_logout_session_required OIDC Front-Channel Logout
backchannel_logout_uri OIDC Back-Channel Logout
backchannel_logout_session_required OIDC Back-Channel Logout
post_logout_redirect_uris OIDC RP-Initiated Logout
client_registration_types OIDC Federation
organization_name OIDC Federation

レスポンス

JSONで返却される。リクエストの内容もレスポンスに含む場合がある

パラメータ 仕様 備考
client_id OIDC Registration
client_secret OIDC Registration
registration_access_token OIDC Registration
registration_client_uri OIDC Registration
client_id_issued_at OIDC Registration
client_secret_expires_at OIDC Registration

レスポンス(エラー)

JSONで返却される

パラメータ 仕様 備考
error RFC 7591
error_description RFC 7591
invalid_redirect_uri RFC 7591
invalid_client_metadata RFC 7591
invalid_software_statement RFC 7591
unapproved_software_statement RFC 7591

Token Introspection Endpoint (/introspect)

リクエスト

パラメータ 仕様 備考
token RFC 7662
token_type_hint RFC 7662

レスポンス

JSONで返却される

パラメータ 仕様 備考
active RFC 7662
scope RFC 7662
client_id RFC 7662
username RFC 7662
token_type RFC 7662
exp RFC 7662
iat RFC 7662
nbf RFC 7662
sub RFC 7662
aud RFC 7662
iss RFC 7662
jti RFC 7662

Front-Channel Logout (/frontchannel_logout)

リクエスト

iframeでURLを埋め込む

パラメータ 仕様 備考
iss OIDC Front-Channel Logout
sid OIDC Front-Channel Logout

Back-Channel Logout (/backchannel_logout)

リクエスト

IDトークン形式で logout_tokenを作ってPOSTで送信する

パラメータ 仕様 備考
iss OIDC Back-Channel Logout
sub OIDC Back-Channel Logout
aud OIDC Back-Channel Logout
iat OIDC Back-Channel Logout
jti OIDC Back-Channel Logout
events OIDC Back-Channel Logout
sid OIDC Back-Channel Logout

RP-Initiated Logout (/logout)

リクエスト

IDトークン形式で logout_tokenを作ってPOSTで送信する

パラメータ 仕様 備考
id_token_hint OIDC RP-Initiated Logout
post_logout_redirect_uri OIDC RP-Initiated Logout
state OIDC RP-Initiated Logout
ui_locales OIDC RP-Initiated Logout
XXX OIDC RP-Initiated Logout

Federation Entity Configuration (/.well-known/openid-federation)

リクエスト

普通に GET する

レスポンス(正常)

※ レスポンスはJOSEとして返却される

パラメータ 仕様 備考
iss OIDC Federation
sub OIDC Federation
iat OIDC Federation
exp OIDC Federation
jwks OIDC Federation
aud OIDC Federation
authority_hints OIDC Federation
metadata OIDC Federation
metadata_policy OIDC Federation
constraints OIDC Federation
crit OIDC Federation
policy_language_crit OIDC Federation
trust_marks OIDC Federation
trust_anchor_id OIDC Federation

Federation API Endpoint (/federation_api_endpoint)

リクエスト

パラメータ 仕様 備考
operation OIDC Federation
iss OIDC Federation
sub OIDC Federation
aud OIDC Federation
respondent OIDC Federation
peer OIDC Federation
type OIDC Federation
anchor OIDC Federation
is_leaf OIDC Federation

レスポンス(正常)

Fetching Entity Statements

※ レスポンスはJOSEとして返却される。中身はFederation Entity Configurationと同様。

Trust Negotiation

※ レスポンスはJSONとして返却される。中身はMetadataと同様。

Entity Listing

※ レスポンスはJSONとして返却される。

レスポンス(エラー)

JSONで返却される

パラメータ 仕様 備考
operation OIDC Federation
error OIDC Federation
error_description OIDC Federation

Porting data API Endpoint (/connect/port_data/me)

アカウント移行前の旧OPが提供し、移行後の新OPがアクセスする

リクエスト

GETリクエスト
新OPは、事前に旧OPに対しOAuth 2.0 (Authorization Code flow)でユーザの許諾を得てアクセストークンを取得しておく。

レスポンス

パラメータ 仕様 備考
port_token OIDC Account Porting

Porting check API Endpoint (/connect/port_check)

アカウント移行前の旧OPが提供し、RPがアクセスする

リクエスト

パラメータ 仕様 備考
iss OIDC Account Porting
enc_port_token OIDC Account Porting

レスポンス

パラメータ 仕様 備考
sub OIDC Account Porting
aka OIDC Account Porting
remove OIDC Account Porting
12
8
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
8