• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OAuthEncoder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.github.scribejava.core.utils.OAuthEncoder的典型用法代码示例。如果您正苦于以下问题:Java OAuthEncoder类的具体用法?Java OAuthEncoder怎么用?Java OAuthEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OAuthEncoder类属于com.github.scribejava.core.utils包,在下文中一共展示了OAuthEncoder类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
    Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback");
    final StringBuilder sb = new StringBuilder(String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getScope())));


    if (!config.getCallback().isEmpty()) {
        sb.append('&').append(OAuthConstants.REDIRECT_URI).append('=').append(OAuthEncoder.encode(config.getCallback()));
    }

    if (!config.getState().isEmpty()) {
        sb.append('&').append(OAuthConstants.STATE).append('=').append(OAuthEncoder.encode(config.getState()));
    }

    if (!team.isEmpty()) {
        sb.append('&').append("team").append('=').append(OAuthEncoder.encode(team));
    }
    return sb.toString();
}
 
开发者ID:sjsucohort6,项目名称:amigo-chatbot,代码行数:20,代码来源:SlackApi.java


示例2: getOAuthCredentials

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
protected OAuthCredentials getOAuthCredentials(final WebContext context) throws HttpAction {
    final String tokenParameter = context.getRequestParameter(OAUTH_TOKEN);
    final String verifierParameter = context.getRequestParameter(OAUTH_VERIFIER);
    if (tokenParameter != null && verifierParameter != null) {
        // get request token from session
        final OAuth1RequestToken tokenSession = (OAuth1RequestToken) context.getSessionAttribute(getRequestTokenSessionAttributeName());
        logger.debug("tokenRequest: {}", tokenSession);
        final String token = OAuthEncoder.decode(tokenParameter);
        final String verifier = OAuthEncoder.decode(verifierParameter);
        logger.debug("token: {} / verifier: {}", token, verifier);
        return new OAuth10Credentials(tokenSession, token, verifier, getName());
    } else {
        final String message = "No credential found";
        throw new OAuthCredentialsException(message);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:18,代码来源:BaseOAuth10Client.java


示例3: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(final OAuthConfig config) {
    if (implicitFlow) {
        return String.format(this.casServerUrl + "/authorize?" + "response_type=token&client_id=%s&redirect_uri=%s",
                config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
    } else {
        return String.format(this.casServerUrl + "/authorize?" + "response_type=code&client_id=%s&redirect_uri=%s",
                config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:11,代码来源:CasOAuthWrapperApi20.java


示例4: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
    Preconditions.checkValidUrl(config.getCallback(),
                                "Must provide a valid url as callback. Live 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:yaochi,项目名称:pac4j-plus,代码行数:14,代码来源:WindowsLiveApi20.java


示例5: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(final OAuthConfig config) {
    Preconditions.checkValidUrl(config.getCallback(),
                                "Must provide a valid url as callback. WordPress does not support OOB");
    
    return String.format(AUTHORIZE_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:8,代码来源:WordPressApi20.java


示例6: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(final OAuthConfig config) {
    Preconditions.checkValidUrl(config.getCallback(),
                                "Must provide a valid url as callback. PayPal does not support OOB");
    final String nonce = System.currentTimeMillis() + CommonHelper.randomString(10);
    return String.format(AUTHORIZATION_URL, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),
                         OAuthEncoder.encode(config.getScope()), nonce);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:PayPalApi20.java


示例7: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(final OAuthConfig config) {
    String url = String.format(AUTHORIZATION_URL, authUrl, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),
                               OAuthEncoder.encode(config.getScope()));
    if (config.getState() != null) {
        url += "&state=" + OAuthEncoder.encode(config.getState());
    }
    return url;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:GenericApi20.java


示例8: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig oAuthConfig) {
    // #show_login skips showing the registration form, which is only
    // cluttersome.
    return String.format(AUTH_URL + "?client_id=%s&scope=%s&response_type=%s&redirect_uri=%s#show_login",
        oAuthConfig.getApiKey(), OAuthEncoder.encode(oAuthConfig.getScope()), "code", OAuthEncoder.encode(oAuthConfig.getCallback()));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:8,代码来源:OrcidApi20.java


示例9: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(final OAuthConfig config) {
    Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid callback url.");

    // Append scope if present
    if (config.hasScope()) {
        return String.format(SCOPED_AUTHORIZE_URL, this.approvalPrompt, config.getApiKey(), OAuthEncoder.encode(config.getCallback()),
                OAuthEncoder.encode(config.getScope()));
    } else {
        return String.format(AUTHORIZE_URL, this.approvalPrompt, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:StravaApi20.java


示例10: getOAuthCredentials

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
protected OAuthCredentials getOAuthCredentials(final WebContext context) throws HttpAction {
    final String codeParameter = context.getRequestParameter(OAUTH_CODE);
    if (codeParameter != null) {
        final String code = OAuthEncoder.decode(codeParameter);
        logger.debug("code: {}", code);
        return new OAuth20Credentials(code, getName());
    } else {
        final String message = "No credential found";
        throw new OAuthCredentialsException(message);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:13,代码来源:BaseOAuth20Client.java


示例11: extractParameter

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
public static String extractParameter(String response, String regex) throws OAuthException {
    final Matcher matcher = Pattern.compile(regex).matcher(response);
    if (matcher.find()) {
        return OAuthEncoder.decode(matcher.group(1));
    } else {
        return null;
    }
}
 
开发者ID:perrywang,项目名称:OAuthGateway,代码行数:9,代码来源:RegexUtil.java


示例12: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig config) {
    Preconditions.checkValidUrl(config.getCallback(), "Must provide a valid url as callback. GitLab does not support OOB");
    String authUrl = String.format("%s/oauth/authorize?client_id=%s&redirect_uri=%s&response_type=code", this.url, config.getApiKey(), OAuthEncoder.encode(config.getCallback()));
    if (config.hasScope()) {
        authUrl += "&scope=" + OAuthEncoder.encode(config.getScope());
    }
    return authUrl;
}
 
开发者ID:gabrie-allaigre,项目名称:sonar-auth-gitlab-plugin,代码行数:10,代码来源:GitLabOAuthApi.java


示例13: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig oAuthConfig) {
    return String.format(AUTH_URL + "?client_id=%s&response_type=code&redirect_uri=%s", oAuthConfig.getApiKey(), OAuthEncoder.encode(oAuthConfig.getCallback()));
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:5,代码来源:DropboxApi20.java


示例14: getOAuthServiceProvider

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
protected OAuth20Service getOAuthServiceProvider(String state) {
    OAuth20Service service = new ServiceBuilder().apiKey(weixinConfig.getApiKey())
            .apiSecret(weixinConfig.getApiSecret()).callback(OAuthEncoder.encode(weixinConfig.getCallback()))
            .scope(weixinConfig.getScope()).state(state).build(WeixinApi.instance());
    return service;
}
 
开发者ID:perrywang,项目名称:OAuthGateway,代码行数:7,代码来源:WeixinService.java


示例15: getAuthorizationUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
@Override
public String getAuthorizationUrl(OAuthConfig oAuthConfig) {
    return String.format(STRAVA_AUTH_URL, oAuthConfig.getApiKey(), OAuthEncoder.encode(oAuthConfig.getCallback()));
}
 
开发者ID:tiberiu-biking,项目名称:scribejava-strava,代码行数:5,代码来源:StravaOAuth2Api.java


示例16: formatAuthUrl

import com.github.scribejava.core.utils.OAuthEncoder; //导入依赖的package包/类
/**
   * Formats auth url based on url template and config
   * @param authUrl
   * @param oAuthConfig
   * @return formatted auth url
   */
  protected String formatAuthUrl(String authUrl, OAuthConfig oAuthConfig) {
LOG.debug("Auth URL: {}; clientID: {}; scope: {}; responsetype:{}", authUrl, oAuthConfig.getApiKey(), OAuthEncoder.encode(oAuthConfig.getScope()), RESPONSE_TYPE_CODE);
  	return String.format(authUrl, oAuthConfig.getApiKey(), OAuthEncoder.encode(oAuthConfig.getScope()), 
      		RESPONSE_TYPE_CODE, OAuthEncoder.encode(oAuthConfig.getCallback()));
  }
 
开发者ID:rmap-project,项目名称:rmap,代码行数:12,代码来源:OrcidApi20.java



注:本文中的com.github.scribejava.core.utils.OAuthEncoder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ChartCanvas类代码示例发布时间:2022-05-23
下一篇:
Java AssertionData类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap