本文整理汇总了Java中com.github.scribejava.core.model.OAuth2AccessToken.getScope方法的典型用法代码示例。如果您正苦于以下问题:Java OAuth2AccessToken.getScope方法的具体用法?Java OAuth2AccessToken.getScope怎么用?Java OAuth2AccessToken.getScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.scribejava.core.model.OAuth2AccessToken
的用法示例。
在下文中一共展示了OAuth2AccessToken.getScope方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extract
import com.github.scribejava.core.model.OAuth2AccessToken; //导入方法依赖的package包/类
@Override
public OAuth2AccessToken extract(String response) {
String errorCode = RegexUtil.extractParameter(response, ERRORCODE_REGEX);
if (errorCode != null) {
String errorDesc = RegexUtil.extractParameter(response, ERRORDESC_REGEX);
if (errorDesc != null) {
errorDesc = errorDesc.replace("+", " ");
}
return new GatewayAccessToken(errorCode, errorDesc, response);
}
OAuth2AccessToken accessToken = super.extract(response);
return new GatewayAccessToken(accessToken.getAccessToken(), accessToken.getTokenType()
, null, null, accessToken.getScope(), response);
}
示例2: extract
import com.github.scribejava.core.model.OAuth2AccessToken; //导入方法依赖的package包/类
@Override
public OAuth2AccessToken extract(String response) {
String errorCode = RegexUtil.extractParameter(response, ERRORCODE_REGEX);
if (errorCode != null) {
String errorDesc = RegexUtil.extractParameter(response, ERRORDESC_REGEX);
if (errorDesc != null) {
errorDesc = errorDesc.replace("+", " ");
}
return new GatewayAccessToken(errorCode, errorDesc, response);
}
OAuth2AccessToken accessToken = super.extract(response);
return new GatewayAccessToken(accessToken.getAccessToken(), accessToken.getTokenType()
, accessToken.getExpiresIn(), null, accessToken.getScope(), response);
}
示例3: extract
import com.github.scribejava.core.model.OAuth2AccessToken; //导入方法依赖的package包/类
@Override
public OAuth2AccessToken extract(String response) {
String errorCode = extractParameter(response, ERRORCODE_REGEX, false);
if(errorCode != null){
String errorDesc = extractParameter(response, ERRORDESC_REGEX, false);
return new GatewayAccessToken(errorCode, errorDesc, response);
}
OAuth2AccessToken baseToken = super.extract(response);
final String userId = extractParameter(response, USERID_REGEX, true);
return new GatewayAccessToken(baseToken.getAccessToken(), baseToken.getTokenType(), baseToken.getExpiresIn(),
baseToken.getRefreshToken(), baseToken.getScope(), response, userId);
}
示例4: accessTokenResponse
import com.github.scribejava.core.model.OAuth2AccessToken; //导入方法依赖的package包/类
private WritableMap accessTokenResponse(
final String providerName,
final HashMap<String,Object> cfg,
final OAuth2AccessToken accessToken,
final String oauthVersion
) {
WritableMap resp = Arguments.createMap();
WritableMap response = Arguments.createMap();
Map accessTokenMap = new Gson().fromJson(accessToken.getRawResponse(), Map.class);
resp.putString("status", "ok");
resp.putBoolean("authorized", true);
resp.putString("provider", providerName);
try {
String uuid = (String) accessTokenMap.get("user_id");
response.putString("uuid", uuid);
} catch (Exception ex) {
Log.e(TAG, "Exception while getting the access token");
ex.printStackTrace();
}
WritableMap credentials = Arguments.createMap();
Log.d(TAG, "Credential raw response: " + accessToken.getRawResponse());
credentials.putString("accessToken", accessToken.getAccessToken());
String authHeader;
String tokenType = (String) accessTokenMap.get("token_type");
if (tokenType == null) {
tokenType = "Bearer";
}
String scope = accessToken.getScope();
if (scope == null) {
scope = (String) cfg.get("scopes");
}
String clientID = (String) cfg.get("client_id");
String idToken = (String) accessTokenMap.get("id_token");
authHeader = tokenType + " " + accessToken.getAccessToken();
credentials.putString("authorizationHeader", authHeader);
credentials.putString("type", tokenType);
credentials.putString("scopes", scope);
credentials.putString("clientID", clientID);
credentials.putString("idToken", idToken);
response.putMap("credentials", credentials);
resp.putMap("response", response);
return resp;
}