当前位置: 首页>>代码示例>>Java>>正文


Java OAuthClientResponse.getParam方法代码示例

本文整理汇总了Java中org.apache.oltu.oauth2.client.response.OAuthClientResponse.getParam方法的典型用法代码示例。如果您正苦于以下问题:Java OAuthClientResponse.getParam方法的具体用法?Java OAuthClientResponse.getParam怎么用?Java OAuthClientResponse.getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.oltu.oauth2.client.response.OAuthClientResponse的用法示例。


在下文中一共展示了OAuthClientResponse.getParam方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUserInfoEndpoint

import org.apache.oltu.oauth2.client.response.OAuthClientResponse; //导入方法依赖的package包/类
/**
 * Get the user info endpoint.
 *
 * @param token OAuth client response.
 * @return User info endpoint.
 */
@Override
protected String getUserInfoEndpoint(OAuthClientResponse token, Map<String, String> authenticatorProperties) {

    String userGUID = token.getParam(YahooOAuth2AuthenticatorConstants.USER_GUID);
    return getUserInfoURL() + userGUID + YahooOAuth2AuthenticatorConstants.YAHOO_USER_DETAILS_JSON;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:13,代码来源:YahooOAuth2Authenticator.java

示例2: getSubjectAttributes

import org.apache.oltu.oauth2.client.response.OAuthClientResponse; //导入方法依赖的package包/类
/**
 * Get subject attributes.
 * @param token OAuthClientResponse
 * @param authenticatorProperties Map<String, String> (Authenticator property, Property value)
 * @return Map<ClaimMapping, String> Claim mappings.
 */
protected Map<ClaimMapping, String> getSubjectAttributes(OAuthClientResponse token,
                                                         Map<String, String> authenticatorProperties) {

    Map<ClaimMapping, String> claims = new HashMap<>();

    try {
        String accessToken = token.getParam(OIDCAuthenticatorConstants.ACCESS_TOKEN);
        String url = getUserInfoEndpoint(token, authenticatorProperties);
        String json = sendRequest(url, accessToken);

        if (StringUtils.isBlank(json)) {
            if(log.isDebugEnabled()) {
                log.debug("Empty JSON response from user info endpoint. Unable to fetch user claims." +
                        " Proceeding without user claims");
            }
            return claims;
        }

        Map<String, Object> jsonObject = JSONUtils.parseJSON(json);

        for (Map.Entry<String, Object> data : jsonObject.entrySet()) {
            String key = data.getKey();
            Object value = data.getValue();

            if (value != null) {
                claims.put(ClaimMapping.build(key, key, null, false), value.toString());
            }

            if (log.isDebugEnabled() &&
                    IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.USER_CLAIMS)) {
                log.debug("Adding claims from end-point data mapping : " + key + " - " +
                        jsonObject.get(key).toString());
            }
        }
    } catch (IOException e) {
        log.error("Communication error occurred while accessing user info endpoint", e);
    }

    return claims;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:47,代码来源:OpenIDConnectAuthenticator.java

示例3: getSubjectAttributes

import org.apache.oltu.oauth2.client.response.OAuthClientResponse; //导入方法依赖的package包/类
/**
 * Get subject attributes.
 *
 * @param token                   OAuthClientResponse
 * @param authenticatorProperties Map<String, String>
 * @return Map<ClaimMapping, String> Claim mappings.
 */
protected Map<ClaimMapping, String> getSubjectAttributes(OAuthClientResponse token,
                                                         Map<String, String> authenticatorProperties) {

    Map<ClaimMapping, String> claims = new HashMap<>();

    try {
        String accessToken = token.getParam(OIDCAuthenticatorConstants.ACCESS_TOKEN);
        String url = getUserInfoEndpoint(token, authenticatorProperties);
        String json = sendRequest(url, accessToken);

        if (StringUtils.isBlank(json)) {
            if (log.isDebugEnabled()) {
                log.debug("Unable to fetch user claims. Proceeding without user claims");
            }
            return claims;
        }

        Map<String, Object> jsonObject = JSONUtils.parseJSON(json);
        Map<String, Object> profile = null;

        if (!jsonObject.isEmpty()) {

            // Extract the inner profile JSON object.
            profile = JSONUtils.parseJSON(jsonObject.entrySet().iterator().next().getValue().toString());
        }

        if (profile == null) {
            if (log.isDebugEnabled()) {
                log.debug("Invalid user profile object. Proceeding without user claims");
            }
            return claims;
        }

        for (Map.Entry<String, Object> data : profile.entrySet()) {
            String key = data.getKey();
            claims.put(ClaimMapping.build(key, key, null, false), profile.get(key).toString());

            if (log.isDebugEnabled()
                    && IdentityUtil.isTokenLoggable(IdentityConstants.IdentityTokens.USER_CLAIMS)) {
                log.debug("Adding claims from end-point data mapping : " + key + " - " +
                        profile.get(key).toString());
            }
        }
    } catch (IOException e) {
        log.error("Communication error occurred while accessing user info endpoint", e);
    }
    return claims;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:56,代码来源:YahooOAuth2Authenticator.java

示例4: getAuthenticateUser

import org.apache.oltu.oauth2.client.response.OAuthClientResponse; //导入方法依赖的package包/类
/**
 * @param token
 * @return
 */
@Override
protected String getAuthenticateUser(AuthenticationContext context, Map<String, Object> jsonObject, OAuthClientResponse token) {
    return token.getParam(WindowsLiveOAuth2AuthenticatorConstants.USER_ID);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:9,代码来源:WindowsLiveOAuth2Authenticator.java

示例5: getAuthenticateUser

import org.apache.oltu.oauth2.client.response.OAuthClientResponse; //导入方法依赖的package包/类
/**
 * Get Authenticated User
 *
 * @param token OAuth client response.
 * @return GUID of the authenticated user.
 */
@Override
protected String getAuthenticateUser(AuthenticationContext context, Map<String, Object> jsonObject, OAuthClientResponse token) {

    return token.getParam(YahooOAuth2AuthenticatorConstants.USER_GUID);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:12,代码来源:YahooOAuth2Authenticator.java


注:本文中的org.apache.oltu.oauth2.client.response.OAuthClientResponse.getParam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。