當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。