Search in sources :

Example 1 with EcBaseTokenRequestBuilder

use of com.easy.cloud.core.oauth.client.base.request.builder.EcBaseTokenRequestBuilder in project dq-easy-cloud by dq-open-cloud.

the class EcBaseOauthToken method doGetOauthAccessToken.

/**
 * <p>
 * 执行获取授权accessToken
 * </p>
 * <pre>
 *     子类可以通过重写该方法实现自己的获取授权accessToken的数据
 * </pre>
 *
 * @param
 * @return java.util.Map<java.lang.String,java.lang.Object>
 * @author daiqi
 * @date 2018/7/18 11:54
 */
public Map<String, Object> doGetOauthAccessToken() throws Exception {
    // 获取token请求构建者
    EcBaseTokenRequestBuilder tokenRequestBuilder = getTokenRequestBuilder();
    // 构建客户端请求数据
    OAuthClientRequest accessTokenRequest = tokenRequestBuilder.buildClientRequest(getTokenRequestParam());
    // 返回accessToken响应对象
    EcBaseOauthTokenResponse response = oAuthClient.accessToken(accessTokenRequest, OAuth.HttpMethod.POST, tokenRequestBuilder.getTokenResponseClass());
    // 将accessToken放入map中
    return response.getParameters();
}
Also used : EcBaseOauthTokenResponse(com.easy.cloud.core.oauth.client.base.response.resource.EcBaseOauthTokenResponse) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest) EcBaseTokenRequestBuilder(com.easy.cloud.core.oauth.client.base.request.builder.EcBaseTokenRequestBuilder)

Aggregations

EcBaseTokenRequestBuilder (com.easy.cloud.core.oauth.client.base.request.builder.EcBaseTokenRequestBuilder)1 EcBaseOauthTokenResponse (com.easy.cloud.core.oauth.client.base.response.resource.EcBaseOauthTokenResponse)1 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)1