Author: lindner
Date: Thu Feb 19 22:25:17 2009
New Revision: 746036
URL: http://svn.apache.org/viewvc?rev=746036&view=rev
Log:
SHINDIG-897 | correct accessToken generation, better error diagnostics
Modified:
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/core/oauth/OAuthAuthenticationHandler.java
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleOAuthDataStore.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=746036&r1=746035&r2=746036&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
Thu Feb 19 22:25:17 2009
@@ -78,9 +78,12 @@
}
private boolean isValidOAuthRequest(OAuthMessage message, OAuthEntry entry) {
- if (entry == null || entry.type != OAuthEntry.Type.ACCESS ||
entry.isExpired()) {
- throw new InvalidAuthenticationException("access token is invalid.",
null);
- }
+ if (entry == null)
+ throw new InvalidAuthenticationException("access token not found.",
null);
+ if (entry.type != OAuthEntry.Type.ACCESS)
+ throw new InvalidAuthenticationException("token is not an access
token.", null);
+ if (entry.isExpired())
+ throw new InvalidAuthenticationException("access token has expired.",
null);
OAuthServiceProvider provider = new OAuthServiceProvider(null, null, null);
OAuthAccessor accessor = new OAuthAccessor(new OAuthConsumer(null,
entry.consumerKey,
Modified:
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleOAuthDataStore.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleOAuthDataStore.java?rev=746036&r1=746035&r2=746036&view=diff
==============================================================================
---
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleOAuthDataStore.java
(original)
+++
incubator/shindig/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/oauth/SampleOAuthDataStore.java
Thu Feb 19 22:25:17 2009
@@ -105,9 +105,11 @@
accessEntry.type = OAuthEntry.Type.ACCESS;
accessEntry.issueTime = new Date();
- oauthEntries.put(entry.token, entry);
+
+ oauthEntries.remove(entry.token);
+ oauthEntries.put(accessEntry.token, accessEntry);
- return entry;
+ return accessEntry;
}
// Authorize the request token for the given user id