メインコンテンツまでスキップ

idp-server Client Instance 管理 API (1.0.0)

Download OpenAPI specification:Download

Client Instance(Attestation-Based Client Authentication の自己署名モードで使う、アプリのインスタンスごとの鍵)を管理する API です。

概要

Client Instance は、client_attestation_trust_source = registered_instance_key のクライアントで、 アプリのインストールごとに登録する鍵(Client Instance Key)です。アプリはこの鍵で Client Attestation JWT を自己署名し、 kid にインスタンスの id を入れます。詳しくは Attestation-Based Client Authentication を参照してください。

インスタンスはふつう、アプリ自身が登録エンドポイント(POST /{tenant-id}/v1/client-instances)で登録します。 この API は、運用側での検索・失効・削除と、アプリからの登録を使わない場合の登録に使います。

テナント直下のリソース

インスタンスはクライアントの下ではなくテナントの直下に置いています。運用で手元にあるのは利用者・鍵・証明書のシリアルで、 どのクライアントのものかは調べるまで分からないためです。id は UUID で、テナント内で 1 件に決まります。 client_id は登録時のボディと、検索条件で指定します。

失効と削除

失効(POST .../{id}/revoke) 削除(DELETE .../{id})
意味 信頼をやめる 記録を消す
インスタンスの記録 残る(status: revoked、revoked_at、revocation_reason、証跡) 消える
その鍵での認証 拒否(401 invalid_client_attestation) 拒否
発行済みのトークン 削除 削除
同じ鍵の再登録 できない できる(別のインスタンスになる)

失効は元に戻せません。

システムレベルと組織レベル

パス 使えるトークン
システムレベル /v1/management/tenants/{tenant-id}/client-instances 管理テナントで発行したもの
組織レベル /v1/management/organizations/{organization-id}/tenants/{tenant-id}/client-instances 組織の管理者のもの。組織に所属し、テナントがその組織のものであること

操作・リクエスト・レスポンスは同じで、要求する権限も同じです。組織に属さないテナントを指定すると 403(organization_access_denied)を返します。

権限

操作 権限
登録 idp:client-instance:create
検索・取得 idp:client-instance:read
失効 idp:client-instance:revoke
削除 idp:client-instance:delete

client-instance

Client Instance 管理(システムレベル)

Client Instance の検索

テナント内のインスタンスを、クライアントをまたいで検索します。新しく登録したものから順に返します。

条件はすべて任意で、組み合わせられます。取りうる値が決まっている条件(status、revocation_reason、 UUID の user_id、日時の from / to)に合わない値は 400 を返します。空の一覧を返すと「該当なし」と読み違えるためです。

path Parameters
tenant-id
required
string <uuid>

テナント識別子

query Parameters
client_id
string
Example: client_id=mobile-app

クライアントで絞り込む。client_id でも alias でも指定できる(インスタンスには正規の client_id で記録している)

user_id
string <uuid>

利用者で絞り込む(利用者の問い合わせで、その人の端末を一覧する)

status
string
Enum: "active" "revoked"

状態(保存値)で絞り込む。期限切れかどうかは expired で絞る

expired
boolean

expires_at を過ぎているかで絞り込む。期限切れのインスタンスは status が active のままでも認証できない。 今認証に使えるインスタンスは status=active&expired=false

revocation_reason
string
Enum: "operator" "superseded"

失効の理由で絞り込む

platform
string
Example: platform=android-key-attestation

登録時のプラットフォーム証明の種類(attestation_evidence.platform)で絞り込む

certificate_serial
string
Example: certificate_serial=7f3a9c01

登録時の証明書チェーンに含まれる証明書のシリアル番号(小文字の 16 進)で絞り込む。 証明の鍵や中間証明書の漏えいが分かったときに、その証明書を経由して登録したインスタンスを探すために使います。 大文字で指定しても一致します。

instance_key_thumbprint
string

インスタンスの鍵の RFC 7638 サムプリント(SHA-256、base64url)で引く

from
string <date-time>

登録日時の開始(この日時以降)

to
string <date-time>

登録日時の終了(この日時以前)

limit
integer [ 0 .. 1000 ]
Default: 20

最大件数(最大 1000)。負の数は 400

offset
integer >= 0
Default: 0

スキップする件数。負の数は 400

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total_count": 0,
  • "limit": 0,
  • "offset": 0
}

Client Instance の登録

運用側でインスタンスの鍵を登録します。アプリからの登録(client_instance_registration_policy)には縛られず、利用者にも束縛されません。

  • client_id は必須で、このテナントのクライアントであること
  • id を指定する場合は UUID で、どのインスタンスにも使われていないこと。省略するとサーバーが払い出します
  • instance_key は公開鍵の JWK であること(d などの秘密鍵の要素を含むと 400)
  • 同じテナントのいずれかのインスタンス(失効したものを含む)にすでに登録されている鍵は登録できません
path Parameters
tenant-id
required
string <uuid>

テナント識別子

query Parameters
dry_run
boolean
Default: false

true なら検証だけ行い、変更はしない

Request Body schema: application/json
required
id
string <uuid>

省略するとサーバーが払い出す

client_id
required
string

登録先のクライアント(このテナントのクライアントであること)

required
object

公開鍵の JWK。秘密鍵の要素(d など)を含んではならない

object
device_id
string <uuid>
expires_at
string <date-time>

有効期限。省略すると期限なし

Responses

Request samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "client_id": "string",
  • "instance_key": { },
  • "attestation_evidence": { },
  • "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940",
  • "expires_at": "2019-08-24T14:15:22Z"
}

Response samples

Content type
application/json
{
  • "result": {
    },
  • "dry_run": true
}

Client Instance の取得

UUID でない id や、存在しない id は 404 を返します。

path Parameters
tenant-id
required
string <uuid>

テナント識別子

id
required
string <uuid>

インスタンスの識別子(Client Attestation JWT の kid)

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "client_id": "string",
  • "instance_key": {
    },
  • "status": "active",
  • "expired": true,
  • "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  • "attestation_evidence": {
    },
  • "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "expires_at": "2019-08-24T14:15:22Z",
  • "revoked_at": "2019-08-24T14:15:22Z",
  • "revocation_reason": "operator"
}

Client Instance の削除

インスタンスの記録を消し、そのインスタンスに発行したトークンも削除します。 止めるだけなら失効(POST .../{id}/revoke)を使ってください。削除すると、同じ鍵をもう一度登録できるようになります(別のインスタンスとして扱われ、旧いトークンは引き継ぎません)。

path Parameters
tenant-id
required
string <uuid>

テナント識別子

id
required
string <uuid>

インスタンスの識別子(Client Attestation JWT の kid)

query Parameters
dry_run
boolean
Default: false

true なら検証だけ行い、変更はしない

Responses

Response samples

Content type
application/json
{
  • "message": "Deletion simulated successfully",
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "dry_run": true
}

Client Instance の失効

インスタンスの信頼をやめます。記録と証跡は残り(status: revoked、revoked_at、revocation_reason: operator)、 そのインスタンスに発行したトークンは削除します。リフレッシュトークンと、introspection で確かめるアクセストークンはその時点で止まります。 JWT のアクセストークンをリソースサーバーが手元で検証する場合は、有効期限まで通ります。

失効は元に戻せません。 すでに失効しているインスタンスを失効させようとすると 400 を返し、最初の revoked_at を保ちます。 端末をもう一度信頼するときは、アプリが新しい鍵を作って登録し直します(失効した鍵は再登録できません)。

path Parameters
tenant-id
required
string <uuid>

テナント識別子

id
required
string <uuid>

インスタンスの識別子(Client Attestation JWT の kid)

query Parameters
dry_run
boolean
Default: false

true なら検証だけ行い、変更はしない

Responses

Response samples

Content type
application/json
Example
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "client_id": "string",
  • "instance_key": {
    },
  • "status": "active",
  • "expired": true,
  • "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  • "attestation_evidence": {
    },
  • "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "expires_at": "2019-08-24T14:15:22Z",
  • "revoked_at": "2019-08-24T14:15:22Z",
  • "revocation_reason": "operator"
}

organization-client-instance

Client Instance 管理(組織レベル)

Client Instance の検索

テナント内のインスタンスを、クライアントをまたいで検索します。新しく登録したものから順に返します。

条件はすべて任意で、組み合わせられます。取りうる値が決まっている条件(status、revocation_reason、 UUID の user_id、日時の from / to)に合わない値は 400 を返します。空の一覧を返すと「該当なし」と読み違えるためです。

path Parameters
organization-id
required
string <uuid>

組織識別子

tenant-id
required
string <uuid>

テナント識別子

query Parameters
client_id
string
Example: client_id=mobile-app

クライアントで絞り込む。client_id でも alias でも指定できる(インスタンスには正規の client_id で記録している)

user_id
string <uuid>

利用者で絞り込む(利用者の問い合わせで、その人の端末を一覧する)

status
string
Enum: "active" "revoked"

状態(保存値)で絞り込む。期限切れかどうかは expired で絞る

expired
boolean

expires_at を過ぎているかで絞り込む。期限切れのインスタンスは status が active のままでも認証できない。 今認証に使えるインスタンスは status=active&expired=false

revocation_reason
string
Enum: "operator" "superseded"

失効の理由で絞り込む

platform
string
Example: platform=android-key-attestation

登録時のプラットフォーム証明の種類(attestation_evidence.platform)で絞り込む

certificate_serial
string
Example: certificate_serial=7f3a9c01

登録時の証明書チェーンに含まれる証明書のシリアル番号(小文字の 16 進)で絞り込む。 証明の鍵や中間証明書の漏えいが分かったときに、その証明書を経由して登録したインスタンスを探すために使います。 大文字で指定しても一致します。

instance_key_thumbprint
string

インスタンスの鍵の RFC 7638 サムプリント(SHA-256、base64url)で引く

from
string <date-time>

登録日時の開始(この日時以降)

to
string <date-time>

登録日時の終了(この日時以前)

limit
integer [ 0 .. 1000 ]
Default: 20

最大件数(最大 1000)。負の数は 400

offset
integer >= 0
Default: 0

スキップする件数。負の数は 400

Responses

Response samples

Content type
application/json
{
  • "list": [
    ],
  • "total_count": 0,
  • "limit": 0,
  • "offset": 0
}

Client Instance の登録

運用側でインスタンスの鍵を登録します。アプリからの登録(client_instance_registration_policy)には縛られず、利用者にも束縛されません。

  • client_id は必須で、このテナントのクライアントであること
  • id を指定する場合は UUID で、どのインスタンスにも使われていないこと。省略するとサーバーが払い出します
  • instance_key は公開鍵の JWK であること(d などの秘密鍵の要素を含むと 400)
  • 同じテナントのいずれかのインスタンス(失効したものを含む)にすでに登録されている鍵は登録できません
path Parameters
organization-id
required
string <uuid>

組織識別子

tenant-id
required
string <uuid>

テナント識別子

query Parameters
dry_run
boolean
Default: false

true なら検証だけ行い、変更はしない

Request Body schema: application/json
required
id
string <uuid>

省略するとサーバーが払い出す

client_id
required
string

登録先のクライアント(このテナントのクライアントであること)

required
object

公開鍵の JWK。秘密鍵の要素(d など)を含んではならない

object
device_id
string <uuid>
expires_at
string <date-time>

有効期限。省略すると期限なし

Responses

Request samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "client_id": "string",
  • "instance_key": { },
  • "attestation_evidence": { },
  • "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940",
  • "expires_at": "2019-08-24T14:15:22Z"
}

Response samples

Content type
application/json
{
  • "result": {
    },
  • "dry_run": true
}

Client Instance の取得

UUID でない id や、存在しない id は 404 を返します。

path Parameters
organization-id
required
string <uuid>

組織識別子

tenant-id
required
string <uuid>

テナント識別子

id
required
string <uuid>

インスタンスの識別子(Client Attestation JWT の kid)

Responses

Response samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "client_id": "string",
  • "instance_key": {
    },
  • "status": "active",
  • "expired": true,
  • "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  • "attestation_evidence": {
    },
  • "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "expires_at": "2019-08-24T14:15:22Z",
  • "revoked_at": "2019-08-24T14:15:22Z",
  • "revocation_reason": "operator"
}

Client Instance の削除

インスタンスの記録を消し、そのインスタンスに発行したトークンも削除します。 止めるだけなら失効(POST .../{id}/revoke)を使ってください。削除すると、同じ鍵をもう一度登録できるようになります(別のインスタンスとして扱われ、旧いトークンは引き継ぎません)。

path Parameters
organization-id
required
string <uuid>

組織識別子

tenant-id
required
string <uuid>

テナント識別子

id
required
string <uuid>

インスタンスの識別子(Client Attestation JWT の kid)

query Parameters
dry_run
boolean
Default: false

true なら検証だけ行い、変更はしない

Responses

Response samples

Content type
application/json
{
  • "message": "Deletion simulated successfully",
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "dry_run": true
}

Client Instance の失効

インスタンスの信頼をやめます。記録と証跡は残り(status: revoked、revoked_at、revocation_reason: operator)、 そのインスタンスに発行したトークンは削除します。リフレッシュトークンと、introspection で確かめるアクセストークンはその時点で止まります。 JWT のアクセストークンをリソースサーバーが手元で検証する場合は、有効期限まで通ります。

失効は元に戻せません。 すでに失効しているインスタンスを失効させようとすると 400 を返し、最初の revoked_at を保ちます。 端末をもう一度信頼するときは、アプリが新しい鍵を作って登録し直します(失効した鍵は再登録できません)。

path Parameters
organization-id
required
string <uuid>

組織識別子

tenant-id
required
string <uuid>

テナント識別子

id
required
string <uuid>

インスタンスの識別子(Client Attestation JWT の kid)

query Parameters
dry_run
boolean
Default: false

true なら検証だけ行い、変更はしない

Responses

Response samples

Content type
application/json
Example
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "client_id": "string",
  • "instance_key": {
    },
  • "status": "active",
  • "expired": true,
  • "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
  • "attestation_evidence": {
    },
  • "device_id": "3bafab7b-4400-4bcf-8e6e-09f954699940",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z",
  • "expires_at": "2019-08-24T14:15:22Z",
  • "revoked_at": "2019-08-24T14:15:22Z",
  • "revocation_reason": "operator"
}