ユーザーガイド > Webベースのデータソースの構成 > WSDL、SOAP、およびRESTにOAuthカスタマイズフローを使用する部分的な例
 
WSDL、SOAP、およびRESTにOAuthカスタマイズフローを使用する部分的な例
CustomFlowインターフェイスは、カスタマイズされたオプションまたはプロセスをサポート可能にすることで、アクセストークンやその他のパラメーターを取得できるようになります。
OAuthProfileCallbackでは、すべての必須フィールドがUIで提供されます。リクエストごとに以下を実行します。
メソッド情報、リクエストURL、リクエスト本文、ヘッダーを使用してOAuthProfileCallback.Requestを作成します。
OAuthProfileCallback.Responseを処理して結果を取得します。
サービス側とやり取りするときに、handleAuthResponseを数回呼び出すことが必要になる場合があります。これはブラウザーのシミュレーションであるため、OAuthProfileCallback.Responseから必要な情報を抽出する作業はユーザーが行う必要があります。
package com.compositesw.extension.security.oauth;
import java.util.Map;
/**Custom flow used for Extension Grants of OAuth2.0: http://tools.ietf.org/html/rfc6749#section-4.5.
* Any OAuth 2.0 flow with customized request or response that does not conform to RFC 6749 can be
* customized.
* With CustomFlow, a flow step is ignored if the request is NULL, or if no request info is defined
* in OAuthProfileCallback.
*/
public interface CustomFlow {
    /**
    * Build authorization request. If request info is NULL, the authorization step is ignored. */
public void buildAuthRequest(OAuthProfileCallback callback) throws Exception;
    /**
    * Handle authorization response. */
public void handleAuthResponse(OAuthProfileCallback callback) throws Exception;
    /**
    * Build access token request. If request info is NULL, the authorization step is ignored.
* The flow fails if both authorization request and access token request info are NULL.
*/
public void buildAccessTokenRequest(OAuthProfileCallback callback) throws Exception;
    /**
     * Handle access token response. */
public void handleAccessTokenResponse(OAuthProfileCallback callback) throws Exception;
    /**
     * Build refresh token request. If request info is NULL, the authorization step is ignored.
*/
public void buildRereshTokenRequest(OAuthProfileCallback callback) throws Exception;
    /**
     * Handle refresh token response. */
public void handleRefreshTokenResponse(OAuthProfileCallback callback) throws Exception;
    /**
     * All OAuth elements (access_token, refresh_token, expires_in, token_type, scope, etc.)
* extracted from response can be found in the value map returned by getOAuthElements(). */
public Map<String, Object> getOAuthElements();
    /**
     * Get access token. */
public String getAccessToken();
    /**
     * Get refresh token. */
public String getRefreshToken();
}