本文整理了Java中org.scribe.extractors.AccessTokenExtractor
类的一些代码示例,展示了AccessTokenExtractor
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AccessTokenExtractor
类的具体详情如下:
包路径:org.scribe.extractors.AccessTokenExtractor
类名称:AccessTokenExtractor
[英]Simple command object that extracts a Token from a String
[中]从字符串中提取标记的简单命令对象
代码示例来源:origin: jenkinsci/bitbucket-build-status-notifier-plugin
@Override
public Token getAccessToken(Token requestToken, Verifier verifier) {
OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
request.addHeader(OAuthConstants.HEADER, this.getHttpBasicAuthHeaderValue());
request.addBodyParameter(GRANT_TYPE_KEY, GRANT_TYPE_CLIENT_CREDENTIALS);
Response respOnse= request.send();
return api.getAccessTokenExtractor().extract(response.getBody());
}
代码示例来源:origin: com.atlassian.jira.plugins/bitbucket-client
/**
* {@inheritDoc}
*/
public Token getAccessToken(Token requestToken, Verifier verifier) {
config.log("obtaining access token from " + api.getAccessTokenEndpoint());
HttpClientOauthRequest request = new HttpClientOauthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint(), httpClientProvider);
request.addOAuthParameter(OAuthConstants.TOKEN, requestToken.getToken());
request.addOAuthParameter(OAuthConstants.VERIFIER, verifier.getValue());
config.log("setting token to: " + requestToken + " and verifier to: " + verifier);
addOAuthParams(request, requestToken);
appendSignature(request);
HttpClientOauthResponse respOnse= request.sendViaHttpClient();
return api.getAccessTokenExtractor().extract(response.getContent());
}
代码示例来源:origin: com.atlassian.jira.plugins/bitbucket-client
/**
* {@inheritDoc}
*/
@Override
public Token getAccessToken(Token requestToken, Verifier verifier) {
config.log("obtaining access token from " + api.getAccessTokenEndpoint());
OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
request.addOAuthParameter(OAuthConstants.TOKEN, requestToken.getToken());
request.addOAuthParameter(OAuthConstants.VERIFIER, verifier.getValue());
config.log("setting token to: " + requestToken + " and verifier to: " + verifier);
addOAuthParams(request, requestToken);
appendSignature(request);
Response respOnse= request.send();
return api.getAccessTokenExtractor().extract(response.getBody());
}
代码示例来源:origin: hburgmeier/jerseyoauth2
@Override
public Token refreshToken(OAuth2Token token) {
OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
request.addQuerystringParameter(OAuthConstants.CLIENT_ID, config.getApiKey());
request.addQuerystringParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
request.addQuerystringParameter(OAuthConstants.REDIRECT_URI, config.getCallback());
request.addQuerystringParameter("refresh_token", token.getRefreshToken());
if(config.hasScope())
request.addQuerystringParameter(OAuthConstants.SCOPE, config.getScope());
Response respOnse= request.send();
return api.getAccessTokenExtractor().extract(response.getBody());
}
代码示例来源:origin: org.scribe/scribe-up
@Override
public Token getAccessToken(final Token requestToken, final Verifier verifier) {
this.config.log("obtaining access token from " + this.api.getAccessTokenEndpoint());
final ProxyOAuthRequest request = new ProxyOAuthRequest(this.api.getAccessTokenVerb(),
this.api.getAccessTokenEndpoint(), this.proxyHost,
this.proxyPort);
request.addOAuthParameter(OAuthConstants.TOKEN, requestToken.getToken());
request.addOAuthParameter(OAuthConstants.VERIFIER, verifier.getValue());
this.config.log("setting token to: " + requestToken + " and verifier to: " + verifier);
addOAuthParams(request, requestToken);
appendSignature(request);
final Response respOnse= request.send();
return this.api.getAccessTokenExtractor().extract(response.getBody());
}
代码示例来源:origin: org.scribe/scribe
/**
* {@inheritDoc}
*/
public Token getAccessToken(Token requestToken, Verifier verifier)
{
OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
request.addQuerystringParameter(OAuthConstants.CLIENT_ID, config.getApiKey());
request.addQuerystringParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
request.addQuerystringParameter(OAuthConstants.CODE, verifier.getValue());
request.addQuerystringParameter(OAuthConstants.REDIRECT_URI, config.getCallback());
if(config.hasScope()) request.addQuerystringParameter(OAuthConstants.SCOPE, config.getScope());
Response respOnse= request.send();
return api.getAccessTokenExtractor().extract(response.getBody());
}
代码示例来源:origin: de.esoco/esoco-oauth
/***************************************
* {@inheritDoc}
*/
@Override
public Token getAccessToken(Token rRequestToken, Verifier rVerifier)
{
OAuthRequest rRequest =
new OAuthRequest(rApi.getAccessTokenVerb(),
rApi.getAccessTokenEndpoint());
rRequest.addBodyParameter(OAuthConstants.CLIENT_ID,
rConfig.getApiKey());
rRequest.addBodyParameter(OAuthConstants.CLIENT_SECRET,
rConfig.getApiSecret());
rRequest.addBodyParameter(OAuthConstants.CODE,
rVerifier.getValue());
rRequest.addBodyParameter(OAuthConstants.REDIRECT_URI,
rConfig.getCallback());
rRequest.addBodyParameter(GRANT_TYPE,
GRANT_TYPE_AUTHORIZATION_CODE);
String sRespOnse= rRequest.send().getBody();
return rApi.getAccessTokenExtractor().extract(sResponse);
}
}
代码示例来源:origin: org.scribe/scribe-up
@Override
public Token getAccessToken(final Token requestToken, final Verifier verifier) {
final OAuthRequest request = new ProxyOAuthRequest(this.api.getAccessTokenVerb(),
this.api.getAccessTokenEndpoint(), this.proxyHost,
this.proxyPort);
request.addQuerystringParameter(OAuthConstants.CLIENT_ID, this.config.getApiKey());
request.addQuerystringParameter(OAuthConstants.CLIENT_SECRET, this.config.getApiSecret());
request.addQuerystringParameter(OAuthConstants.CODE, verifier.getValue());
request.addQuerystringParameter(OAuthConstants.REDIRECT_URI, this.config.getCallback());
if (this.config.hasScope())
request.addQuerystringParameter(OAuthConstants.SCOPE, this.config.getScope());
final Response respOnse= request.send();
return this.api.getAccessTokenExtractor().extract(response.getBody());
}
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
/**
* {@inheritDoc}
*
* LinkedIn request the additional 'grant_type' parameter be set.
*/
public Token getAccessToken(Token requestToken, Verifier verifier) {
OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
request.addQuerystringParameter(OAuthConstants.CLIENT_ID, config.getApiKey());
request.addQuerystringParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
request.addQuerystringParameter(OAuthConstants.CODE, verifier.getValue());
request.addQuerystringParameter(OAuthConstants.REDIRECT_URI, config.getCallback());
request.addQuerystringParameter("grant_type", "authorization_code");
if (config.hasScope()) {
request.addQuerystringParameter(OAuthConstants.SCOPE, config.getScope());
}
Response respOnse= request.send();
return api.getAccessTokenExtractor().extract(response.getBody());
}
代码示例来源:origin: org.scribe/scribe
public Token getAccessToken(Token requestToken, Verifier verifier, RequestTuner tuner)
{
config.log("obtaining access token from " + api.getAccessTokenEndpoint());
OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
request.addOAuthParameter(OAuthConstants.TOKEN, requestToken.getToken());
request.addOAuthParameter(OAuthConstants.VERIFIER, verifier.getValue());
config.log("setting token to: " + requestToken + " and verifier to: " + verifier);
addOAuthParams(request, requestToken);
appendSignature(request);
config.log("sending request...");
Response respOnse= request.send(tuner);
String body = response.getBody();
config.log("response status code: " + response.getCode());
config.log("response body: " + body);
return api.getAccessTokenExtractor().extract(body);
}
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
/**
* {@inheritDoc}
*
* LinkedIn request the additional 'grant_type' parameter be set.
*/
public Token getAccessToken(Token requestToken, Verifier verifier) {
OAuthRequest request = new OAuthRequest(api.getAccessTokenVerb(), api.getAccessTokenEndpoint());
request.addQuerystringParameter(OAuthConstants.CLIENT_ID, config.getApiKey());
request.addQuerystringParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
request.addQuerystringParameter(OAuthConstants.CODE, verifier.getValue());
request.addQuerystringParameter(OAuthConstants.REDIRECT_URI, config.getCallback());
request.addQuerystringParameter("grant_type", "authorization_code");
if (config.hasScope()) {
request.addQuerystringParameter(OAuthConstants.SCOPE, config.getScope());
}
Response respOnse= request.send();
return api.getAccessTokenExtractor().extract(response.getBody());
}
代码示例来源:origin: org.scribe/scribe-up
@Override
public Token getAccessToken(final Token requestToken, final Verifier verifier) {
final OAuthRequest request = new ProxyOAuthRequest(this.api.getAccessTokenVerb(),
this.api.getAccessTokenEndpoint(), this.proxyHost,
this.proxyPort);
// PATCH : body parameters instead of request parameters
request.addBodyParameter(OAuthConstants.CLIENT_ID, this.config.getApiKey());
request.addBodyParameter(OAuthConstants.CLIENT_SECRET, this.config.getApiSecret());
request.addBodyParameter(OAuthConstants.CODE, verifier.getValue());
request.addBodyParameter(OAuthConstants.REDIRECT_URI, this.config.getCallback());
if (this.config.hasScope())
request.addBodyParameter(OAuthConstants.SCOPE, this.config.getScope());
// PATCH : + grant_type parameter
request.addBodyParameter("grant_type", "authorization_code");
final Response respOnse= request.send();
return this.api.getAccessTokenExtractor().extract(response.getBody());
}
}
代码示例来源:origin: hoverruan/weiboclient4j
return api.getAccessTokenExtractor().extract(responseBody);
代码示例来源:origin: zrk1000/oauthclient
return this.api.getAccessTokenExtractor().extract(response.getBody());