@RequestMapping("/handleTemporaryCredentials")
public ModelAndView handleRequest(@ModelAttribute(value = "oAuthParams") OAuthParams oAuthParams,
HttpServletResponse response) {
OAuthServiceProvider provider;
OAuthConsumer consumer;
OAuthAccessor accessor;
OAuthClient client = new OAuthClient(new URLConnectionClient());
oAuthParams.setErrorMessage(null);
String temporaryCredentialsEndpointUrl = oAuthParams.getTemporaryCredentialsEndpoint();
if (temporaryCredentialsEndpointUrl == null || "".equals(temporaryCredentialsEndpointUrl)) {
oAuthParams.setErrorMessage("Missing temporary credentials endpoint url");
}
String clientId = oAuthParams.getClientID();
if (clientId == null || "".equals(clientId)) {
oAuthParams.setErrorMessage("Missing client identifier");
}
String secret = oAuthParams.getClientSecret();
if (secret == null || "".equals(secret)) {
oAuthParams.setErrorMessage("Missing client shared-secret");
}
if (oAuthParams.getErrorMessage() == null) {
provider = new OAuthServiceProvider(temporaryCredentialsEndpointUrl,
oAuthParams.getResourceOwnerAuthorizationEndpoint(), oAuthParams.getTokenRequestEndpoint());
consumer = new OAuthConsumer(null, clientId,
secret,
provider);
accessor = new OAuthAccessor(consumer);