summaryrefslogtreecommitdiff
path: root/src/com/p4square/grow/frontend/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/p4square/grow/frontend/session')
-rw-r--r--src/com/p4square/grow/frontend/session/Session.java2
-rw-r--r--src/com/p4square/grow/frontend/session/SessionCheckingAuthenticator.java1
-rw-r--r--src/com/p4square/grow/frontend/session/SessionCreatingAuthenticator.java1
-rw-r--r--src/com/p4square/grow/frontend/session/Sessions.java8
4 files changed, 9 insertions, 3 deletions
diff --git a/src/com/p4square/grow/frontend/session/Session.java b/src/com/p4square/grow/frontend/session/Session.java
index 3a241ef..3377962 100644
--- a/src/com/p4square/grow/frontend/session/Session.java
+++ b/src/com/p4square/grow/frontend/session/Session.java
@@ -15,7 +15,7 @@ import org.restlet.security.User;
* @author Jesse Morgan <jesse@jesterpm.net>
*/
public class Session {
- private static final long LIFETIME = 86400;
+ private static final long LIFETIME = 86400000;
private final String mSessionId;
private final User mUser;
diff --git a/src/com/p4square/grow/frontend/session/SessionCheckingAuthenticator.java b/src/com/p4square/grow/frontend/session/SessionCheckingAuthenticator.java
index 8382aff..745484d 100644
--- a/src/com/p4square/grow/frontend/session/SessionCheckingAuthenticator.java
+++ b/src/com/p4square/grow/frontend/session/SessionCheckingAuthenticator.java
@@ -27,6 +27,7 @@ public class SessionCheckingAuthenticator extends Authenticator {
Session s = Sessions.getInstance().get(request);
if (s != null) {
+ LOG.debug("Found session for user " + s.getUser());
request.getClientInfo().setUser(s.getUser());
return true;
diff --git a/src/com/p4square/grow/frontend/session/SessionCreatingAuthenticator.java b/src/com/p4square/grow/frontend/session/SessionCreatingAuthenticator.java
index ce6024c..c569bb9 100644
--- a/src/com/p4square/grow/frontend/session/SessionCreatingAuthenticator.java
+++ b/src/com/p4square/grow/frontend/session/SessionCreatingAuthenticator.java
@@ -36,6 +36,7 @@ public class SessionCreatingAuthenticator extends Authenticator {
if (request.getClientInfo().isAuthenticated() && user != null) {
Sessions.getInstance().create(request, response);
+ LOG.debug(response);
return true;
}
diff --git a/src/com/p4square/grow/frontend/session/Sessions.java b/src/com/p4square/grow/frontend/session/Sessions.java
index 094d2f0..58bb5f6 100644
--- a/src/com/p4square/grow/frontend/session/Sessions.java
+++ b/src/com/p4square/grow/frontend/session/Sessions.java
@@ -9,6 +9,7 @@ import java.util.Map;
import org.restlet.Response;
import org.restlet.Request;
+import org.restlet.data.CookieSetting;
import org.restlet.security.User;
/**
@@ -72,8 +73,11 @@ public class Sessions {
public Session create(Request request, Response response) {
Session s = create(request.getClientInfo().getUser());
- request.getCookies().add(COOKIE_NAME, s.getId());
- response.getCookieSettings().add(COOKIE_NAME, s.getId());
+ CookieSetting cookie = new CookieSetting(COOKIE_NAME, s.getId());
+ cookie.setPath("/");
+
+ request.getCookies().add(cookie);
+ response.getCookieSettings().add(cookie);
return s;
}