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


Java ProtectedResourceDetails.isUse10a方法代码示例

本文整理汇总了Java中org.springframework.security.oauth.consumer.ProtectedResourceDetails.isUse10a方法的典型用法代码示例。如果您正苦于以下问题:Java ProtectedResourceDetails.isUse10a方法的具体用法?Java ProtectedResourceDetails.isUse10a怎么用?Java ProtectedResourceDetails.isUse10a使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.security.oauth.consumer.ProtectedResourceDetails的用法示例。


在下文中一共展示了ProtectedResourceDetails.isUse10a方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUnauthorizedRequestToken

import org.springframework.security.oauth.consumer.ProtectedResourceDetails; //导入方法依赖的package包/类
public OAuthConsumerToken getUnauthorizedRequestToken(ProtectedResourceDetails details, String callback) throws OAuthRequestFailedException {  
  URL requestTokenURL;
  try {
    requestTokenURL = new URL(details.getRequestTokenURL());
  }
  catch (MalformedURLException e) {
    throw new IllegalStateException("Malformed URL for obtaining a request token.", e);
  }

  String httpMethod = details.getRequestTokenHttpMethod();

  Map<String, String> additionalParameters = new TreeMap<String, String>();
  if (details.isUse10a()) {
    additionalParameters.put(OAuthConsumerParameter.oauth_callback.toString(), callback);
  }
  Map<String, String> specifiedParams = details.getAdditionalParameters();
  if (specifiedParams != null) {
    additionalParameters.putAll(specifiedParams);
  }
  return getTokenFromProvider(details, requestTokenURL, httpMethod, null, additionalParameters);
}
 
开发者ID:jungyang,项目名称:oauth-client-master,代码行数:22,代码来源:CoreOAuthConsumerSupport.java

示例2: getAccessToken

import org.springframework.security.oauth.consumer.ProtectedResourceDetails; //导入方法依赖的package包/类
public OAuthConsumerToken getAccessToken(ProtectedResourceDetails details, OAuthConsumerToken requestToken, String verifier) {
  URL accessTokenURL;
  try {
    accessTokenURL = new URL(details.getAccessTokenURL());
  }
  catch (MalformedURLException e) {
    throw new IllegalStateException("Malformed URL for obtaining an access token.", e);
  }

  String httpMethod = details.getAccessTokenHttpMethod();

  Map<String, String> additionalParameters = new TreeMap<String, String>();
  if (details.isUse10a()) {
    if (verifier == null) {
      throw new UnverifiedRequestTokenException("Unverified request token: " + requestToken);
    }
    additionalParameters.put(OAuthConsumerParameter.oauth_verifier.toString(), verifier);
  }
  Map<String, String> specifiedParams = details.getAdditionalParameters();
  if (specifiedParams != null) {
    additionalParameters.putAll(specifiedParams);
  }
  return getTokenFromProvider(details, accessTokenURL, httpMethod, requestToken, additionalParameters);
}
 
开发者ID:jungyang,项目名称:oauth-client-master,代码行数:25,代码来源:CoreOAuthConsumerSupport.java

示例3: getUserAuthorizationRedirectURL

import org.springframework.security.oauth.consumer.ProtectedResourceDetails; //导入方法依赖的package包/类
/**
 * Get the URL to which to redirect the user for authorization of protected resources.
 *
 * @param details	  The resource for which to get the authorization url.
 * @param requestToken The request token.
 * @param callbackURL  The callback URL.
 * @return The URL.
 */
protected String getUserAuthorizationRedirectURL(ProtectedResourceDetails details, OAuthConsumerToken requestToken, String callbackURL) {
	try {
		String baseURL = details.getUserAuthorizationURL();
		StringBuilder builder = new StringBuilder(baseURL);
		char appendChar = baseURL.indexOf('?') < 0 ? '?' : '&';
		builder.append(appendChar).append("oauth_token=");
		builder.append(URLEncoder.encode(requestToken.getValue(), "UTF-8"));
		if (!details.isUse10a()) {
			builder.append('&').append("oauth_callback=");
			builder.append(URLEncoder.encode(callbackURL, "UTF-8"));
		}
		return builder.toString();
	}
	catch (UnsupportedEncodingException e) {
		throw new IllegalStateException(e);
	}
}
 
开发者ID:jungyang,项目名称:oauth-client-master,代码行数:26,代码来源:OAuthConsumerContextFilter.java


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