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


Java OAuthConfig.hasScope方法代码示例

本文整理汇总了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();
}
 
开发者ID:btpka3,项目名称:pac4j-oauth-tencent,代码行数:19,代码来源:TencentApi.java

示例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()));
	}
}
 
开发者ID:roikku,项目名称:swift-explorer,代码行数:17,代码来源:HubicApi.java

示例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() ) );
    }
}
 
开发者ID:iTwenty,项目名称:Hashtagger,代码行数:17,代码来源:Google2Api.java

示例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() ) );
    }
}
 
开发者ID:iTwenty,项目名称:Hashtagger,代码行数:18,代码来源:InstagramApi.java

示例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;
}
 
开发者ID:muquit,项目名称:gwtoauthlogindemo,代码行数:18,代码来源:Linkedin2Api.java

示例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()));
    }
}
 
开发者ID:elimu-ai,项目名称:webapp,代码行数:13,代码来源:Google2Api.java

示例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);
    }
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:9,代码来源:GithubApi.java

示例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();
}
 
开发者ID:hhua,项目名称:product-hunt-android,代码行数:13,代码来源:ProductHuntApi.java

示例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());
	}
}
 
开发者ID:plekhotkindmytro,项目名称:Linkedin-oAuth2.0,代码行数:12,代码来源:LinkedInApi20.java

示例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()));
  }
}
 
开发者ID:visun,项目名称:scribeoauth,代码行数:16,代码来源:ViadeoApi.java

示例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() );
        }
    };
}
 
开发者ID:iTwenty,项目名称:Hashtagger,代码行数:32,代码来源:InstagramApi.java

示例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);
    }
}
 
开发者ID:muquit,项目名称:gwtoauthlogindemo,代码行数:15,代码来源:Instagram2Api.java

示例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);
    }
}
 
开发者ID:muquit,项目名称:gwtoauthlogindemo,代码行数:16,代码来源:FacebookApiWithState.java

示例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()));
    }
}
 
开发者ID:jungyang,项目名称:oauth-client-master,代码行数:12,代码来源:XviaApi.java

示例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()));
    }
}
 
开发者ID:Gadreel,项目名称:divconq,代码行数:15,代码来源:Google2Api.java


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