8.5.2. RPT に関する情報の取得
トークンイントロスペクションは基本的に OAuth2 トークンイントロスペクション に準拠するエンドポイントであり、そこから RPT に関する情報を取得できます。
http://${host}:${port}/auth/realms/${realm_name}/protocol/openid-connect/token/introspect
http://${host}:${port}/auth/realms/${realm_name}/protocol/openid-connect/token/introspect
このエンドポイントを使用して RPT をイントロスペクションするには、以下のようにサーバーにリクエストを送信します。
curl -X POST \ -H "Authorization: Basic aGVsbG8td29ybGQtYXV0aHotc2VydmljZTpzZWNyZXQ=" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d 'token_type_hint=requesting_party_token&token=${RPT}' \ "http://localhost:8080/auth/realms/hello-world-authz/protocol/openid-connect/token/introspect"
curl -X POST \
-H "Authorization: Basic aGVsbG8td29ybGQtYXV0aHotc2VydmljZTpzZWNyZXQ=" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'token_type_hint=requesting_party_token&token=${RPT}' \
"http://localhost:8080/auth/realms/hello-world-authz/protocol/openid-connect/token/introspect"
上記の要求は HTTP BASIC を使用し、クライアントのクレデンシャル (クライアント ID およびシークレット) を渡して、トークンのイントロスペクションを試みるクライアントを認証しますが、Red Hat Single Sign-On でサポートされる他のクライアント認証方法を使用できます。
イントロスペクションエンドポイントには 2 つのパラメーターが必要です。
token_type_hint
このパラメーターの値として requesting_party_token を使用します。これは、RPT をイントロスペクションする必要があることを示します。
token
このパラメーターの値として、承認プロセス中にサーバーが返したためトークン文字列を使用します。
その結果、サーバーの応答は以下のようになります。
RPT がアクティブでない場合は、代わりに以下の応答が返されます。
{ "active": false }
{
"active": false
}