Oracle® Fusion Middleware Oracle Access Management開発者ガイド 11gリリース2 (11.1.2.3.0) for All Platforms E67354-04 |
|
![]() 前 |
![]() 次 |
この章では、Oracle Access Management OAuth Service APIについて説明します。この章の内容は次のとおりです。
cURLの使用に関する注意
この章では、cURLを使用して、OAuthクライアントがMobile and Social OAuthサービスに送信するRESTコールについて説明します。cURLは、cURLのWebサイト(http://curl.haxx.se/
)からダウンロードできるフリー・ソフトウェアです。
サーバーへのRESTコールの送信にcURLを使用することにより、クライアントとサーバーとのやり取りについての理解を深めることができます。また、これを便利なトラブルシューティング・ツールとしても使用できます。この章を使用するときは、次の点に注意してください。
Windowsでは、一重引用符( '
)を含むcURLコマンドは失敗します。可能であれば、一重引用符のかわりに二重引用符( "
)を使用してください。
コマンドに一重引用符と二重引用符の両方が必要な場合、二重引用符を円記号でエスケープし(例: \"
)、一重引用符を二重引用符に置き換えます。
注意: このガイドにおいて、cURLのコマンドおよびサーバー・レスポンスでの改行は、単に表示上の都合により使用されています。 |
利用できるJava APIリファレンス
この『Oracle Fusion Middleware Oracle Access Management開発者ガイド』のほかに、『Oracle Fusion Middleware Oracle Access Management OAuthサービスJava APIリファレンス』があります。
この項では、3-legged OAuthサービス・フロー用のRESTコールについて説明します。詳細は、『Oracle Fusion Middleware Oracle Access Management管理者ガイド』を参照してください。
次のサンプル・リクエストには、2つの部分があります。
第1の部分: フロントチャネル・リクエスト -リソース所有者(またはエンド・ユーザー)とOAuthサービス・サーバーの間で起こります。
第2の部分: バックチャネル・リクエスト - OAuthサービス・サーバーとクライアント・アプリケーションの間で起こります。
クライアント・アプリケーションは、ブラウザを使用してユーザー(要求されたリソースの所有者)をOAuthサービス・サーバーの認可エンドポイントにリダイレクトします。ユーザーはOAuthサービスで認証を行う必要があり、オプションで、承認の提供により、リクエストしたリソースへのアクセスの認可を行います。ユーザーの相互作用が正常に完了すると、OAuth Servicesは、クライアント・アプリケーションが、第2の部分: バックチャネル・リクエストの説明に従ってアクセス・トークンをリクエストするために使用する認可コードを発行します。
サンプルの認可コードリクエスト
curl - i --request GET "https://host:port/ms_oauth/oauth2/endpoints/oauthservice/authorize? response_type=code &client_id=54321id &redirect_uri=http://client.example.com/return &scope=user_read &state=xyz"
表15-1 リクエストのパラメータ
名前 | 説明 | 必須 |
---|---|---|
|
このフローの場合、値は |
必須 |
|
認可サーバーによって付与されるクライアント識別子。 認可サーバーは |
必須 |
|
クライアント・アプリケーションのリダイレクトURI認可コード。送信されない場合、構成/クライアント・レジストリがチェックされ、 |
オプション |
|
構成/スコープ・レジストリでスコープ値を定義します。スコープが送信されない場合、または無効なスコープが指定された場合、エラー・レスポンスがクライアント・アプリケーションの |
必須 |
|
リクエストとコールバックの間で状態を保持するためにクライアントによって使用される不透明な値。ユーザー・エージェントをクライアントにリダイレクトする際、認可サーバーはこの値を含めます。クロスサイト・リクエスト・フォージェリを防ぐためにこのパラメータを使用します。 |
推奨 |
サンプル認可コード・レスポンス
リソース所有者がアクセス権を付与すると、OAuthサービスのサーバーが認可コードを発行し、application/x-www-form-urlencoded
形式を使用してリダイレクションURIの問合せコンポーネントに適用可能なパラメータを追加することでクライアントに認可コードを渡します。パラメータは、表15-2で説明されています。
https: //client.example.com/return?code=eyJhbG...rWWk8hbs_o6uY&state=xyz
表15-2 レスポンスのパラメータ
名前 | 説明 |
---|---|
|
次の情報が含まれます。
|
|
認可リクエストで指定された値と同じ値。認可リクエストで指定された場合にのみ含まれます。 |
サンプル・エラー・レスポンス
検証エラーが検出された場合、エラー・コードおよび説明を含むJSONレスポンスが送信されます。
{”error_code”:”invalid_client”, ”error_description”:”client identifier invalid”}
次のリストに、一部のエラー・コードとその説明を示します。
server_error
- ランタイム処理エラー
invalid_scope
- リクエストされたスコープは無効、不明または不正
invalid_redirect_uri
- リダイレクトURIが、クライアント・アプリケーションに一致しません
access_denied
- エンド・ユーザーが認可を拒否
invalid_client
- クライアント識別子が無効
このフローは、OAuthサービス(認可サーバー)とクライアント・アプリケーションの間のものです。サンプルでは、アクセス・トークンの認可コードの交換方法を示します。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://hostname:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' redirect_uri=http%3A%2F%2Fclient.example.com:17001%2Freturn &grant_type=authorization_code &code=eyJhbG...rWWk8hbs_o6uY '
grant_type
パラメータ値はauthorization_code
で、code
パラメータ値は認可エンドポイントで生成された認可コードである必要があります。redirect_uri
パラメータが認可リクエストに含まれていた場合、redirect_uri
トークンを送信する必要があります。値は同じである必要があります。
サンプル・レスポンス
{ "access_token": "2YotnFZFEjr1zCsicMWpAA", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA" }
この項では、2-legged OAuthサービス・フロー用のRESTコールについて説明します。リソース・アクセス・トークンの取得方法を示すRESTリクエストのサンプルについて説明します。リクエストでリソースが送信されない場合、結果のトークンをアイデンティティ・トークンとして使用できます。詳細は、『Oracle Fusion Middleware Oracle Access Management管理者ガイド』を参照してください。
通常、この項で説明されているリクエストには次のようなレスポンスが返されます。
注意: リクエストされたスコープがオフライン・スコープに指定されている場合、サーバー・レスポンスにrefresh_token 要素が含まれます。どのスコープもオフラインでない場合、refresh_token 要素は送信されません。 |
HTTP/1.1 200 OK Cache-Control: no-cache, no-store, must-revalidate Date: Wed, 04 Dec 2013 21:52:03 GMT Pragma: no-cache Transfer-Encoding: chunked Content-Type: application/json X-ORACLE-DMS-ECID: 09edd9b26949554d:-1f8be51:142bf50a0dc:-8000-0000000000001b27 X-Powered-By: Servlet/2.5 JSP/2.1 { "expires_in":3600, "token_type":"Bearer", "access_token":"<access token value>", "refresh_token":"<refresh token value>" }
次のサンプルでは、クライアント資格証明を使用してアクセス・トークンを取得する方法を示します。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://hostname:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=client_credentials &scope=scope1%20scope2 '
次のサンプルでは、HTTP BasicヘッダーにユーザーIDとパスワードの資格証明およびクライアントID、シークレットが含まれたリソース所有者のリクエストを示します。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://hostname:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=password &username=userxyz &password=pwd123xyz &scope=scope1%20scope2'
次のサンプルでは、Basic認可ヘッダーでclientid:clientsecret
とともにリフレッシュ・トークンを使用します。
curl -i -H 'Authorization: Basic dGVzdDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://hostname:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=refresh_token &refresh_token=<refresh-token-value>'
次の例では、クライアント資格証明としてクライアント・アサーションを使用します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=refresh_token &refresh_token=<refresh-token-value> &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer &client_assertion=<client-assertion-value>'
次のサンプルでは、サード・パーティによって生成されたSAMLクライアント・アサーションを使用するクライアント資格証明リクエストを示します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'client_id=54321id &grant_type=client_credentials &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Asaml2-bearer &client_assertion=<SAML client assertion value> &scope=scope1%20scope2'
次のサンプルでは、IDM OAuthサーバーまたはサード・パーティによって生成されたJWTクライアント・アサーションを使用した認可コードのリクエストを示します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'client_id=54321id &grant_type=client_credentials &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &client_assertion=<JWT client assertion value> &scope=scope1%20scope2'
次のサンプルでは、HTTP BasicヘッダーにユーザーIDとパスワードの資格証明およびクライアントID、シークレットが含まれたリソース所有者のリクエストを示します。
curl -i -H 'Authorization: Basic <base64encoded(clientID:Secret)>' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=password &username=user123 &password=password123 '
次のサンプルでは、ユーザーIDおよびパスワード資格証明に加えてサード・パーティによって生成されたJWTクライアント・アサーションを使用したリソース所有者のリクエストを示します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=password &username=userxyz &password=pwd123xyz &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &client_assertion=<JWT client assertion value> &scope=scope1%20scope2'
次の例は、ユーザーIDおよびパスワード資格証明に加えてサード・パーティによって生成されたSAMLクライアント・アサーションを使用した認可コードのリクエストです。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=password &username=userAbc123 &password=passwordAbc123 &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Asaml2-bearer &client_assertion=<SAML client assertion value> &scope=scope1%20scope2'
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer &assertion=<SAML user assertion value>' &scope=scope1%20scope2
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Asaml2-bearer &client_assertion=<SAML client assertion value> &assertion=<SAML user assertion value> &scope=scope1%20scope2'
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &client_assertion=<JWT client assertion value> &assertion=<SAML user assertion value> &scope=scope1%20scope2'
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer &assertion=<JWT user assertion value> &scope=scope1%20scope2'
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Asaml2-bearer &client_assertion=<SAML client assertion value> &assertion=<JWT user assertion value> &scope=scope1%20scope2'
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &client_assertion=<JWT client assertion value> &assertion=<JWT user assertion value> &scope=scope1%20scope2'
この項では、OAuthサービスからのアクセス・トークン(クライアントおよびユーザーのアイデンティティ・トークン)の取得方法を示します。次の項が含まれます:
この項では、クライアント・アイデンティティ・トークンを取得する複数の方法を示します。
このサンプルは、クライアントIDとシークレットをHTTP Basic認可ヘッダーに含めます。
curl - i - H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' - H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http: //host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=client_credentials'
サンプル・レスポンス
{ "oracle_client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "expires_in": 604800, "token_type": "Bearer", "oracle_tk_context": "client_assertion", "access_token": "access token value" > , }
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' client_id=54321id &grant_type=client_credentials &client_assertion_type= urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Asaml2-bearer &client_assertion=<SAML client assertion value> '
最初の例のサンプル・レスポンスを参照してください。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' client_id=54321id &grant_type=client_credentials &client_assertion_type= urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &client_assertion=<JWT client assertion value> '
最初の例のサンプル・レスポンスを参照してください。
この項のサンプルでは、アクセス・トークンまたはユーザー・アサーションとも呼ばれるユーザー・アイデンティティ・トークンの取得方法を示します。すべてのリクエストで次のようなレスポンスを受け取ります。
{ "expires_in": 28800, "token_type": "Bearer", "oracle_tk_context": "user_assertion", "oracle_grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer", "access_token": "<access token value>" }
次の各項で、サンプルを示します。
SAMLユーザー・アサーション資格証明および様々なクライアント資格証明を使用したユーザー・アイデンティティ・トークンの取得
JWTユーザー・アサーション資格証明および様々なクライアント資格証明を使用したユーザー・アイデンティティ・トークンの取得
このカテゴリには3つのサンプルがあります。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=password &username=sampleuser &password=samplepassword '
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=password &username=sampleuser &password=samplepassword &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &client_assertion=<JWT client assertion value> '
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=password &username=sampleuser &password=samplepassword &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Asaml2-bearer &client_assertion=<SAML client assertion value>'
このカテゴリには3つのサンプルがあります。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer &assertion=<SAML user assertion value>'
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Asaml2-bearer &client_assertion=<SAML client assertion value> &assertion=<SAML user assertion value>'
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &client_assertion=<JWT client assertion value> &assertion=<SAML user assertion value>'
このカテゴリには3つのサンプルがあります。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer &assertion=<JWT user assertion value>'
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Asaml2-bearer &client_assertion=<SAML client assertion value> &assertion=<JWT user assertion value>'
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &client_assertion=<JWT client assertion value> &assertion=<JWT user assertion value>'
この項では、リソース・アクセス・トークンの検証方法を示すRESTリクエストのサンプルについて説明します。次の例を示します。
次の例は、HTTP BasicヘッダーにクライアントIDおよびシークレットを含むアクセス・トークンの検証リクエストです。アサーション値は通常の文字列ではなく、JSONであることに注意してください。assertion
の値は、アクセス・トークンです。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Fresource-access-token%2Fjwt &oracle_token_action=validate &scope=UserProfile.users &assertion= eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCIsIng1dCI6Im51T0JSSjhOVDRNTEZYRVkwZEVZb3d2MjhrWS IsImtpZCI6Im9yYWtleSJ9.eyJzdWIiOiJ3ZWJsb2dpYyIsIm9yYWNsZS5vYXV0aC51c2VyX29yaWdpbl9 pZF90eXBlIjoiTERBUF9VSUQiLCJvcmFjbGUub2F1dGgudXNlcl9vcmlnaW5faWQiOiJ3ZWJsb2dpYyIsI mlzcyI6Im9yYWtleSIsIm9yYWNsZS5vYXV0aC5zdmNfcF9uIjoiT0F1dGhTZXJ2aWNlUHJvZmlsZSIsIml hdCI6MTQyMjAzODEyNTAwMCwib3JhY2xlLm9hdXRoLnBybi5pZF90eXBlIjoiTERBUF9VSUQiLCJvcmFjb GUub2F1dGgudGtfY29udGV4dCI6InJlc291cmNlX2FjY2Vzc190ayIsImV4cCI6MTQyMjA0MTcyNTAwMCw icHJuIjoid2VibG9naWMiLCJqdGkiOiIxMDA0MTMyZC03MTBkLTRlMGEtOGI1OS01NzI0ZTFlMmI0Y2UiL CJvcmFjbGUub2F1dGguY2xpZW50X29yaWdpbl9pZCI6ImM4MDcwMGNlYTJkNDQ1ZjFiOGQ2OWVkZDEyMDY 1ODY1Iiwib3JhY2xlLm9hdXRoLnNjb3BlIjoiVXNlclByb2ZpbGUubWUiLCJ1c2VyLnRlbmFudC5uYW1lI joiRGVmYXVsdERvbWFpbiIsIm9yYWNsZS5vYXV0aC5pZF9kX2lkIjoiMTIzNDU2NzgtMTIzNC0xMjM0LTE yMzQtMTIzNDU2Nzg5MDEyIn0.PymkviRiSGjkGtY9eT1BzRLXc_ kbaPMSq-SK5FY5CF6RHH5O7DLqYY0uYLd0EF8fI2zpX5AqD9B5p-12IqNox-hfR7BoPs11lgi2U-j1gZfT XqHu7SsI3sMgwiTRrllfMD1MjoGRFYbi446C-rBiVXzUgRRaEMf9oic14O26xm4
レスポンス
{"successful":true}
次の例は、資格証明として使用されるクライアント資格証明権限付与タイプを使用してJWTクライアント・アサーションを取得するアクセス・トークンの検証リクエストです。
curl -i --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Fresource-access-token%2Fjwt &oracle_token_action=validate &scope=ConsentManagement.grant &assertion=<access token value> &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer &client_assertion=<JWT client assertion value>'
レスポンス
{"successful":true}
この項では、OAM OAuthサービスに問い合せてOAuthトークンについてのメタ情報を判断する方法を示すRESTリクエストのサンプルについて説明します。この処理はOAuthイントロスペクションと呼ばれています。アクセス・トークンの検証と同じですが、レスポンスの一部としてアクセス・トークン内に追加要求データが含まれています。
oracle_token_attrs_retrieval
パラメータを含めると、サーバーはレスポンスに追加トークン要求データを含めます。このパラメータはスペース区切りで次の要求名をとります。
iss aud exp prn jti exp iat oracle.oauth.scope oracle.oauth.client_origin_id oracle.oauth.user_origin_id oracle.oauth.user_origin_id_type oracle.oauth.tk_context oracle.oauth.id_d_id oracle.oauth.svc_p_n
この項では、次の例を示します。
次のトークン・イントロスペクションの例は、アクセス・トークンの検証の項で示された最初のアクセス・トークン検証リクエストと同じですが、oracle_token_attrs_retrieval
パラメータが追加されています。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Fresource-access-token%2Fjwt &oracle_token_action=validate &scope=UserProfile.users &oracle_token_attrs_retrieval=iss%20aud%20exp%20prn%20jti%20exp%20iat %20oracle.oauth.scope%20oracle.oauth.client_origin_id %20oracle.oauth.user_origin_id%20oracle.oauth.user_origin_id_type %20oracle.oauth.tk_context%20oracle.oauth.id_d_id%20oracle.oauth.svc_p_n &assertion=<access token value>'
レスポンス
{"successful":true, "oracle_token_attrs_retrieval": {"oracle.oauth.tk_context":"resource_access_tk", "exp":1386276668000, "iss":"www.oracle.example.com", "prn":"54321id", "oracle.oauth.client_origin_id":"54321id", "oracle.oauth.scope":"ConsentManagement.grant", "jti":"0fb4eef6-44ce-46ac-9230-7a335c05bf0f", "oracle.oauth.svc_p_n":"OAuthServiceProfile", "iat":1386273068000, "oracle.oauth.id_d_id":"12345678-1234-1234-1234-123456789012" } }
次のトークン・イントロスペクションの例は、アクセス・トークンの検証の項で示された2番目のアクセス・トークン検証リクエストと同じですが、oracle_token_attrs_retrieval
パラメータが追加されています。
curl -i --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Fresource-access-token%2Fjwt &oracle_token_action=validate &scope=ConsentManagement.grant &oracle_token_attrs_retrieval=iss%20aud%20exp%20prn%20jti%20exp%20iat %20oracle.oauth.scope%20oracle.oauth.client_origin_id %20oracle.oauth.user_origin_id%20oracle.oauth.user_origin_id_type %20oracle.oauth.tk_context%20oracle.oauth.id_d_id%20oracle.oauth.svc_p_n &assertion=<access token value> &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer &client_assertion=<JWT client assertion value>'
レスポンス
{"successful":true, "oracle_token_attrs_retrieval": {"oracle.oauth.tk_context":"resource_access_tk", "exp":1386276668000, "iss":"www.oracle.example.com", "prn":"54321id", "oracle.oauth.client_origin_id":"54321id", "oracle.oauth.scope":"ConsentManagement.grant", "jti":"0fb4eef6-44ce-46ac-9230-7a335c05bf0f", "oracle.oauth.svc_p_n":"OAuthServiceProfile", "iat":1386273068000, "oracle.oauth.id_d_id":"12345678-1234-1234-1234-123456789012" } }
この項では、リソース・アクセス・トークンの取消し方法を示すRESTリクエストのサンプルについて説明します。次の例を示します。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Fresource-access-token%2Fjwt &oracle_token_action=delete &assertion=<access token value>'
レスポンス
{"successful":true}
curl -i --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Fresource-access-token%2Fjwt &oracle_token_action=delete &assertion=<access token value> &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer &client_assertion=<JWT client assertion value>'
レスポンス
{"successful":true}
次の各項では、シークレット鍵を管理するためのAPIについて説明します。
シークレット鍵を作成するには、次のREST APIを使用します。
curl -i --request POST $SERVER_URL/ms_oauth/resources/userprofile/secretkey -H "Authorization: Bearer $access_token"
シークレット鍵を取得するには、次のREST APIを使用します。
curl -i --request GET $SERVER_URL/ms_oauth/resources/userprofile/secretkey -H "Authorization: Bearer $access_token"
典型的なレスポンスは次のようになります。
{ "uri": "\/ms_oauth\/resources\/userprofile\/secretkey\/weblogic", "secret_key": "7OWZSV2OYFZSJZWT" }
この項では、次のユーザー・プロファイル・サービスRESTコマンドについて説明します。
このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.me.read
というスコープが必要です。
curl -i --request GET "http://host:port/ms_oauth/resources/userprofile/me" -H 'Authorization:<OAUTH ACCESS TOKEN>'
レスポンス
{ "uid": "weblogic", "description": "This user is the default administrator.", "lastname": "Doe", "commonname": "John", "uri": "\/ms_oauth\/resources\/userprofile\/me\/weblogic" }
このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.me.write
というスコープが必要です。
curl -H "Content-Type: application/json" --request PUT "http://host:port/ms_oauth/resources/userprofile/me" -H 'Authorization:<OAUTH ACCESS TOKEN>' -d '{ "description": "user2description" }'
レスポンス
{ "uid": "weblogic", "description": "user2description", "lastname": "Doe", "commonname": "John", "uri": "\/ms_oauth\/resources\/userprofile\/me\/weblogic" }
このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.users.write
というスコープが必要です。
curl -H "Content-Type: application/json" --request POST http://host:port/ms_oauth/resources/userprofile/users -H 'Authorization:<OAUTH ACCESS TOKEN>' -d '{ "uid": "John", "description": "test user", "lastname": "Anderson", "commonname": "John Anderson", "firstname": "John" }'
レスポンス
{ "uid": "John", "guid": "FE1D7BD0590111E1BFDCF77FB8E715D5", "description": "test user", "name": "John", "lastname": "Anderson", "commonname": "John Anderson", "loginid": "John", "firstname": "John", "uniquename": "FE1D7BD0590111E1BFDCF77FB8E715D5", "uri": "\/ms_oauth\/resources\/userprofile\/people\/John" }
このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.users.read
というスコープが必要です。
curl -i --request GET -H 'Authorization:<OAUTH ACCESS TOKEN>' http://host:port/ms_oauth/resources/userprofile/users/John
レスポンス
{ "uid": "John", "guid": "FE1D7BD0590111E1BFDCF77FB8E715D5", "description": "test user", "name": "John", "lastname": "Anderson", "commonname": "John Anderson", "loginid": "John", "firstname": "John", "uniquename": "FE1D7BD0590111E1BFDCF77FB8E715D5", "uri": "\/ms_oauth\/resources\/userprofile\/people\/John" }
このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.users.write
というスコープが必要です。
curl -H "Content-Type: application/json" --request PUT http://host:port/ms_oauth/resources/userprofile/users/John -H 'Authorization:<OAUTH ACCESS TOKEN>' -d '{ "description":"test user1" }'
レスポンス
{ "uid": "John", "guid": "FE1D7BD0590111E1BFDCF77FB8E715D5", "description": "test user1", "name": "John", "lastname": "Anderson", "commonname": "John Anderson", "loginid": "John", "firstname": "John", "uniquename": "FE1D7BD0590111E1BFDCF77FB8E715D5", "uri": "\/ms_oauth\/resources\/userprofile\/people\/John" }
このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.users.write
というスコープが必要です。
curl -i --request DELETE -H 'Authorization:<OAUTH ACCESS TOKEN>' http://host:port/ms_oauth/resources/userprofile/users/John
レスポンス
レスポンスはありません。
このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.users.write
というスコープが必要です。
curl -H "Content-Type: application/json" --request POSThttp://host:port/ms_oauth/resources/userprofile/groups -H 'Authorization:<OAUTH ACCESS TOKEN>' -d '{ "description":"group1 testing", "commonname":"group1" }'
レスポンス
{ "guid": "2259C6C0592011E1BFDCF77FB8E715D5", "description": "group1 testing", "name": "group1", "commonname": "group1", "uniquename": "2259C6C0592011E1BFDCF77FB8E715D5", "uri": "\/ms_oauth\/resources\/userprofile\/groups\/group1" }
このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.groups.read
というスコープが必要です。
curl -i --request GET "http://host:port/ms_oauth/resources/userprofile/groups/group1" -H 'Authorization:<OAUTH ACCESS TOKEN>'
レスポンス
{ "guid": "2259C6C0592011E1BFDCF77FB8E715D5", "description": "group1 testing", "name": "group1", "commonname": "group1", "uniquename": "2259C6C0592011E1BFDCF77FB8E715D5", "uri": "\/ms_oauth\/resources\/userprofile\/groups\/group1" }
このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.groups.write
というスコープが必要です。
curl -H "Content-Type: application/json" --request PUT http://host:port/ms_oauth/resources/userprofile/groups/group1 -H 'Authorization:<OAUTH ACCESS TOKEN>' -d '{ "description":"group11 testing" }'
レスポンス
{ "guid": "2259C6C0592011E1BFDCF77FB8E715D5", "description": "group11 testing", "name": "group1", "commonname": "group1", "uniquename": "2259C6C0592011E1BFDCF77FB8E715D5", "uri": "\/ms_oauth\/resources\/userprofile\/groups\/group1" }
このインタフェースを使用してカスタム・ユーザー・インタフェースをレンダリングし、ユーザー承認プロセスを実行することで承認エクスペリエンスをカスタマイズします。このインタフェースでは、POST/consentmanagement/retrieve grantを使用してすべてのユーザーについてクライアントの承認ステータスとスコープが取得されます。このインタフェースを使用すると、クライアントで以前に付与したすべてのスコープをユーザーに表示することができます。
ユーザー承認の有効化の詳細は、『Oracle Fusion Middleware Oracle Access Management管理者ガイド』を参照してください。必要に応じてScopesセクションで権限を構成します。この項では、次の項目について説明します。
次のサンプルでは、client_credentials
付与タイプを使用してアクセス・トークンを取得する方法を示します。
リクエスト・ヘッダーに、"Basic" base 64でエンコードされた(clientId:<secret>)を使用してAuthorization属性を設定します。
リクエスト問合せに、grant_type=client_credentialsおよびscope=ConsentManagement.retrieve+ConsentManagement.grant+ConsentManagement.revokeを追加します。
リクエストを、http://<host>:<port>/ms_oauth/oauth2/endpoints/oauthservice/tokensエンドポイントにPOSTします。
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=client_credentials &scope=ConsentManagement.retrieve+ ConsentManagement.grant+ ConsentManagement.revoke'
レスポンス
予測される出力は、OK 200と有効なトークンです。
{ "expires_in": 3600, "token_type": "Bearer", "access_token": "eyJhbGciOiJSyfecz3p...nYlReMjATbLs" }
このcURLコマンドは、承認を付与するためにアクセス・トークン(「クライアント資格証明とスコープを伴うアクセス・トークンの取得」から)を使用する方法を示しています。
"Bearer"と、以前に取得したアクセス・トークンAT_1を使用してAuthorization属性を設定します
oracle_user_id=[ユーザーID](この例ではweblogic)を追加します
client_id=[クライアントID](この例では54321id)を追加します
scope=[スペース区切りのスコープのリスト](この例では"samplePhotoServer.photo.read samplePhotoServer.photo.write"が使用されています)を追加します
http://<host>:<port>/ms_oauth/resources/consentmanagement/grantエンドポイントにリクエストをPOSTします。
curl -i -H 'Authorization: Bearer AT_1' -H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' --request POST http://host:port/ms_oauth/resources/consentmanagement/grant -d 'oracle_user_id=weblogic& scope=samplePhotoServer.photo.write+samplePhotoServer.photo.read& lang=en& client_id=54321id'
レスポンス
予測される出力は、client_credentials権限タイプを持つsamplePhotoServer.photoの拡張トークンと、samplePhotoServer.photo.write+samplePhotoServer.photo.readのスコープです。
このcURLコマンドは、承認を取得するためにトークンを使用する方法を示しています。
"Bearer"と、以前に取得したアクセス・トークンAT_1を使用してAuthorization属性を設定します(「クライアント資格証明とスコープを伴うアクセス・トークンの取得」から)
oracle_user_id=[ユーザーID](この例ではweblogic)を追加します
client_id=[クライアントID](この例では54321id)を追加します
http://<host>:<port>/ms_oauth/resources/consentmanagement/retrieveエンドポイントにリクエストをPOSTします。
curl -i -H 'Authorization: Bearer AT_1' -H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' --request POST http://host:port/ms_oauth/resources/consentmanagement/retrieve -d 'oracle_user_id=weblogic& lang=en& client_id=54321id'
このcURLコマンドは、承認を取り消すためにトークンを使用する方法を示しています。
"Bearer"と、以前に取得したアクセス・トークンAT_1を使用してAuthorization属性を設定します(「クライアント資格証明とスコープを伴うアクセス・トークンの取得」から)
oracle_user_id=[ユーザーID](この例ではweblogic)を追加します
client_id=[クライアントID](この例では54321id)を追加します
scope=[スペース区切りのスコープのリスト](この例では"samplePhotoServer.photo.read samplePhotoServer.photo.write")を追加します
http://<host>:<port>/ms_oauth/resources/consentmanagement/revokeエンドポイントにリクエストをPOSTします。
curl -i -H 'Authorization: Bearer AT_1' -H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' --request POST http://host:port/ms_oauth/resources/consentmanagement/revoke -d 'oracle_user_id=weblogic& scope=samplePhotoServer.photo.write+samplePhotoServer.photo.read&lang=en& client_id=54321id'
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/resources/consentmanagement/grant -d ' scope=UserProfile.me.read &client_id=54321id &oracle_user_id=weblogic &lang=en ' -H 'Authorization: eyJhbGciOiJSUzUxM...3OxH7jIRqGL-6w'
レスポンス
HTTP/1.1 200 OK
curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=password &username=weblogic &password=password123 &scope=UserProfile.me.read'
レスポンス
{ "expires_in": 3600, "token_type": "Bearer", "refresh_token": "eyJhbGciOiJSUzUxM...t7ihyNjqbb6Q9bCwE", "access_token": "eyJhbGciOiJSUzUxM...MIXI0ztb6NfOBMb4A" }
次のサンプルでは、無認可のリクエストとレスポンスを示します。
curl -i --request GET "http://host:port/ms_oauth/resources/userprofile/me" -H 'Authorization: eyJhbGciOiJSUzUxM...MIXI0ztb6NfOBMb4A'
レスポンス
HTTP/1.1 401 Unauthorized Date: Fri, 16 Aug 2013 18:47:44 GMT Transfer-Encoding: chunked Content-Type: application/json X-ORACLE-DMS-ECID: 316690b8df2db0a3:-794ed83e:140885d3651:-8000-000000000000005e X-Powered-By: Servlet/2.5 JSP/2.1 { "message": "oracle.security.idaas.oauth.resourceserver.jaxrs.userprofile.Me.getMyProfile: resource uri is not protected", "oicErrorCode": "IDAAS-20027 : oracle.security.idaas.rest.jaxrs.OICExceptionMapper : [ No error code is available from the underlying exception ]" }
この項では、3-leggedモバイル・クライアント・フロー用のRESTコールについて説明します。詳細は、『Oracle Fusion Middleware Oracle Access Management管理者ガイド』を参照してください。
注意: すべての属性の名前および値では、大/小文字が区別されます。 |
この項では、次の項目について説明します。
この11.1.2.3.0リリース以降のOAMサーバーは、アプリケーション・プロファイル取得リクエストに応じて、可能な権限タイプを返します。レスポンスは、クライアントがサーバーに正しいコールを行えるように、サーバー側SSOが有効かどうかに関係なく返されて、どのように構成されているかをクライアントに知らせます。いくつかのレスポンス例を次に示します。
curl -i --request GET 'http://host:port/ms_oauth/oauth2/ endpoints/oauthservice/appprofiles/MobileApp1?device_os=iPhone%20OS&os_ver=7.000000'
ジェイルブレーク検出ポリシーのないレスポンス
{ "allowedGrantTypes": [ "urn:ietf:params:oauth:grant-type:jwt-bearer", "client_credentials", "oracle-idm:/oauth/grant-type/mobile-client-registration-key", "password" ], "client_id":"MobileApp1", "mobileAppConfig":{ "claimAttributes":[ "oracle:idm:claims:client:geolocation", "oracle:idm:claims:client:imei", "oracle:idm:claims:client:jailbroken", "oracle:idm:claims:client:locale", "oracle:idm:claims:client:networktype", "oracle:idm:claims:client:ostype", "oracle:idm:claims:client:osversion", "oracle:idm:claims:client:phonecarriername", "oracle:idm:claims:client:phonenumber", "oracle:idm:claims:client:sdkversion", "oracle:idm:claims:client:udid", "oracle:idm:claims:client:vpnenabled", "oracle:idm:claims:client:fingerprint", "oracle:idm:claims:client:iosidforvendor", "oracle:idm:claims:client:iosidforad" ] }, "oauthAuthZService":"/ms_oauth/oauth2/endpoints/oauthservice/authorize", "oauthNotificationService":"/ms_oauth/oauth2/endpoints/oauthservice/push", "oauthTokenService":"/ms_oauth/oauth2/endpoints/oauthservice/tokens", "oracleMobileSecurityLevel":"LOW", "userConsentService":["/ms_oauth/resources/consentmanagement"], "userProfileService":["/ms_oauth/resources/userprofile"], "oracleConsentServiceProtection":"OAM" }
ジェイルブレーク検出ポリシーのあるレスポンス
{ "allowedGrantTypes": [ "urn:ietf:params:oauth:grant-type:jwt-bearer", "client_credentials", "oracle-idm:/oauth/grant-type/mobile-client-registration-key", "password" ], "client_id":"ACMEStock", "jailBreakingDetectionPolicy": { "autoCheckPeriodInMin":60, "detectionLocation": [ {"action":"exists", "filePath":"/bin/bash", "success":true }, {"action":"exists", "filePath":"/Applications/Cydia.app", "success":true }, {"action":"exists", "filePath":"/Applications/limera1n.app", "success":true }, {"action":"exists", "filePath":"/Applications/greenpois0n.app", "success":true }, {"action":"exists", "filePath":"/Applications/blackra1n.app", "success":true }, {"action":"exists", "filePath":"/Applications/blacksn0w.app", "success":true }, {"action":"exists", "filePath":"/Applications/redsn0w.app", "success":true }, {"action":"exists", "filePath":"/Applications/sn0wbreeze.app", "success":true } ], "device_os":"iPhone OS", "os_ver":"7.000000", "policyExpirationInSec":3600 }, "mobileAppConfig": { "claimAttributes":[ "oracle:idm:claims:client:geolocation", "oracle:idm:claims:client:imei", "oracle:idm:claims:client:jailbroken", "oracle:idm:claims:client:locale", "oracle:idm:claims:client:networktype", "oracle:idm:claims:client:ostype", "oracle:idm:claims:client:osversion", "oracle:idm:claims:client:phonecarriername", "oracle:idm:claims:client:phonenumber", "oracle:idm:claims:client:sdkversion", "oracle:idm:claims:client:udid", "oracle:idm:claims:client:vpnenabled", "oracle:idm:claims:client:fingerprint", "oracle:idm:claims:client:iosidforvendor", "oracle:idm:claims:client:iosidforad" ] }, "oauthAuthZService":"/ms_oauth/oauth2/endpoints/oauthservice/authorize", "oauthNotificationService":"/ms_oauth/oauth2/endpoints/oauthservice/push", "oauthTokenService":"/ms_oauth/oauth2/endpoints/oauthservice/tokens", "oracleMobileSecurityLevel":"LOW", "userConsentService":["/ms_oauth/resources/consentmanagement"], "userProfileService":["/ms_oauth/resources/userprofile"], "oracleConsentServiceProtection":"OAM" }
この項では、デバイス登録のためのモバイル・クライアント検証コード用のRESTリクエストについて説明します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=client_credentials &oracle_device_profile=<Base 64 Encoding Device Profile> &client_id=<MobileApp1> &oracle_requested_assertions=oracle-idm:/oauth/assertion-type/client-identity/ mobile-client-pre-authz-code-client'
レスポンス
{ "expires_in":300, "token_type":"Bearer", "oracle_tk_context":"pre_azc", "access_token":"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCIsImt...5_LsQwlg7y-D8TW_0Q" }
デバイス登録用の認可コードをリクエストするために、ユーザー・エージェントは次のURLを使用します。認可サービスは、リダイレクションURIを使用してクライアントに認可コードを送信します。
http://host:port/ms_oauth/oauth2/endpoints/oauthservice/ authorize?client_id=MobileApp1&redirect_uri=<Mobile App URL Scheme> &response_type=code &oracle_requested_assertions=urn:ietf:params:oauth:client-assertion-type: jwt-bearer &oracle_pre_authz_code=<Mobile Device Client Verification Code >
レスポンス
<Mobile App URL Scheme>?code=eyJhbGciOiJSUzUxMiIsIns93I6...A0qenJQX5rrtRpdZJl50bS0
このリクエストは、モバイル・クライアント・アサーションおよびJWTユーザー・アサーションを作成します。JWTユーザー・アサーションはサーバー側のデバイス・ストアに格納されます。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=authorization_code &code=<Authorization Code for Device Registration> &client_id=<MobileApp1> &redirect_uri=<Mobile App URL Scheme> &oracle_device_profile=<Base 64 Encoding Device Profile>
レスポンス
{ "oracle_client_assertion_type":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "expires_in":604800, "token_type":"Bearer", "oracle_tk_context":"client_assertion", "refresh_token":"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCIsImtpZCI6...7iEID1pLavdMsIg" }
このリクエストは、モバイル・クライアント・アサーションおよびJWTユーザー・アサーションを作成します。ソーシャル・アイデンティティ・プロバイダは、レスポンスでアクセス・トークンを送信します。JWTユーザー・アサーションはサーバー側のデバイス・ストアに格納されます。
curl - i - H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' - H 'Cache-Control: no-cache, no-store, must-revalidate' --request POST http: //host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=authorization_code &code=<Authorization Code for Device Registration> &client_id=<MobileAppName> &redirect_uri=<Mobile App URL Scheme> &oracle_device_profile=<Base 64 Encoding of Device Profile>'
レスポンス
{ "oracle_client_assertion_type":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "social_payload": "{ "UserProfile": { "mail":"exampleuser@yahoo.com", "lastname":"", "commonname":"Scott", "firstname":"Scott", "loginid":"exampleuser@yahoo.com", "password":"", "displayname":"Scott" }, "IdentityProvider":"Facebook", "Protocol":"OAuth", "oauth_access_token": "{ "access_token":"CAAUh80zH...wwHKZCAu", "expiry":5183984, "consumer":"OAuthMobileApplication", "provider":"Facebook" }" }", "expires_in":604800, "token_type":"Bearer", "oracle_tk_context":"client_assertion", "refresh_token":"eyJh.....", "access_token":"eyJhbGciOiJSUzUxMiIs......." }
この項では、デバイス登録のためのモバイル・クライアント検証コード(必要な場合)用のRESTリクエストについて説明します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=client_credentials &oracle_device_profile=<Base 64 Encoding Device Profile> &client_id=<MobileApp1> &oracle_requested_assertions=oracle-idm:/oauth/assertion-type/client-identity /mobile-client-pre-authz-code-access'
レスポンス
{ "expires_in":300, "token_type":"Bearer", "oracle_tk_context":"pre_azc", "access_token":"eyJhbGciOiJSUzUxMiI4sInR5h4cCI6IkpXVCIsIm...NQXXd5_LsQy-D8TW_0Q" }
デバイス登録用の認可コードをリクエストするために、ユーザー・エージェントは次のURLを使用します。認可サービスは、リダイレクションURIを使用してクライアントに認可コードを送信します。
http://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/ authorize?client_id=MobileApp1&redirect_uri=<Mobile App URL Scheme> &response_type=code &scope=<Resource Scope> &oracle_pre_authz_code=<optional Mobile Device Client Verification Code>
レスポンス
<Mobile App URL Scheme>?code=eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVC...m_7FMwRXyEJI8J4JmPDf8RFdM7MP4_x3IBmK9amUAPRFJRNg
次のリクエストは、サーバー側デバイス・ストアでJWTユーザー・アサーションが有効な場合、OAuthアクセス・トークンを作成します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:14100/ms_oauth/oauth2/endpoints /oauthservice/tokens -d 'grant_type=authorization_code &code=<Authorization Code for Access Token> &client_id=<MobileApp1> &redirect_uri=<Mobile App URL Scheme> &oracle_device_profile=<optional base 64 encoding device profile> &client_assertion=<Mobile Client Assertion> &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
レスポンス
{ "expires_in":3600, "token_type":"Bearer", "refresh_token":"eyJhbGiiIsInR5cCI6IkpXVCmtaWRfdHlwZSI6IBfVUDM5Qi00Q0U3LUxyJ6ndU" }
次のリクエストは、サーバー側デバイス・ストアでJWTユーザー・アサーションが有効な場合、OAuthアクセス・トークンを作成します。ソーシャル・アイデンティティ・プロバイダは、レスポンスでアクセス・トークンを送信します。
curl -i -H 'Accept: */*' --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=authorization_code &code=<Authorizaton Code for Access Token> &client_id=<MobileAppName> &redirect_uri=<Mobile App URL Scheme> &oracle_device_profile=<Optional Base 64 Encoding of Device Profile> &client_assertion=<Mobile Client Assertion> &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
レスポンス
{ "expires_in":3600, "token_type":"Bearer", "access_token":"ey...3JhY2xlLm9hdXRoLn", "social_payload": "{ "UserProfile": { "mail":"exampleuser@yahoo.com", "lastname":"", "commonname":"Scott", "firstname":"Scott", "loginid":"exampleuser@yahoo.com", "password":"", "displayname":"Scott" }, "IdentityProvider":"Facebook", "Protocol":"OAuth", "oauth_access_token": "{ "access_token":"CAAUh80zHfPQBA....lP4kmNRyg", "expiry":5113635, "consumer":"OAuthMobileApplication", "provider":"Facebook" }" }" }
このリクエストは、次のようにモバイル・シングル・サインアウトを提供します。
サーバー側デバイス・キー・チェーンからJWTユーザー・アサーションを削除します
終了して、OAMユーザー・トークンとOAMユーザー・セッション・データをサーバー側デバイス・キーストアから削除します
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/oammsui/oauthservice/logout -d 'client_id=MobileApp1 &redirect_uri=mobileapp:// &oracle_device_profile=<Base 64 Encoding Device Profile> &client_assertion=<Mobile Client Assertion> &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
レスポンス
HTTP/1.1 200 OK Date: Mon, 02 Dec 2013 22:55:37 GMT Content-Length: 0 Set-Cookie: JSESSIONID=z17tSdPLd7TG11dw7wNtTlJnzGXty3y3B8TqwW1GNvHjmzv6FqGv!535445357; path=/; HttpOnly X-ORACLE-DMS-ECID: 09edd9b26949554d:f4833c6:142b4da1082:-8000-000000000000277f X-Powered-By: Servlet/2.5 JSP/2.1
この項では、2-leggedモバイル・クライアント・フロー用のRESTコールについて説明します。詳細は、『Oracle Fusion Middleware Oracle Access Management管理者ガイド』を参照してください。
注意: すべての属性の名前および値では、大/小文字が区別されます。 |
この項では、次の項目について説明します。
この11.1.2.3.0リリース以降のOAMサーバーは、アプリケーション・プロファイル取得リクエストに応じて、可能な権限タイプを返します。レスポンスは、クライアントがサーバーに正しいコールを行えるように、サーバー側SSOが有効かどうかに関係なく返されて、どのように構成されているかをクライアントに知らせます。リクエストとサンプル・レスポンスを次に示します。
curl -i --request GET 'http://host:port/ms_oauth/oauth2/endpoints /oauthservice/appprofiles/MobileApp1?device_os=iPhone%20OS&os_ver=7.000000'
HTTPレスポンス
{"allowedGrantTypes":["oracle-idm:/oauth/grant-type/oam_credentials", "urn:ietf:params:oauth:grant-type:jwt-bearer","refresh_token","code","client_credentials","authorization_code","password", "oracle-idm:/oauth/grant-type/challenge-answer"], "client_id":"mobileClient", "mobileAppConfig":{"claimAttributes": ["oracle:idm:claims:client:sdkversion","oracle:idm:claims:client:networktype", "oracle:idm:claims:client:fingerprint","oracle:idm:claims:client:phonenumber", "oracle:idm:claims:client:iosidforad","oracle:idm:claims:client:ostype", "oracle:idm:claims:client:imei","oracle:idm:claims:client:phonecarriername", "oracle:idm:claims:client:iosidforvendor","oracle:idm:claims:client:jailbroken", "oracle:idm:claims:client:udid","oracle:idm:claims:client:geolocation", "oracle:idm:claims:client:vpnenabled","oracle:idm:claims:client:locale", "oracle:idm:claims:client:osversion"]}, "oauthAuthZService":"/ms_oauth/oauth2/endpoints/oauthservice/authorize", "oauthNotificationService":"/ms_oauth/oauth2/endpoints/oauthservice/push", "oauthTokenService":"/ms_oauth/oauth2/endpoints/oauthservice/tokens", "oracleConsentServiceProtection":"OAM","oracleMobileSecurityLevel":"LOW", "server_side_sso":true,"sharedKeyAttributeName":"secret_key", "userConsentService":["/ms_oauth/resources/consentmanagement"], "userProfileService":["/ms_oauth/resources/userprofile"]}
ジェイルブレーク検出ポリシーのないHTTPレスポンス
{ "allowedGrantTypes": [ "urn:ietf:params:oauth:grant-type:jwt-bearer", "client_credentials", "oracle-idm:/oauth/grant-type/mobile-client-registration-key", "password" ], "client_id":"MobileApp1", "mobileAppConfig":{ "claimAttributes":[ "oracle:idm:claims:client:geolocation", "oracle:idm:claims:client:imei", "oracle:idm:claims:client:jailbroken", "oracle:idm:claims:client:locale", "oracle:idm:claims:client:networktype", "oracle:idm:claims:client:ostype", "oracle:idm:claims:client:osversion", "oracle:idm:claims:client:phonecarriername", "oracle:idm:claims:client:phonenumber", "oracle:idm:claims:client:sdkversion", "oracle:idm:claims:client:udid", "oracle:idm:claims:client:vpnenabled", "oracle:idm:claims:client:fingerprint", "oracle:idm:claims:client:iosidforvendor", "oracle:idm:claims:client:iosidforad" ] }, "oauthAuthZService":"/ms_oauth/oauth2/endpoints/oauthservice/authorize", "oauthNotificationService":"/ms_oauth/oauth2/endpoints/oauthservice/push", "oauthTokenService":"/ms_oauth/oauth2/endpoints/oauthservice/tokens", "oracleMobileSecurityLevel":"LOW", "userConsentService":["/ms_oauth/resources/consentmanagement"], "userProfileService":["/ms_oauth/resources/userprofile"], "oracleConsentServiceProtection":"OAM" }
ジェイルブレーク検出ポリシーのあるHTTPレスポンス
{ "allowedGrantTypes": [ "urn:ietf:params:oauth:grant-type:jwt-bearer", "client_credentials", "oracle-idm:/oauth/grant-type/mobile-client-registration-key", "password" ], "client_id":"ACMEStock", "jailBreakingDetectionPolicy": { "autoCheckPeriodInMin":60, "detectionLocation": [ {"action":"exists", "filePath":"/bin/bash", "success":true }, {"action":"exists", "filePath":"/Applications/Cydia.app", "success":true }, {"action":"exists", "filePath":"/Applications/limera1n.app", "success":true }, {"action":"exists", "filePath":"/Applications/greenpois0n.app", "success":true }, {"action":"exists", "filePath":"/Applications/blackra1n.app", "success":true }, {"action":"exists", "filePath":"/Applications/blacksn0w.app", "success":true }, {"action":"exists", "filePath":"/Applications/redsn0w.app", "success":true }, {"action":"exists", "filePath":"/Applications/sn0wbreeze.app", "success":true } ], "device_os":"iPhone OS", "os_ver":"7.000000", "policyExpirationInSec":3600 }, "mobileAppConfig": { "claimAttributes":[ "oracle:idm:claims:client:geolocation", "oracle:idm:claims:client:imei", "oracle:idm:claims:client:jailbroken", "oracle:idm:claims:client:locale", "oracle:idm:claims:client:networktype", "oracle:idm:claims:client:ostype", "oracle:idm:claims:client:osversion", "oracle:idm:claims:client:phonecarriername", "oracle:idm:claims:client:phonenumber", "oracle:idm:claims:client:sdkversion", "oracle:idm:claims:client:udid", "oracle:idm:claims:client:vpnenabled", "oracle:idm:claims:client:fingerprint", "oracle:idm:claims:client:iosidforvendor", "oracle:idm:claims:client:iosidforad" ] }, "oauthAuthZService":"/ms_oauth/oauth2/endpoints/oauthservice/authorize", "oauthNotificationService":"/ms_oauth/oauth2/endpoints/oauthservice/push", "oauthTokenService":"/ms_oauth/oauth2/endpoints/oauthservice/tokens", "oracleMobileSecurityLevel":"LOW", "userConsentService":["/ms_oauth/resources/consentmanagement"], "userProfileService":["/ms_oauth/resources/userprofile"], "oracleConsentServiceProtection":"OAM" }
この項では、デバイス登録のためのモバイル・クライアント検証コード用のRESTリクエストについて説明します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2 /endpoints/oauthservice/tokens -d 'grant_type=client_credentials &oracle_device_profile=<Base 64 Encoding Device Profile> &client_id=<MobileApp1> &oracle_requested_assertions=oracle-idm:/oauth/assertion-type/client-identity/ mobile-client-pre-authz-code-client'
レスポンス
{ "expires_in":300, "token_type":"Bearer", "oracle_tk_context":"pre_azc", "access_token":"eyJhbGciOiJg0LzJL...6LnHpAhcZA-EfJU9jQYH4GPINQXXd5_LsQy-D8TW_0Q" }
このリクエストは、モバイル・クライアント・アサーションおよびJWTユーザー・アサーションを作成します。JWTユーザー・アサーションはサーバー側のデバイス・ストアに格納されます。また、Oracle Adaptive Access Managerとadaptive-accessアクセス・セキュリティ・プラグインがアクティブである場合、OAAMデバイス・ハンドルとOAAMセッション・ハンドルが作成されて、サーバー側デバイス・ストアに格納されます。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2 /endpoints/oauthservice/tokens -d 'grant_type=password &username=userAbc123 &password=passwordAbc123 &client_id=<MobileApp1> &oracle_pre_authz_code=<Mobile Device Verification Code> &oracle_device_profile=<Base 64 Encoding Device Profile> &oracle_requested_assertions=urn:ietf:params:oauth: client-assertion-type:jwt-bearer'
レスポンス
これは、Oracle Adaptive Access Managerとadaptive-accessアクセス・セキュリティ・プラグインがアクティブでない場合のレスポンスです。
{ "expires_in":3600, "token_type":"Bearer", "access_token":"eyJhbcOiJSzUxMIsInR5cCI6IkpX...OQN5mrZrl5pGyEJOMm4BSLQVVZhLsS5g" }
OAAMとAdaptive-Accessセキュリティ・プラグインが有効である場合のレスポンス
{ "oracle_client_assertion_type":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "oracle_aux_tokens": { "user_assertion": { "oracle_token_in_server_device_store":true, "expires_in":28800, "token_type":"Bearer", "oracle_tk_context":"user_assertion", "oracle_grant_type":"urn:ietf:params:oauth:grant-type:jwt-bearer", "access_token":"eyJhbGciOiJSUzUxM...6Ik5BRVNyanZha0dUlBVGlGQSJ9" } }, "expires_in":604800, "token_type":"Bearer", "oracle_tk_context":"client_assertion", "access_token":"eyJhbGciOiJSUzUxM...6Ik5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" }
セキュリティ・プラグインが"Denied"と応答した場合のレスポンス
このレスポンスは、Oracle Adaptive Access Managerとadaptive-accessアクセス・セキュリティ・プラグインがアクティブな場合のみ発生します。セキュリティ・プラグインが"denied"と応答した場合、何も作成されないか、サーバー側デバイス・ストアに格納されません。
HTTP/1.1 401 Unauthorized { "error":"DENIED", "error_description":"Denied Action is triggered", }
チャレンジ・アクションが起動した場合のレスポンス
このレスポンスは、Oracle Adaptive Access Managerとadaptive-accessアクセス・セキュリティ・プラグインがアクティブな場合のみ発生します。セキュリティ・プラグインが"challenge"と応答した場合、チャレンジの質問が返されます。mobile.multi_step_authn_session_handle
に関連付けられたユーザー情報は、タイムアウト値とともに、メモリーに格納されます。ユーザーは、タイムアウト値が期限切れになる前に、チャレンジの質問に答える必要があります。ユーザーのレスポンスを送信するには、「ナレッジベース認証(KBA)チャレンジ・リクエストへの回答」を参照してください。
HTTP/1.1 401 Unauthorized { "error": "REQUIRE_MULTI_STEP_AUTHN", "error_description": "The Challenge Action is triggered", "multi-step-challenge-question": { "challengeType": "KBA", "locale": "en-us", "questionRefId": "80", "questionStr": "What model was your first car?", ”mobile.multiStepAuthnSessionHandle”: ”eyJvcmlnU2VjdXJpdHlFdmVudHMiOlsiUkVHX1…..” } }
Oracle Adaptive Access Managerとadaptive-accessアクセス・セキュリティ・プラグインがアクティブな場合、およびプラグインの応答が"challenge"の場合に適用されます。
curl - i - H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm:/mobile/grant-type/mobile-client-challenge-answer &oracle_device_profile=<Base 64 Encoded Device Profile> &challenge_response=<Base 64 Encoded Response> &oracle_requested_assertions=urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
challenge_response
リクエスト・パラメータに、次のJSONのbase-64エンコードされたバージョンを入力します。
{ "challenge":"KBA", "locale": "en - us", "question_ref_id": "80", "mobile.multi_step_authn_session_handle": "eyJvcmlnU2VjdXJpdHlFdmVudHMiOlsiUkVHX1….." }「サーバー側SSO機能が無効の場合のモバイル・フロー」→「ナレッジベース認証(KBA)チャレンジ・リクエストへの回答」の項
"Allowed"レスポンス
セキュリティ・プラグインが回答を検証して"allowed"と応答した場合、OAAMデバイス・ハンドルとOAAMセッション・ハンドルが作成され、サーバー側キーストアに保存されます。
{ "oracle_client_assertion_type":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "oracle_aux_tokens": { "user_assertion": { "oracle_token_in_server_device_store":true, "expires_in":28800, "token_type":"Bearer", "oracle_tk_context":"user_assertion", "oracle_grant_type":"urn:ietf:params:oauth:grant-type:jwt-bearer", "access_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" } }, "expires_in":604800, "token_type":"Bearer", "oracle_tk_context":"client_assertion", "access_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" }
"Denied"レスポンス
セキュリティ・プラグインが"denied"と応答した場合、何も作成されないか、サーバー側キーストアに格納されません。
HTTP/1.1 401 Unauthorized { "error":"DENIED", "error_description":"Denied Action is triggered" }
"Timeout"レスポンス
タイムアウト値が期限切れになる前にユーザーがチャレンジの質問に回答しなかった場合、セキュリティ・プラグインは回答を検証せず、何も作成されないか、サーバー側キーストアに格納されません。
HTTP/1.1 401 Unauthorized { "error":"TIMEOUT", "error_description":"Timeout Action is triggered" }
このリクエストは、サーバー側デバイス・キー・チェーンからJWTユーザー・アサーションを消去します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/oammsui/oauthservice/logout -d 'client_id=MobileApp1 &redirect_uri=mobileapp:// &oracle_device_profile=<Base 64 Encoding Device Profile> &client_assertion=<Mobile Client Assertion> &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
レスポンス
HTTP/1.1 200 OK Date: Mon, 02 Dec 2013 22:55:37 GMT Content-Length: 0 Set-Cookie: JSESSIONID=z17tSdPLd7TG11dw7wNtTlJnzGXty3y3B8TqwW1GNvHjmzv6FqGv!535445357; path=/; HttpOnly X-ORACLE-DMS-ECID: 09edd9b26949554d:f4833c6:142b4da1082:-8000-000000000000277f X-Powered-By: Servlet/2.5 JSP/2.1
このリクエストは、サーバー側デバイス・キー・チェーンにJWTユーザー・アサーションを作成します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2 /endpoints/oauthservice/tokens -d 'grant_type=password &username=user123 &password=pwd456xyz &client_assertion=<MOBILE CLIENT ASSERTION> &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type %3Ajwt-bearer &oracle_device_profile=<BASE 64 ENCODING DEVICE PROFILE> &oracle_requested_assertions=oracle-idm%3A%2Foauth%2Fassertion-type %2Fuser-identity%2Fjwt&oracle_use_server_device_store=true'
レスポンス
{"oracle_token_in_server_device_store":true, "expires_in":28800, "token_type":"Bearer", "oracle_tk_context":"user_assertion", "oracle_grant_type":"urn:ietf:params:oauth:grant-type:jwt-bearer", "access_token":""}
このリクエストは、サーバー側デバイス・ストアでJWTユーザー・アサーションが有効な場合、OAMユーザー・トークンおよびOAMマスター・トークンを作成します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" –request http://host:port/ms_oauth/oauth2/ endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &user_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Auser-assertion-type %3Ajwt-bearer &client_assertion=<MOBILE CLIENT ASSERTION> &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type %3Ajwt-bearer &oracle_device_profile=<BASE 64 ENCODING DEVICE PROFILE> &oracle_use_server_device_store=true'
レスポンス
{"oracle_token_in_server_device_store":true, "oracle_aux_tokens": {"oam_mt": {"oracle_tk_context":"oam_mt", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/oam\/master-token", "access_token":"VERSION_4%7EDj10z62v9CQbnuX...Stid6XMhamU%2B" } }, "oracle_tk_context":"oam_ut", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/user-token\/oam", "access_token":"" }
このリクエストは、サーバー側デバイス・ストアでOAMユーザー・トークンが有効な場合、OAMアクセス・トークンおよびOAMマスター・トークンを作成します。次のリクエストにおいて、oracle_oam_application_resource
はWebGateに保護されたリソースで、oracle_oam_application_context
はWebGateによって生成された値であることに注意してください。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" –request http://host:port/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_use_server_device_store=true &user_assertion_type=oracle-idm:/oauth/assertion-type/user-identity/oam &client_assertion=<MOBILE CLIENT ASSERTION> &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type %3Ajwt-bearer &oracle_device_profile=<BASE 64 ENCODING DEVICE PROFILE> &scope=oracle.security.oauth.oam.resource_access &oracle_oam_application_context=<WebGate generated value> &oracle_oam_application_resource=http%3A%2F%2Fhost.example.com %3A12884%2Findex.html'
レスポンス
{ "oracle_aux_tokens": {"oam_ut": {"oracle_token_in_server_device_store":true, "oracle_tk_context":"oam_ut", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/user-token\/oam", "access_token":"" } }, "oracle_tk_context":"oam_at", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/resource-access-token\/oam", "access_token":"3F62m7EDq%2FRMIwA16gUjg40DT43xDEik...xAViyc7XmzGIFBoBsNbbuN6SO1" }
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &username=alice &password=welcome &client_assertion=<MOBILE CLIENT ASSERTION> &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &oracle_device_profile=<BASE 64 ENCODING DEVICE PROFILE> &oracle_use_server_device_store=true &scope=UserProfile.users'
レスポンス
{ "expires_in":3600, "token_type":"Bearer", "access_token":"eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCciO...iJSfkhhXLHhonktvigMCeI" }
次のリクエストは、サーバー側デバイス・ストアでJWTユーザー・アサーションが有効な場合、OAuthサービス・アクセス・トークンを作成します。
curl -i - H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POSThttp: //host:port/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer &client_id=App2 &oracle_pre_authz_code=<Mobile DeviceVerification Code > &oracle_device_profile = < Base 64 Encoding DeviceProfile > &oracle_requested_assertions = urn: ietf: params: oauth: client- assertion- type: jwtbearer &oracle_use_server_device_store = true'
レスポンス
HTTP / 1.1 200 OK { "oracle_client_assertion_type": "un:ietf:params:oauth:client-assertion-type:jwt-bearer", "expires_in": 604800, "token_type": "Bearer", "oracle_tk_context": "client_assertion", "refresh_token": "eyJhbGciOiJSUzUxMiIsInR5cCI6Ikp...mbmU5cDl2WjhtdUlBVGlGQSJ9.", "access_token": "eyJhbGciOiJSUzUxMiIsInR5cCI6Ikp...mbmU5cDl2WjhtdUlBVGlGQSJ9." }
サーバー側JWTユーザー・トークンが期限切れまたは無効である場合のレスポンス
HTTP/1.1 401 Unauthorized { "error":"invalid_grant", "error_description":"Invalid Grant: grant_type=urn:ietf:params:oauth:grant]type:jwt]bearer"}
サーバー側SSO使用の利点は、サーバーがセッションと関連アーティファクトを維持するため、クライアントはセッションの維持でなくアプリケーションのビジネス面に集中できることです。サーバー側SSOを無効にするのは、クライアントがSSOを制御する必要があるときのみにしてください。サーバー側SSOをオフにすると、2-leggedモバイルOAuthサービス・シナリオは、トークンをサーバー側デバイス・ストアに格納する代わりに、アプリケーションにトークンを返します。
注意: 詳細は、Oracle Fusion Middleware Oracle Access Management管理者ガイドのモバイルOAuthサービスのサーバー側シングル・サインオンの理解に関する項を参照してください。 |
管理者は、serverside.sso.enabled
構成パラメータをfalse
に設定することによって、OAuthサービスのサービス・プロファイル・レベルでサーバー側SSOオプションを無効にできます。次の各項では、サーバー側SSOが無効の場合のモバイル・リクエストとレスポンスの詳細を説明します。
JWTクライアント・アサーションおよびユーザー・アサーションを使用した、標準JWTアサーション権限タイプを使用するアクセス・トークンの作成
JWTユーザー・アサーション + ユーザーPIN資格証明を使用したOAMユーザー・トークンとOAMマスター・トークンの作成(トークン交換)
クライアントおよびユーザー・アサーションを作成します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=password &username=userAbc123 &password=passwordAbc123 &client_id=App1 &oracle_pre_authz_code=<Mobile Device Verification Code> &oracle_device_profile=<Base 64 Encoding Device Profile> &oracle_requested_assertions=urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
レスポンス
{ "oracle_client_assertion_type":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "oracle_aux_tokens": { "user_assertion": { "expires_in":28800, "token_type":"Bearer", "oracle_tk_context":"user_assertion", "oracle_grant_type":"urn:ietf:params:oauth:grant-type:jwt-bearer", "access_token":"eyJhbGciOiJSUzUxM...6Ik5BRVNyanZha0dUlBVGlGQSJ9" } }, "expires_in":604800, "token_type":"Bearer", "oracle_tk_context":"client_assertion", "refresh_token":"eyJhbGciOiJSUzUxM...6Ik5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9", "access_token":"eyJhbGciOiJSUzUxM...6Ik5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" }
クライアント・アサーションを作成します。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer &client_id=App2 &oracle_pre_authz_code=<Mobile Device Verification Code> &oracle_device_profile=<Base 64 Encoding Device Profile> &oracle_requested_assertions=urn:ietf:params:oauth:client-assertion-type:jwt-bearer &assertion=<JWT User Assertion>'
肯定レスポンス
HTTP/1.1 200 OK { "oracle_client_assertion_type":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "expires_in":604800, "token_type":"Bearer", "oracle_tk_context":"client_assertion", "refresh_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9", "access_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" }
否定的応答
HTTP/1.1 401 Unauthorized {"error":"invalid_grant", "error_description":"Invalid Grant: grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer" }
チャレンジ・アクションが起動した場合のレスポンス
Oracle Adaptive Access Managerのadaptive-accessセキュリティ・プラグインがアクティブで、ナレッジベース認証(KBA)が有効な場合にのみ適用されます。
HTTP/1.1 401 Unauthorized {"error":"require_multi_step_authn", "oracle_challenge_questions": {"questionList": [ {"challengeType":"KBA", "questionStr":"What color was your first dog?", "questionRefId":"98" } ], "mobile.multiStepAuthnSessionHandle":"eyJ……MkE", "locale":"en" }, "error_description":"The Challenge Action is triggered " }
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer &assertion=<JWT User Assertion> &client_id=App1 &client_assertion=<Mobile Client Assertion> &scope=UserProfile.users'
このリクエストでは、サンプル・リクエストRegister Mobile App1 Using a User Name and Passwordの際に返された<JWT User Assertion>および<Mobile Client Assertion>レスポンス値を送信します。
肯定レスポンス
{ "expires_in":3600, "token_type":"Bearer", "refresh_token":"eyJhbGciOiJSUzUx...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9", "access_token":"eyJhbGciOiJSUzUxMi...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" " }
否定的応答
HTTP/1.1 401 Unauthorized { "error":"invalid_grant", "error_description":"Invalid Grant: grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer" }
JWTユーザー・アサーション値が期限切れの場合、モバイル・アプリケーションは「ログイン(JWTユーザー・アサーションの作成)」の手順を使用してJWTユーザー・アサーションを作成できます。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type= oracle-idm:/oauth/grant-type/challenge -answer& &client_id=App1 &oracle_requested_assertions=urn:ietf:params:oauth:client-assertion-type:jwt-bearer &oracle_device_profile=<Base 64 Encoded Device Profile> &oracle_challenge_response=<Base 64 Encoded Response>'
oracle_challenge_response
リクエスト・パラメータに、次のJSONのbase-64エンコードされたバージョンを入力します。
{ "mobile.multi_step_authn_session_handle":"eyJ......MkE", "locale":"en", "answer_list": [ { "question_ref_id":"98", "challenge_type":"KBA", "question_ans":"dog" } ] }
肯定HTTPレスポンス
HTTP/1.1 200 OK { "oracle_client_assertion_type":"urn:ietf:params:oauth:client-assertion-type:jwt-bearer", "oracle_aux_tokens":{ "user_assertion":{ "expires_in":28800, "token_type":"Bearer", "oracle_tk_context":"user_assertion", "oracle_grant_type":"urn:ietf:params:oauth:grant-type:jwt-bearer", "access_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" } }, "expires_in":604800, "token_type":"Bearer", "oracle_tk_context":"client_assertion", "refresh_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9", "access_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" }
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=refresh_token &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer &client_id=App1 &client_assertion=<Mobile Client Assertion> &scope=UserProfile.users &refresh_token=<Refresh Token>'
肯定レスポンス
{ "expires_in":3600, "token_type":"Bearer", "refresh_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9", "access_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" }
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'client_id=App1 &grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Fuser-token%2Fjwt &assertion=<JWT User Assertion> &oracle_token_action=delete &oracle_device_profile=<Base 64 Device Profile> &client_assertion=<Mobile Client Assertion> &client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
このリクエストでは、サンプル・リクエストRegister Mobile App1 Using a User Name and Passwordの際に返された<JWT User Assertion>および<Mobile Client Assertion>レスポンス値を送信します。
肯定レスポンス
{"successful":true}
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=password &username=weblogic &password=welcome1 &client_assertion=<MOBILE CLIENT ASSERTION> &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &oracle_device_profile=<Base 64 Device Profile> &oracle_requested_assertions=oracle-idm%3A%2Foauth%2Fassertion-type%2Fuser-identity%2Fjwt'
肯定レスポンス
{ "expires_in":28800, "token_type":"Bearer", "oracle_tk_context":"user_assertion", "oracle_grant_type":"urn:ietf:params:oauth:grant-type:jwt-bearer", "access_token":"eyJhbGciOiJSUzUxM...k5BRVNyanZha0RmbmU5cDl2WjhtdUlBVGlGQSJ9" }
ユーザー名とパスワードが無効の場合の否定HTTPレスポンス
HTTP/1.1 401 Unauthorized { "error":"invalid_grant", "error_description":"Invalid resource owner user name or password " }
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" –request https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &user_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Auser-assertion-type%3Ajwt-bearer &user_assertion=<JWT User Assertion> &client_assertion=<MOBILE CLIENT ASSERTION> &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &oracle_device_profile=<Base 64 Device Profile>'
肯定レスポンス
{ "oracle_aux_tokens": { "oam_mt": { "oracle_tk_context":"oam_mt", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/oam\/master-token", "access_token":"VERSION_4%...." } }, "oracle_tk_context":"oam_ut", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/user-token\/oam", "access_token":"fEmB0nPdgGfyNjshws8z….. " }
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" –request https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &user_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Auser-assertion-type%3Ajwt-bearer &user_assertion=<JWT User Assertion> &client_assertion=<MOBILE CLIENT ASSERTION> &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &oracle_device_profile=<Base 64 Device Profile> &oracle_user_credentials=<Base 64 encoding of user credential>'
oracle_user_credentials
リクエスト・パラメータに、ユーザー資格証明ペイロードJSONのbase-64エンコードされたバージョンを入力します。たとえば、これがPINである場合:
{"pin":"123"}
Base 64エンコード値は次のようになります。
eyJwaW4iOiIxMjMifQ==
肯定レスポンス
{ "oracle_aux_tokens": { "oam_mt": { "oracle_tk_context":"oam_mt", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/oam\/master-token", "access_token":"VERSION_4%...." } }, "oracle_tk_context":"oam_ut", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/user-token\/oam", "access_token":"fEmB0nPdgGfyNjshws8z….. " }
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" –request https://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &user_assertion_type=oracle-idm:/oauth/assertion-type/user-identity/oam &client_assertion=<MOBILE CLIENT ASSERTION> &user_assertion=<JWT User Assertion> &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &oracle_device_profile=<Base 64 Device Profile> &scope=oracle.security.oauth.oam.resource_access&oracle_oam_application_context=dfsdfsdfsdfsdf &oracle_oam_application_resource=http%3A%2F%2Fhost.example.com%3A12884%2Findex.html'
肯定レスポンス
{ "oracle_tk_context":"oam_at", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/resource-access-token\/oam", "access_token":"3F62m7EDq%....." }
この項では、OAuthサービスからトークンを取得するRESTコールについて説明します。
注意: すべての属性の名前および値では、大/小文字が区別されます。 |
この項では、次の項目について説明します。
この項では、クライアント資格証明をユーザー名およびパスワードとともに使用して、JWTユーザー・トークン、JWTアクセス・トークン、OAMユーザー・トークンおよびマスター・トークン、OAMアクセス・トークンのいずれかを取得する方法を説明します。
この項では、次の項目について説明します。
この項で示されているリクエストには、次の基本テンプレートが使用されています。
curl -i -H 'Authorization: Basic <sample client ID and password>' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/ endpoints/oauthservice /tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &username=<username> &password=<password> &oracle_requested_assertions=<Oracle_Requested_Assertion_Type> &oam_authen_resource=<oam_authen_resource>'
次の点に注意してください。
クライアントIDおよびパスワードの例は、以下の形式となっています。
userID123:password123
--> base 64 encoding -->
NTQzMjFpZDp3ZWxjb21lMQ==
実際のクライアントIDは、マシンが生成するGUIDになります。
次のアサーション・タイプを指定できます。
oracle-idm%3A%2Foauth%2Fassertion-type%2Fuser-identity%2Foam
oracle-idm%3A%2Foauth%2Fassertion-type%2Fuser-identity%2Fjwt
oam_authen_resource
オプション・パラメータを使用して、OAMサーバー側で構成される認証リソース名を指定します。
$ curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &username=user123 &password=passwordAbc12323 &oracle_requested_assertions= oracle-idm%3A%2Foauth%2Fassertion-type%2Fuser-identity%2Fjwt'
$ curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &username=user123 &password=passwordAbc123 &scope=ConsentManagement.retrieve ConsentManagement.grant ConsentManagement.revoke'
$ curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &username=user123 &password=passwordAbc123'
この項では、クライアント資格証明をoracle_user_credentials
の値とともに使用して、JWTユーザー・トークン、JWTアクセス・トークン、OAMユーザー・トークンおよびマスター・トークン、OAMアクセス・トークンのいずれかを取得する方法を説明します。
この項では、次の項目について説明します。
この項で示されているリクエストには、次の基本テンプレートが使用されています。
curl -i -H 'Authorization: Basic <sample client ID and password>' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_user_credentials=<ORACLE_USER_CREDENTIALS> &oracle_requested_assertions=<Oracle_Requested_Assertion_Type> &oam_authen_resource=<oam_authen_resource>'
次の点に注意してください。
oracle_user_credentials
は次の形式をとります。
{"userid":"user123","password":"password123"}
>> JSONデータをBase64エンコードした値 >>
eyJ1c2VyaWQiOiJ3ZWJsb2dpYyIsInBhc3N3b3JkIjoid2VsY29tZTEifQ==
実際のクライアントIDは、マシンが生成するGUIDになります。
次のアサーション・タイプを指定できます。
oracle-idm%3A%2Foauth%2Fassertion-type%2Fuser-identity%2Foam
oracle-idm%3A%2Foauth%2Fassertion-type%2Fuser-identity%2Fjwt
oam_authen_resource
オプション・パラメータを使用して、OAMサーバー側で構成される認証リソース名を指定します。
$ curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_user_credentials=eyJ1c2VyaWQiOiJ3ZWJsb2dpYyIsInBhc3N3b3JkIjoid2VsY29tZT EifQ== &oracle_requested_assertions=oracle-idm%3A%2Foauth%2Fassertion-type%2F user-identity%2Fjwt'
$ curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_user_credentials=eyJ1c2VyaWQiOiJ3ZWJsb2dpYyIsInBhc3N3b3JkIjoid2VsY29t ZTEifQ== &scope=ConsentManagement.retrieve ConsentManagement.grant ConsentManagement.revoke'
$ curl -i -H 'Authorization: Basic NTQzMjFpZDp3ZWxjb21lMQ==' -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_user_credentials=<base64_encoded_credential> &client_assertion=<client_jwt_assertion or client_saml2_assertion> &client_assertion_type=<client_assertion_type> &oracle_requested_assertions=<Oracle_Requested_Assertion_Type>'
この項では、JWTアサーションを使用して、JWTユーザー・トークン、JWTアクセス・トークン、OAMユーザー・トークンおよびマスター・トークン、OAMアクセス・トークンのいずれかを取得する方法を説明します。
この項では、次の項目について説明します。
この項で示されているリクエストには、次の基本テンプレートが使用されています。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host:port/ms_oauth/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &user_oracle_credentials=<base64_encoded_credentials> &client_assertion=eyJhbGciOiJSUzUxMiIsjiRZ1_3edKknPTCEtQS79h_44H_8VbGvnA6Dr3M0 &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type %3Ajwt-bearer &oracle_requested_assertions=oracle-idm%3A%2Foauth%2Fassertion-type%2F user-identity%2Fjwt'
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials& &user_assertion=<JWT User assertion Value> &user_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Auser-assertion-type%3Ajwt-bearer &client_assertion=eyJhbGciOiJSUzUxMiIsInR5cCI6Ik...j5mZJrfrwxgXxzwVcNbjRgi7uM8 &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer'
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &user_assertion=<JWT User assertion Value> &user_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Auser-assertion-type %3Ajwt-bearer &client_assertion=eyJhbGciOiJSUzUxMiIsInR5cCI6Ik...j5mZJrfrwxgXxzwVcNbjRgi7uM8 &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3A client-assertion-type%3Ajwt-bearer &oracle_device_profile=eyJvcmFjbGU6aWRtOmNsYWltczpjbGllbnQ6c2Rrd...1zOmNvc3ZlcnNpb24iOiI0LjAifQ== &oracle_use_server_device_store=true'
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_use_server_device_store=true &user_assertion_type=oracle-idm%3A%2Foauth%2Fassertion-type%2Fuser-identity%2oam &client_assertion=eyJhbGciOiJSR5cCI6IkpXVCIsIm...UBaJkagXsLbqb_fNJHqNfwe3QCr7Uk &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &oracle_device_profile=eyJvcmFjbtczpjbGllbnQ6c2Rrdm...pc3ZlcnNpb24iOiI0LjAifQ== &scope=oracle.security.oauth.oam.resource_access &oracle_oam_application_context=dfsdfsdfsdfsdf &oracle_oam_application_resource=http%3A%2F%2Fhost123.example.com%3A12884%2Findex.html'
この項では、JWTユーザー・アサーションとPIN(またはPIN同様のユーザー資格証明)を使用して、OAMユーザー・トークンおよびOAMマスター・トークンを取得する方法について説明します。クライアントは、JWTユーザー・アサーションとともにPINまたはパスコード値(追加資格証明として)をリクエストに指定できます。
この項では、次の項目について説明します。
この項で示されているリクエストには、次の基本テンプレートが使用されています。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" –request http://host.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_user_credentials=<Base64 encoded PIN Value> &client_assertion=<JWT Client Assertion> &client_assertion_type= urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &oracle_user_credentials=<BASE64 ENCODED USER CREDENTIALS> &user_assertion_type= urn%3Aietf%3Aparams%3Aoauth%3Auser-assertion-type%3Ajwt-bearer &oracle_device_profile=<BASE64 ENCODING DEVICE PROFILE>'
oracle_user_credentials
パラメータはオプションです。任意の名前と値のペアを含むことができる、JSONデータのBase64エンコード値です。次に例を示します。
{"pin":"pinvalue123"}
はeyJwaW4iOiJwaW52YWx1ZTEyMyJ9
とエンコードされます
レスポンス
{ "oracle_aux_tokens":{ "oam_mt":{ "oracle_tk_context":"oam_mt", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/oam\/master-token", "access_token":"" } }, "oracle_tk_context":"oam_ut", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/user-token\/oam", "access_token":"" }
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" request http://host.us.example.com:14100/ms_oauth/oauth2/endpoints/oauthservice/tokens -d ' grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &user_assertion_type= urn%3Aietf%3Aparams%3Aoauth%3Auser-assertion-type%3Ajwt-bearer &oracle_user_credentials=eyJwaW4iOiJwaW52YWx1ZTEyMyJ9 &client_assertion=eyJhbGciOiJSUzI1NiIs...jOGVj0GXMCA &client_assertion_type= urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer &oracle_device_profile=ew0KICAgIm9yYWNsZTppZG0...fQ0K &user_assertion=eyJhbGciOiJSUzI1NiIsInR5...UyFT7Y9eeo5af4OA '
レスポンス
{ "oracle_aux_tokens": { "oam_mt": { "oracle_tk_context":"oam_mt", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/oam\/master-token", "access_token":"VERSION_4%7ELw3jGjxe...F6wouV7ow" } }, "oracle_tk_context":"oam_ut", "oracle_grant_type":"oracle-idm:\/oauth\/grant-type\/user-token\/oam", "access_token":"E6Fyeco+F0GgucHJuLmlkX3R5c...DC0dsLVdJYyJ3Su2xpZWB3"}
この項では、SAML2アサーションを使用して、JWTユーザー・トークン、JWTアクセス・トークン、OAMユーザー・トークンおよびマスター・トークン、OAMアクセス・トークンのいずれかを取得する方法を説明します。
この項では、次の項目について説明します。
この項で示されているリクエストには、次の基本テンプレートが使用されています。
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host123.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_user_credentials=<base64_encoded_value> &client_assertion=<client_jwt_assertion or client_saml2_assertion> &client_assertion_type=<client_assertion_type> &oracle_requested_assertions=<Oracle_Requested_Assertion_Type>'
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_user_credentials=<base64_encoded_value> &client_assertion=PHNhbWw6QXNzZXJ0aW9uI...2ln%0AbmF0dXJltbDpBc3NlcnRpb24%2B%0A &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type %3Asaml2-bearer &oracle_requested_assertions=oracle-idm%3A%2Foauth%2Fassertion-type %2Fuser-identity%2Fjwt'
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_user_credentials=<base64_encoded_value> &client_assertion=PHNhbWw6QXNzZXJ0aW9...uIHhtbG5zOnNhhbWwc3NlcnRpb24%2B%0A &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type %3Asaml2-bearer&scope=ConsentManagement.retrieve'
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &oracle_user_credentials=<base64_encoded_value> &client_assertion=PHNhbWw6QXNzZXJ0aW9uIHhtb9InVyb...2BPC9zYW1sOkF0dHJpYnV0ZT48 &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type %3Asaml2-bearer'
この項では、モバイル・デバイス上のOAMユーザー・トークンおよびマスター・トークンまたはOAMアクセス・トークンの取得方法について説明します。
この項では、次の項目について説明します。
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=client_credentials &oracle_device_profile=eyJvcmFjbGU6aWRtOmNsYWltczpjbGllbnQ6c2RrdmVyc2l...OmNsaWVudDpvc3ZlcnNpb24iOiI0LjAifQ== &client_id=<MobileAgent1> &oracle_requested_assertions=oracle-idm%3A%2Foauth%2Fassertion-type %2Fclient-identity%2Fmobile-client-pre-authz-code-client'
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/oauthservice/tokens -d 'grant_type=password&username=userAbc123 &password=passwordAbc123 &client_id=<MobileAgent1> &oracle_pre_authz_code=eyJhbGci...SsLRxbAt8Yl473vBACuH2Ms2fR_HwhQGVu_zgI3W3a_c &oracle_device_profile=eyJvcmFjbGU6aWRtOmNsYWl...G06Y2xhaW1zOmNsaWViI0LjAifQ== &oracle_requested_assertions=urn%3Aietf%3Aparams%3Aoauth %3Aclient-assertion-type%3Ajwt-bearer'
$ curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth9%2Fgrant-type%2Foam_credentials &user_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Auser-assertion-type%3Ajwt-bearer &client_assertion=eyJhbGciOiJSUzUxMiIsInR5cCI...qwzcgoh5t7sfZInGkbprlA5UswMzqk &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type %3Ajwt-bearer &oracle_device_profile=eyJvcmFjbGU6aWRtOmNsYWltczpjbG...udDnNpb24iOiI0LjAifQ== &oracle_use_server_device_store=true'
curl -i -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST http://host.example.com:18001/ms_oauth/oauth2/endpoints/ oauthservice/tokens -d 'grant_type=oracle-idm%3A%2Foauth%2Fgrant-type%2Foam_credentials &client_assertion=eyJhbGciOiJSUzUxMiIs...6NxPv0x_Ng2pEcjVJf42p-tiBFClavI56ycCg &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type %3Ajwt-bearer &oracle_device_profile=eyJvcmFjbGU64czpjbGllbnQ6c...ivc3ZlcnNpb24iOiI0LjAifQ== &user_assertion_type=oracle-idm%3A%2Foauth%2Fassertion-type%2Fuser-identity %2Foam &scope=oracle.security.oauth.oam.resource_access &oracle_oam_application_context=fdsfsdfsdfsdf &oracle_oam_application_resource=http%3A%2F%2Fhost123.example.com %3A12884%2Findex.html &oracle_use_server_device_store=true'