LoginSignup
1
1

More than 3 years have passed since last update.

Open ID Connect Dynamic Client Registration メモ

Posted at
  • クライアント(RP)が、認可サーバー(OP)に、動的にクライアント登録を行うためのための処理。個人用備忘録記事。

クライアントメタ情報(Client Metadata)

  • クライアントは、認可サーバーで一意の識別子(ID)に関連付けたメタデータを保持する。

    • このメタデータには、クライアント名などの人間が識別するための表示用文字列から、有効なリダイレクトURIのリストなど、プロトコルのセキュリティに影響を与える項目が含まれる。
  • 以下は必須パラメータ。ほかにも多数の項目あり。

パラメータ 説明
redirect_uris redirect_uriの配列

クライアント登録エンドポイント(Client Registration Endpoint)

  • クライアントを認可サーバーに登録するためのエンドポイント。
  • HTTP POSTリクエストを受け付ける。

登録リクエスト

いくつか指定できるパラメータがあるが、必須のものは以下になる。

パラメータ 説明
redirect_uris redirect_uriの配列
 POST /connect/register HTTP/1.1
 Content-Type: application/json
 Accept: application/json
 Host: server.example.com
 Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJ ...
 {
  "application_type": "web",
  "redirect_uris":
    ["https://client.example.org/callback",
     "https://client.example.org/callback2"],
  "client_name": "My Example",
  "client_name#ja-Jpan-JP":
    "クライアント名",
  "logo_uri": "https://client.example.org/logo.png",
  "subject_type": "pairwise",
  "sector_identifier_uri":
    "https://other.example.net/file_of_redirect_uris.json",
  "token_endpoint_auth_method": "client_secret_basic",
  "jwks_uri": "https://client.example.org/my_public_keys.jwks",
  "userinfo_encrypted_response_alg": "RSA1_5",
  "userinfo_encrypted_response_enc": "A128CBC-HS256",
  "contacts": ["ve7jtb@example.org", "mary@example.org"],
  "request_uris":
    ["https://client.example.org/rf.txt
      #qpXaRLh_n93TTR9F252ValdatUQvQiJi5BDub2BeznA"]
 }

登録レスポンス

以下の値は必ず返却されるパラメータ。これら以外にもパラメータあり。

パラメータ 説明
client_id 登録したクライアントのID
client_secret_expires_at (client_secret発行時のみ返却する)client_secretが期限切れになる時刻。
 HTTP/1.1 201 Created
  Content-Type: application/json
  Cache-Control: no-store
  Pragma: no-cache

  {
   "client_id": "s6BhdRkqt3",
   "client_secret":
     "ZJYCqe3GGRvdrudKyZS0XhGv_Z45DuKhCUk0gBR1vZk",
   "client_secret_expires_at": 1577858400,
   "registration_access_token":
     "this.is.an.access.token.value.ffx83",
   "registration_client_uri":
     "https://server.example.com/connect/register?client_id=s6BhdRkqt3",
   "token_endpoint_auth_method":
     "client_secret_basic",
   "application_type": "web",
   "redirect_uris":
     ["https://client.example.org/callback",
      "https://client.example.org/callback2"],
   "client_name": "My Example",
   "client_name#ja-Jpan-JP":
     "クライアント名",
   "logo_uri": "https://client.example.org/logo.png",
   "subject_type": "pairwise",
   "sector_identifier_uri":
     "https://other.example.net/file_of_redirect_uris.json",
   "jwks_uri": "https://client.example.org/my_public_keys.jwks",
   "userinfo_encrypted_response_alg": "RSA1_5",
   "userinfo_encrypted_response_enc": "A128CBC-HS256",
   "contacts": ["ve7jtb@example.org", "mary@example.org"],
   "request_uris":
     ["https://client.example.org/rf.txt
       #qpXaRLh_n93TTR9F252ValdatUQvQiJi5BDub2BeznA"]
  }

クライアント設定エンドポイント(Client Configuration Endpoint)

  • 登録済みクライアントの情報を管理(取得/更新)できるエンドポイント。

  • このエンドポイントのURLは、認可サーバーからクライアント登録時に返却される。

読み取り(Read)

  • HTTP GET リクエストによって現在のクライアント状態を取得する。
  • Authorizationヘッダーに設定するトークンは、クライアント登録時にレスポンスに付与されたregistration_access_tokenを指定する。

読み取りリクエスト例

  GET /connect/register?client_id=s6BhdRkqt3 HTTP/1.1
  Accept: application/json
  Host: server.example.com
  Authorization: Bearer this.is.an.access.token.value.ffx83

読み取りレスポンス例

  HTTP/1.1 200 OK
  Content-Type: application/json
  Cache-Control: no-store
  Pragma: no-cache
  {
   "client_id": "s6BhdRkqt3",
   "client_secret":
     "OylyaC56ijpAQ7G5ZZGL7MMQ6Ap6mEeuhSTFVps2N4Q",
   "client_secret_expires_at": 17514165600,
   "registration_client_uri":
     "https://server.example.com/connect/register?client_id=s6BhdRkqt3",
   "token_endpoint_auth_method":
     "client_secret_basic",
   "application_type": "web",
   "redirect_uris":
     ["https://client.example.org/callback",
      "https://client.example.org/callback2"],
   "client_name": "My Example",
   "client_name#ja-Jpan-JP":
     "クライアント名",
   "logo_uri": "https://client.example.org/logo.png",
   "subject_type": "pairwise",
   "sector_identifier_uri":
     "https://other.example.net/file_of_redirect_uris.json",
   "jwks_uri": "https://client.example.org/my_public_keys.jwks",
   "userinfo_encrypted_response_alg": "RSA1_5",
   "userinfo_encrypted_response_enc": "A128CBC-HS256",
   "contacts": ["ve7jtb@example.org", "mary@example.org"],
   "request_uris":
     ["https://client.example.org/rf.txt
       #qpXaRLh_n93TTR9F252ValdatUQvQiJi5BDub2BeznA"]
  }

更新(Update)

  • Readと同様にregistration_client_uriに更新対象のメタデータを指定してリクエストする。

所感

  • パラメータが非常に多い。値に応じて行うべき処理もちゃんと理解しておく必要がある...

参考情報

1
1
0

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
1
1