List of usage examples for org.springframework.security.oauth.consumer ProtectedResourceDetails getRequestTokenURL
String getRequestTokenURL();
From source file:org.springframework.security.oauth.consumer.client.CoreOAuthConsumerSupport.java
public OAuthConsumerToken getUnauthorizedRequestToken(ProtectedResourceDetails details, String callback) throws OAuthRequestFailedException { URL requestTokenURL;/*from w ww . ja v a 2 s . c o m*/ 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); }
From source file:org.springframework.security.oauth.consumer.CoreOAuthConsumerSupport.java
public OAuthConsumerToken getUnauthorizedRequestToken(String resourceId, String callback) throws OAuthRequestFailedException { ProtectedResourceDetails details = getProtectedResourceDetailsService() .loadProtectedResourceDetailsById(resourceId); URL requestTokenURL;/* ww w.ja v a 2 s .c o m*/ 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); }