Example usage for org.springframework.security.oauth.common OAuthConsumerParameter oauth_callback

List of usage examples for org.springframework.security.oauth.common OAuthConsumerParameter oauth_callback

Introduction

In this page you can find the example usage for org.springframework.security.oauth.common OAuthConsumerParameter oauth_callback.

Prototype

OAuthConsumerParameter oauth_callback

To view the source code for org.springframework.security.oauth.common OAuthConsumerParameter oauth_callback.

Click Source Link

Document

Parameter for the callback.

Usage

From source file:org.springframework.security.oauth.consumer.client.CoreOAuthConsumerSupport.java

public OAuthConsumerToken getUnauthorizedRequestToken(ProtectedResourceDetails details, String callback)
        throws OAuthRequestFailedException {
    URL requestTokenURL;//  w  w  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);
}

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;/*from   w w w .  ja va2s .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);
}