ヘッダーをスキップ
Oracle® Fusion Middleware Oracle Access Management開発者ガイド
11g リリース2 (11.1.2.2.0) for All Platforms
B69537-08
  ドキュメント・ライブラリへ移動
ライブラリ
製品リストへ移動
製品
目次へ移動
目次

前
 
次
 

14 OAuthサービスAPIの使用

この章では、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のコマンドおよびサーバー・レスポンスでの改行は、単に表示上の都合により使用されています。

標準的な3-legged OAuthフロー

この項では、3-legged OAuthフロー用のRESTコールについて説明します。詳細は、Oracle Fusion Middleware Oracle Access Management管理者ガイドのOAuth 3-legged認可の理解に関する項を参照してください。

サンプル・リクエスト

次のサンプルは、フロントチャネル・フローとバックチャネル・フローの2つの部分に分かれています。フロントチャネル・フローはOAuthサーバーとリソース所有者(またはエンド・ユーザー)の間で行われ、バックチャネル・フローはOAuthサーバーとクライアント・アプリケーションの間で行われます。

パート1: フロントチャネル・リクエスト

次のフローでは、クライアント・アプリケーションは、ブラウザを使用してユーザー(リソース所有者)をOAuthサーバーの認可エンドポイントにリダイレクトします。ユーザーはOAuthサーバーで認証を行う必要があり、オプションでリクエストしたリソースへのアクセスの認可を行います(承認の提供)。ユーザーの対話が正常に完了すると、OAuthサーバーはクライアント・アプリケーションに認可コードを発行します。

その後、クライアント・アプリケーションは認可コートを使用してリソース・アクセス・トークンをリクエストしますが、これはバックチャネル・リクエストです。

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"

表14-1 リクエストのパラメータ

名前 説明 必須

response_type

このフローの場合、値はcodeである必要があります。

必須

client_id

認可サーバーによって付与されるクライアント識別子。

認可サーバーはclient_id値を構成(クライアント・レジストリ)で検証します。値が無効な場合、エラー・レスポンスがユーザー・エージェントに送信されます。

必須

redirect_uri

クライアント・アプリケーションのリダイレクトURI認可コード。送信されない場合、構成/クライアント・レジストリがチェックされ、redirect_uri値が定義されているかどうかが確認されます。そうではない場合、エラー・レスポンスがユーザー・エージェントに送信されます。

オプション

scope

空白区切りの値を使用します。構成/スコープ・レジストリでスコープ値を定義します。スコープが送信されない場合、または無効なスコープが指定された場合、エラー・レスポンスがクライアント・アプリケーションのredirect_uriに送信されます。

必須

state

リクエストとコールバックの間で状態を保持するためにクライアントによって使用される不透明な値。ユーザー・エージェントをクライアントにリダイレクトする際、認可サーバーはこの値を含めます。クロスサイト・リクエスト・フォージェリを防ぐためにこのパラメータを使用します。

推奨


サンプル認可コード・レスポンス

https: //client.example.com/return?code=eyJhbG...rWWk8hbs_o6uY&state=xyz

リソース所有者がアクセス・リクエストに応じた場合、認可サーバーは認可コードを発行し、application/x-www-form-urlencoded形式を使用してリダイレクションURIの問合せコンポーネントに次のパラメータを追加することでクライアントに認可コードを渡します。

表14-2 レスポンスのパラメータ

名前 説明

code

次の情報が含まれます。

  • 有効期限(デフォルトでは15分。この値を変更するには、「OAuthサービス・プロファイル構成」ページを開き、「トークン設定」下の有効期限設定を更新します。)

  • Client_id

  • Redirect_uri

state

認可リクエストで指定された値と同じ値。認可リクエストで指定された場合にのみ含まれます。


エラー・レスポンス

検証エラーが検出された場合、エラー・コードおよび説明を含むJSONレスポンスが送信されます。次に、エラー・コードの一部とその説明を示します。

invalid_client - クライアント識別子が無効

access_denied - エンド・ユーザーが認可を拒否

invalid_redirect_uri - redirect_uriがクライアント・アプリケーションと不一致

invalid_scope - リクエストされたスコープは無効、不明または不正

server_error - ランタイム処理エラー

エラー・レスポンス・サンプル

{”error_code”:”invalid_client”, ”error_description”:”client identifier invalid”}

パート2: バックチャネル・リクエスト

このフローは、OAuthサーバー(認可サーバー)とクライアント・アプリケーションの間で行われます。サンプルでは、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リクエストのサンプルについて説明します。リクエストでリソースが送信されない場合、結果のトークンをアイデンティティ・トークンとして使用できます。詳細は、Oracle Fusion Middleware Oracle Access Management管理者ガイドのOAuth 2-legged認可の理解に関する項を参照してください。この項では、次の例を示します。

サンプル・レスポンス

通常、この項で説明されているリクエストには次のようなレスポンスが返されます。


注意:

リクエストされたスコープがオフライン・スコープに指定されている場合、サーバー・レスポンスに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クライアント・アサーションの使用

次のサンプルでは、サード・パーティによって生成された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'

JWTクライアント・アサーションの使用

次のサンプルでは、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+シークレットの使用

次のサンプルでは、HTTP BasicヘッダーにユーザーIDとパスワードの資格証明およびクライアントID、シークレットが含まれたリソース所有者のリクエストを示します。

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=user123
    &password=password123
  '

ユーザーID/パスワード資格証明およびJWTクライアント・アサーションの使用

次のサンプルでは、ユーザー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クライアント・アサーションの使用

次の例は、ユーザー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'

SAMLユーザー・アサーション資格証明およびHTTP BasicヘッダーでのクライアントID+シークレットの使用

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

SAMLユーザー・アサーション資格証明および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=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'

SAMLユーザー・アサーション資格証明および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=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'

JWTユーザー・アサーション資格証明およびHTTP BasicヘッダーでのクライアントID+シークレットの使用

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'

JWTユーザー・アサーション資格証明および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=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'

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=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サーバーからのアクセス・トークン(クライアントおよびユーザーのアイデンティティ・トークン)の取得方法を示します。次のサンプルがあります。

クライアント・アイデンティティ・トークンの取得

この項では、クライアント・アイデンティティ・トークンを取得する3つの方法を示します。

クライアント資格証明の使用

このサンプルは、クライアント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" > ,
  "refresh_token": "<refresh token 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>
   '

最初の例のサンプル・レスポンスを参照してください。

サード・パーティが生成した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>
   '

最初の例のサンプル・レスポンスを参照してください。

ユーザー・アイデンティティ・トークンの取得

この項のサンプルでは、アクセス・トークンまたはユーザー・アサーションとも呼ばれるユーザー・アイデンティティ・トークンの取得方法を示します。3つのカテゴリがあります。

サンプル・レスポンス

すべてのリクエストで次のようなレスポンスを受け取ります。

{
  "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>"
}

ユーザーID、パスワードおよび様々なクライアント資格証明を使用したユーザー・アイデンティティ・トークンの取得

このカテゴリには3つのサンプルがあります。

HTTP BasicヘッダーでのユーザーID/パスワード資格証明およびクライアントID+シークレットの使用
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
   '

ユーザー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=sampleuser
   &password=samplepassword
   &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer
   &client_assertion=<JWT client assertion value>
   '
ユーザー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=sampleuser
   &password=samplepassword
   &client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Asaml2-bearer
   &client_assertion=<SAML client assertion value>'


SAMLユーザー・アサーション資格証明および様々なクライアント資格証明を使用したユーザー・アイデンティティ・トークンの取得

このカテゴリには3つのサンプルがあります。

HTTP Basicヘッダーでのサード・パーティSAMLユーザー・アサーション資格証明およびクライアントID+シークレットの使用
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>'
サード・パーティSAMLユーザー・アサーション資格証明および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=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>'

サード・パーティSAMLユーザー・アサーション資格証明および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=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>'


JWTユーザー・アサーション資格証明および様々なクライアント資格証明を使用したユーザー・アイデンティティ・トークンの取得

このカテゴリには3つのサンプルがあります。

HTTP Basicヘッダーでのサード・パーティJWTユーザー・アサーション資格証明およびクライアントID+シークレットの使用
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>'
サードパーティJWTユーザー・アサーション資格証明および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=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>'
サードパーティ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=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およびシークレットの使用

次の例は、HTTP BasicヘッダーにクライアントIDおよびシークレットを含むアクセス・トークンの検証リクエストです。アサーション値は通常の文字列ではなく、JSONであることに注意してください。

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.read
    &assertion={"<assertion>":"<assertion-value>"}'

レスポンス

{"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

この項では、次の例を示します。

HTTP BasicヘッダーでのクライアントIDおよびシークレットの使用

次のトークン・イントロスペクションの例は、アクセス・トークンの検証の項で示された最初のアクセス・トークン検証リクエストと同じですが、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.read
    &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リクエストのサンプルについて説明します。次の例を示します。

HTTP BasicヘッダーでのクライアントIDおよびシークレットの使用

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}

OAuthユーザー・プロファイル・サービスRESTインタフェース

この項では、次のユーザー・プロファイル・サービス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"
}

グループ・プロファイルの削除

このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.groups.writeというスコープが必要です。

curl -i 
--request DELETE "http://host:port/ms_oauth/resources/userprofile/groups/group1" 
-H 'Authorization:<OAUTH ACCESS TOKEN>'

レスポンス

ユーザー・プロファイルの削除

このリソース・サーバーURIは、OAuthアクセス・トークンによって保護されています。デフォルト構成を使用してこのアクションを完了するには、OAuthアクセス・トークンにuserProfile.users.writeというスコープが必要です。

curl -i 
--request DELETE 
-H 'Authorization:<OAUTH ACCESS TOKEN>' 
http://host:port/ms_oauth/resources/userprofile/users/John

レスポンス

レスポンスはありません。

OAuth承認管理RESTインタフェース

このインタフェースを使用してカスタム・ユーザー・インタフェースをレンダリングし、ユーザー承認プロセスを実行することで承認エクスペリエンスをカスタマイズします。このインタフェースでは、POST/consentmanagement/retrieve grantを使用してすべてのユーザーについてクライアントの承認ステータスとスコープが取得されます。このインタフェースを使用すると、クライアントで以前に付与したすべてのスコープをユーザーに表示することができます。

UserConsentサービスを有効にするには、Oracle Fusion Middleware Oracle Access Management管理者ガイドのOAuth承認管理サービスの構成に関する項を参照してください。必要に応じてScopesセクションで権限を構成します。

この項では、次の項目について説明します。

クライアント資格証明およびスコープを使用したアクセス・トークンの取得

次のサンプルでは、client_credentials付与タイプを使用してアクセス・トークンを取得する方法を示します。

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'

レスポンス

{
  "expires_in": 3600,
  "token_type": "Bearer",
  "access_token": "eyJhbGciOiJSyfecz3p...nYlReMjATbLs"
}

承認管理リソース・サーバーへのアクセス

この項には、3つのサンプル・リクエストが含まれています。次のレスポンスは、3つのリクエストすべてに特有です。

レスポンス

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Date: Fri, 16 Aug 2013 18:26:25 GMT
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: application/json
X-ORACLE-DMS-ECID: 316690b8df2db0a3:-794ed83e:140885d3651:-8000-0000000000000028
X-Powered-By: Servlet/2.5 JSP/2.1
X-OAUTH-REST-VERSION: v1

リクエスト

次のサンプルでは、リクエストのretrieveエンドポイントへの送信を示します。

curl -i 
-H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" 
--request POST http://host:port/ms_oauth/resources/consentmanagement/retrieve 
-d '
    scope=samplePhotoServer.photo.read
   &client_id=54321id
   &oracle_user_id=weblogic
   &lang=en
   '
-H 'Authorization: eyJhbGciOiJSUzUxM...eZJpL08yCI'

次のサンプルでは、リクエストをgrantエンドポイントに送信します。

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=samplePhotoServer.photo.read
    &client_id=54321id
    &oracle_user_id=weblogic
    &lang=en
   ' 
-H 'Authorization: eyJhbGciOiJSUzUxM...3OxH7jIRqGL-6w'

最後のサンプルでは、revokeエンドポイントへ送信されるリクエストを示します。

curl -i 
-H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" 
--request POST http://host:port/ms_oauth/resources/consentmanagement/revoke 
-d '
    scope=samplePhotoServer.photo.read
   &client_id=54321id
   &oracle_user_id=weblogic
   &lang=en
   ' 
-H 'Authorization: eyJhbGciOiJSUzUxM...3OxH7jIRqGL-6w'

ユーザーのUserProfileリソースにアクセスするためのクライアント権限の付与

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

ユーザーのUserProfileリソースのアクセス・トークンの取得

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"
}

アクセス・トークンを使用したユーザーのUserProfileリソースへのアクセス

次のサンプルでは、無認可のリクエストとレスポンスを示します。

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 ]"
}

OAuthモバイル・クライアント2-leggedフロー

この項では、2-leggedモバイル・クライアント・フロー用のRESTコールについて説明します。詳細は、Oracle Fusion Middleware Oracle Access Management管理者ガイドのモバイルOAuth認可の理解に関する項を参照してください。


注意:

すべての属性の名前および値では、大/小文字が区別されます。

この項では、次の項目について説明します。

アプリケーション・プロファイルの取得

curl -i 
--request GET 'http://host:port/ms_oauth/oauth2/endpoints
/oauthservice/appprofiles/MobileApp1?device_os=iPhone%20OS&os_ver=7.000000'

ジェイルブレーク検出ポリシーのないHTTPレスポンス

{
 "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レスポンス

{
 "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ユーザー・アサーションはサーバー側のデバイス・ストアに格納されます。

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'

レスポンス

{
 "expires_in":3600,
 "token_type":"Bearer",
 "access_token":"eyJhbcOiJSzUxMIsInR5cCI6IkpX...OQN5mrZrl5pGyEJOMm4BSLQVVZhLsS5g"
}

ログアウト

このリクエストは、サーバー側デバイス・キー・チェーンから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 UTおよびOAM MTの作成

このリクエストは、サーバー側デバイス・ストアで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ユーザー・トークンが有効な場合、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"
}

OAM資格証明権限付与タイプを使用したOAuth ATの作成

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"
}

OAuthモバイル・クライアント3-leggedフロー

この項では、3-leggedモバイル・クライアント・フロー用のRESTコールについて説明します。詳細は、Oracle Fusion Middleware Oracle Access Management管理者ガイドのOAuth 3-legged認可の理解に関する項およびモバイルOAuth認可の理解に関する項を参照してください。


注意:

すべての属性の名前および値では、大/小文字が区別されます。

この項では、次の項目について説明します。

アプリケーション・プロファイルの取得

curl -i 
--request GET 'http://host:port/ms_oauth/oauth2/
endpoints/oauthservice/appprofiles/MobileApp1?device_os=iPhone%20OS&os_ver=7.000000'

ジェイルブレーク検出ポリシーのないレスポンス

{
 "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"
}

ジェイルブレーク検出ポリシーのあるレスポンス

{
 "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"
}

モバイル・デバイス・クライアント検証コードの作成

この項では、デバイス登録のためのモバイル・クライアント検証コード(必要な場合)用の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"
}

OAMトークン交換と資格証明ベース(PINベースを含む)の認証

この項では、OAMトークンの交換に使用する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サーバー側で構成される認証リソース名を指定します。

JWTユーザー・トークンの取得方法

$ 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'

JWTアクセス・トークンの取得方法

$ 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'

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=passwordAbc123'

クライアント資格証明 + oracle_user_credentialsの組合せの使用

この項では、クライアント資格証明を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サーバー側で構成される認証リソース名を指定します。

JWTユーザー・トークンの取得方法

$ 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'

JWTアクセス・トークンの取得方法

$ 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'

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=<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ユーザー・トークン、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

JWTユーザー・トークンの取得方法

$ 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'

JWTアクセス・トークンの取得方法

$ 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'

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=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'

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=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の使用

この項では、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":""
}

OAMユーザー・トークンおよびマスター・トークンの取得方法

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アサーションの使用

この項では、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>'

JWTユーザー・トークンの取得方法

$ 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'

JWTアクセス・トークンの取得方法

$ 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'

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=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ユーザー・トークンおよびマスター・トークンまたは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'

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=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'

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=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'