本文整理汇总了Java中org.scribe.model.OAuthConfig类的典型用法代码示例。如果您正苦于以下问题:Java OAuthConfig类的具体用法?Java OAuthConfig怎么用?Java OAuthConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OAuthConfig类属于org.scribe.model包,在下文中一共展示了OAuthConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config, String state) {
// http://wiki.connect.qq.com/%E4%BD%BF%E7%94%A8authorization_code%E8%8E%B7%E5%8F%96access_token
final String authorizationEndpoint = "https://graph.qq.com/oauth2.0/authorize";
OAuthRequest request = new OAuthRequest(Verb.GET, authorizationEndpoint);
request.addQuerystringParameter("response_type", "code");
request.addQuerystringParameter(OAuthConstants.CLIENT_ID, config.getApiKey());
request.addQuerystringParameter(OAuthConstants.CLIENT_SECRET, config.getApiSecret());
request.addQuerystringParameter(OAuthConstants.REDIRECT_URI, config.getCallback());
request.addQuerystringParameter("state", state);
if (config.hasScope()) {
request.addQuerystringParameter(OAuthConstants.SCOPE, config.getScope());
}
return request.getCompleteUrl();
}
示例2: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config)
{
Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback.") ;
if (config.hasScope())
{
return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(),
OAuthEncoder.encode(config.getCallback()),
OAuthEncoder.encode(config.getScope()));
}
else
{
return String.format(AUTHORIZE_URL, config.getApiKey(),
OAuthEncoder.encode(config.getCallback()));
}
}
示例3: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl( OAuthConfig config )
{
// Append scope if present
if ( config.hasScope() )
{
return String.format( SCOPED_AUTHORIZE_URL, config.getApiKey(),
OAuthEncoder.encode( config.getCallback() ),
OAuthEncoder.encode( config.getScope() ) );
}
else
{
return String.format( AUTHORIZE_URL, config.getApiKey(),
OAuthEncoder.encode( config.getCallback() ) );
}
}
示例4: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl( OAuthConfig config )
{
if ( config.hasScope() )
{
return String.format( SCOPED_AUTHORIZATION_URL,
config.getApiKey(),
OAuthEncoder.encode( config.getCallback() ),
OAuthEncoder.encode( config.getScope() ) );
}
else
{
return String.format( AUTHORIZATION_URL,
config.getApiKey(),
OAuthEncoder.encode( config.getCallback() ) );
}
}
示例5: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config)
{
Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback for Instagram");
String uuid = ServerUtils.makeRandomString();
String aUrl = null;
if (config.hasScope())
{
aUrl = String.format(SCOPED_AUTHORIZATION_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),uuid,OAuthEncoder.encode(config.getScope()));
}
else
{
aUrl = String.format(AUTHORIZATION_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),uuid);
}
logger.info("Autorization URL: " + aUrl);
return aUrl;
}
示例6: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public final String getAuthorizationUrl(OAuthConfig config) {
ParameterList paramList = new ParameterList();
if (state!=null) {
paramList.add("state", state);
}
paramList.add("response_type", getResponseType());
paramList.add("client_id", config.getApiKey());
if (StringUtils.isNotEmpty(config.getCallback()) &&
!OAuthConstants.OUT_OF_BAND.equals(config.getCallback())) {
paramList.add("redirect_uri", config.getCallback()); // for implicit grant
}
if (StringUtils.isNotEmpty(config.getScope())) {
paramList.add("scope", config.getScope());
}
return paramList.appendTo(getAuthorizationUrlBase());
}
示例7: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
// Append scope if present
if (config.hasScope()) {
return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(),
OAuthEncoder.encode(config.getCallback()),
OAuthEncoder.encode(config.getScope()));
} else {
return String.format(AUTHORIZE_URL, config.getApiKey(),
OAuthEncoder.encode(config.getCallback()));
}
}
示例8: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
if (config.hasScope()) {
return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), githubState, OAuthEncoder.encode(config.getScope()));
} else {
return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), githubState);
}
}
示例9: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(final OAuthConfig config) {
Preconditions.checkValidUrl(config.getCallback(),
"Must provide a valid url as callback. Product Hunt does not support OOB");
final StringBuilder sb = new StringBuilder(String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(
config.getCallback())));
if (config.hasScope()) {
sb.append('&').append(OAuthConstants.SCOPE).append('=').append(OAuthEncoder.encode(config.getScope()));
}
return sb.toString();
}
示例10: createService
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public OAuthService createService(OAuthConfig config)
{
if (isTwoLegged)
{
return new TwoLoOAuth10aServiceImpl(this, config);
} else
{
return super.createService(config);
}
}
示例11: HttpClientThrreeLoOAuth10aServiceImpl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
/**
* Default constructor
*
* @param api OAuth1.0a api information
* @param config OAuth 1.0a configuration param object
*/
public HttpClientThrreeLoOAuth10aServiceImpl(DefaultApi10a api, OAuthConfig config, HttpClientProvider httpClientProvider)
{
this.api = api;
this.config = config;
this.httpClientProvider = httpClientProvider;
}
示例12: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback. LinkedIn does not support OOB");
// Append scope if present
if (config.hasScope()) {
return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), OAuthEncoder.encode(config.getScope()), generateState());
} else {
return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), generateState());
}
}
示例13: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
return String.format(
AUTHORIZE_URL,
rootUrl,
realm,
config.getApiKey(),
OAuthEncoder.encode(config.getCallback()),
config.getScope().replaceAll(" ", "+"));
}
示例14: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
Preconditions.checkValidUrl(
config.getCallback(), "Must provide a valid url as callback. Google does not support OOB");
Preconditions.checkEmptyString(
config.getScope(), "Must provide a valid value as scope. Google does not support no scope");
return String.format(
AUTHORIZE_URL, config.getApiKey(), encode(config.getCallback()), encode(config.getScope()));
}
示例15: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
return String.format(
AUTHORIZE_URL,
rootUrl,
config.getApiKey(),
OAuthEncoder.encode(config.getCallback()),
config.getScope().replaceAll(" ", "+"));
}