You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2009/04/08 01:45:29 UTC

svn commit: r763044 - /incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java

Author: lindner
Date: Tue Apr  7 23:45:28 2009
New Revision: 763044

URL: http://svn.apache.org/viewvc?rev=763044&view=rev
Log:
fix issues with throwing problem exceptions, get rid of OAuthServiceProvider

Modified:
    incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java

Modified: incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java?rev=763044&r1=763043&r2=763044&view=diff
==============================================================================
--- incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java (original)
+++ incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java Tue Apr  7 23:45:28 2009
@@ -119,9 +119,7 @@
     OAuthEntry entry = getOAuthEntry(message);
     OAuthConsumer authConsumer = getConsumer(message);
 
-    OAuthServiceProvider provider = new OAuthServiceProvider(null, null, null);
-    OAuthAccessor accessor = new OAuthAccessor(new OAuthConsumer(null, authConsumer.consumerKey,
-        authConsumer.consumerSecret, provider));
+    OAuthAccessor accessor = new OAuthAccessor(authConsumer);
 
     if (entry != null) {
       accessor.tokenSecret = entry.tokenSecret;
@@ -130,12 +128,20 @@
 
     try {
       message.validateMessage(accessor, new SimpleOAuthValidator());
+    } catch (OAuthProblemException e) {
+      throw e;
     } catch (OAuthException e) {
-      throw new OAuthProblemException();
+      OAuthProblemException ope = new OAuthProblemException(OAuth.Problems.SIGNATURE_INVALID);
+      ope.setParameter(OAuth.Problems.OAUTH_PROBLEM_ADVICE, e.getMessage());
+      throw ope;
     } catch (IOException e) {
-      throw new OAuthProblemException();
+      OAuthProblemException ope = new OAuthProblemException(OAuth.Problems.SIGNATURE_INVALID);
+      ope.setParameter(OAuth.Problems.OAUTH_PROBLEM_ADVICE, e.getMessage());
+      throw ope;
     } catch (URISyntaxException e) {
-      throw new OAuthProblemException();
+      OAuthProblemException ope = new OAuthProblemException(OAuth.Problems.SIGNATURE_INVALID);
+      ope.setParameter(OAuth.Problems.OAUTH_PROBLEM_ADVICE, e.getMessage());
+      throw ope;
     }
     return getTokenFromVerifiedRequest(message, entry, authConsumer);
   }