本文整理汇总了Java中org.scribe.model.OAuthConfig.hasScope方法的典型用法代码示例。如果您正苦于以下问题:Java OAuthConfig.hasScope方法的具体用法?Java OAuthConfig.hasScope怎么用?Java OAuthConfig.hasScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.scribe.model.OAuthConfig
的用法示例。
在下文中一共展示了OAuthConfig.hasScope方法的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 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()));
}
}
示例7: 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);
}
}
示例8: 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();
}
示例9: 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());
}
}
示例10: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入方法依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config)
{
Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback. Viadeo 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()));
}
else
{
return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
}
}
示例11: createService
import org.scribe.model.OAuthConfig; //导入方法依赖的package包/类
/**
* Not sure if it's a Scribe bug or an Instagram oddity. We have to send the
* various parameters in the POST body (Scribe sends them as query string)
* and we must include the 'grant_type'.
*/
@Override
public OAuthService createService( final OAuthConfig config )
{
return new OAuth20ServiceImpl( this, config )
{
@Override
public Token getAccessToken( Token requestToken, Verifier verifier )
{
OAuthRequest request = new OAuthRequest( getAccessTokenVerb(), getAccessTokenEndpoint() );
request.addBodyParameter( "grant_type", "authorization_code" );
request.addBodyParameter( OAuthConstants.CLIENT_ID, config.getApiKey() );
request.addBodyParameter( OAuthConstants.CLIENT_SECRET, config.getApiSecret() );
request.addBodyParameter( OAuthConstants.CODE, verifier.getValue() );
request.addBodyParameter( OAuthConstants.REDIRECT_URI, config.getCallback() );
if ( config.hasScope() )
{
request.addBodyParameter( OAuthConstants.SCOPE, config.getScope() );
}
Response response = request.send();
return getAccessTokenExtractor().extract( response.getBody() );
}
};
}
示例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 for Instagram");
String state = ServerUtils.makeRandomString();
if (config.hasScope())
{
return String.format(SCOPED_AUTHORIZATION_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),state,OAuthEncoder.encode(config.getScope()));
}
else
{
return String.format(AUTHORIZATION_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),state);
}
}
示例13: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入方法依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config)
{
Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback. Facebook does not support OOB");
String state=ServerUtils.makeRandomString();
// Append scope if present
if (config.hasScope())
{
return String.format(SCOPED_AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()), state, OAuthEncoder.encode(config.getScope()));
}
else
{
return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),state);
}
}
示例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.");
// 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()));
}
}
示例15: getAuthorizationUrl
import org.scribe.model.OAuthConfig; //导入方法依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
// + SUFFIX_OFFLINE TODO not used unless in offline mode
// Append scope if present
if (config.hasScope()) {
return String.format(SCOPED_AUTHORIZE_URL + SUFFIX_OFFLINE, config.getApiKey(),
OAuthEncoder.encode(config.getCallback()),
OAuthEncoder.encode(config.getScope()));
} else {
return String.format(AUTHORIZE_URL + SUFFIX_OFFLINE, config.getApiKey(),
OAuthEncoder.encode(config.getCallback()));
}
}