set 10 hours for token max age

This commit is contained in:
Sebastian Sdorra
2015-03-21 15:58:31 +01:00
parent debcacb61f
commit 3525346adb
2 changed files with 13 additions and 2 deletions

View File

@@ -63,6 +63,8 @@ import sonia.scm.util.HttpUtil;
//~--- JDK imports ------------------------------------------------------------
import java.util.concurrent.TimeUnit;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -180,6 +182,9 @@ public class AuthenticationResource
Cookie c = new Cookie("X-Bearer-Token", token);
c.setPath(request.getContextPath());
// TODO: should be configureable
c.setMaxAge((int) TimeUnit.SECONDS.convert(10, TimeUnit.HOURS));
c.setHttpOnly(true);
response.addCookie(c);
state = stateFactory.createState(subject);