Search in sources :

Example 1 with EcBaseResourceRequestBuilder

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

the class EcBaseOauthToken method doGetOauthResource.

/**
 * <p>
 * 执行获取授权资源信息
 * </p>
 * <pre>
 *     子类可以通过重写该方法实现自己的获取授权资源数据传输对象的数据
 * </pre>
 *
 * @param oAuthResponseParam
 * @return com.easy.cloud.core.oauth.client.base.pojo.dto.EcBaseOauthResourceDTO
 * @author daiqi
 * @date 2018/7/18 11:54
 */
public EcBaseOauthResourceDTO doGetOauthResource(Map<String, Object> oAuthResponseParam) throws Exception {
    // 获取资源请求构建者
    EcBaseResourceRequestBuilder resourceRequestBuilder = getResourceRequestBuilder();
    // 构建客户端请求参数
    OAuthClientRequest resourceRequest = resourceRequestBuilder.buildClientRequest(oAuthResponseParam);
    // 执行请求资源
    EcBaseOauthResourceResponse resourceResponse = oAuthClient.resource(resourceRequest, OAuth.HttpMethod.GET, resourceRequestBuilder.getResourceResponseClass());
    // 从资源响应对象中获取资源数据传输对象
    EcBaseOauthResourceDTO resourceDTO = resourceResponse.getResourceObj(resourceResponse.getResourceDTOClass());
    EcLogUtils.info("授权获取到的用户信息", resourceDTO, logger);
    return resourceDTO;
}
Also used : EcBaseOauthResourceResponse(com.easy.cloud.core.oauth.client.base.response.token.EcBaseOauthResourceResponse) EcBaseResourceRequestBuilder(com.easy.cloud.core.oauth.client.base.request.builder.EcBaseResourceRequestBuilder) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest) EcBaseOauthResourceDTO(com.easy.cloud.core.oauth.client.base.pojo.dto.EcBaseOauthResourceDTO)

Aggregations

EcBaseOauthResourceDTO (com.easy.cloud.core.oauth.client.base.pojo.dto.EcBaseOauthResourceDTO)1 EcBaseResourceRequestBuilder (com.easy.cloud.core.oauth.client.base.request.builder.EcBaseResourceRequestBuilder)1 EcBaseOauthResourceResponse (com.easy.cloud.core.oauth.client.base.response.token.EcBaseOauthResourceResponse)1 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)1