3.3.2. OAuth 要求の形式
OAuth クライアントライブラリーを使用して、全 OAuth パラメーターを構築します。全 OAuth API 要求には、以下の形式で、既存の Foreman ユーザーのログインを指定した FOREMAN-USER
ヘッダーと、Authorization
ヘッダーが必要です。
--header 'FOREMAN-USER: sat_username' \ --header 'Authorization: OAuth oauth_version="1.0",oauth_consumer_key="secretkey",oauth_signature_method="hmac-sha1",oauth_timestamp=1321473112,oauth_signature=Il8hR8/ogj/XVuOqMPB9qNjSy6E='
例
以下の例では、認証に OAuth を使用したアーキテクチャーが表示されます。この要求では、FOREMAN-USER
ヘッダーに sat_username ユーザー名を使用します。--foreman-oauth-map-users
を true
に設定すると、要求には、そのユーザーに対して表示権限が割り当てられたアーキテクチャーのみが含まれます。署名は、全パラメーター、HTTP メソッドおよび URI 変更を反映します。
要求例:
$ curl 'https://satellite.example.com/api/architectures' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'FOREMAN-USER: sat_username' \ --header 'Authorization: OAuth oauth_version="1.0",oauth_consumer_key="secretkey",oauth_signature_method="hmac-sha1",oauth_timestamp=1321473112,oauth_signature=Il8hR8/ogj/XVuOqMPB9qNjSy6E='