@Override public final H.Session parseTicket(T ticket) { Map<String, String> payload = new HashMap<>(); String id = deserialize(ticket, payload); if (null == payload) { return null; } H.Session session = new H.Session(); $.setField("id", session, id); if (payload.isEmpty()) { return session; } for (Map.Entry<String, String> entry : payload.entrySet()) { session.put(entry.getKey(), entry.getValue()); } return session; } }
@Override public final H.Session parseTicket(T ticket) { Map<String, String> payload = new HashMap<>(); String id = deserialize(ticket, payload); if (null == payload) { return null; } H.Session session = new H.Session(); $.setField("id", session, id); if (payload.isEmpty()) { return session; } for (Map.Entry<String, String> entry : payload.entrySet()) { session.put(entry.getKey(), entry.getValue()); } return session; } }
public void dissolve() { if (!shouldWriteLocaleCookie()) { return; } String cookieName = config.localeCookieName(); Locale locale = context.locale(); if (null == locale) { locale = this.locale; } String localeStr = locale.toString(); H.Session session = context.session(); if (null != session) { if (reset) { session.remove(KEY); } else { session.put(KEY, localeStr); } } H.Cookie cookie = new H.Cookie(cookieName, localeStr); cookie.domain(config.cookieDomain()); cookie.path("/"); // in case we have resolved locale from cookie and we shouldn't write cookie anymore, we need to clear it cookie.maxAge(reset ? -1 : COOKIE_TTL); if (reset) { cookie.expires(DateTime.now().minusDays(1).toDate()); } context.resp().addCookie(cookie); }
public void dissolve() { if (!shouldWriteLocaleCookie()) { return; } String cookieName = config.localeCookieName(); Locale locale = context.locale(); if (null == locale) { locale = this.locale; } String localeStr = locale.toString(); H.Session session = context.session(); if (null != session) { if (reset) { session.remove(KEY); } else { session.put(KEY, localeStr); } } H.Cookie cookie = new H.Cookie(cookieName, localeStr); cookie.domain(config.cookieDomain()); cookie.path("/"); // in case we have resolved locale from cookie and we shouldn't write cookie anymore, we need to clear it cookie.maxAge(reset ? -1 : COOKIE_TTL); if (reset) { cookie.expires(DateTime.now().minusDays(1).toDate()); } context.resp().addCookie(cookie); }
@Override public String encodeSession(H.Session session) { if (null == session) { return null; } boolean sessionChanged = session.changed(); if (!sessionChanged && (session.empty() || !sessionWillExpire)) { // Nothing changed and no cookie-expire or empty, consequently send nothing back. return null; } session.id(); // ensure session ID is generated if (sessionWillExpire && !session.contains(KEY_EXPIRATION)) { // session get cleared before session.put(KEY_EXPIRATION, $.ms() + ttlInMillis); } return populateToken(jwt.newToken(), session).toString(jwt); }
@Override public String encodeSession(H.Session session) { if (null == session) { return null; } boolean sessionChanged = session.changed(); if (!sessionChanged && (session.empty() || !sessionWillExpire)) { // Nothing changed and no cookie-expire or empty, consequently send nothing back. return null; } session.id(); // ensure session ID is generated if (sessionWillExpire && !session.contains(KEY_EXPIRATION)) { // session get cleared before session.put(KEY_EXPIRATION, $.ms() + ttlInMillis); } return dissolveIntoCookieContent(session, true); }
@Override public String encodeSession(H.Session session) { if (null == session) { return null; } boolean sessionChanged = session.changed(); if (!sessionChanged && (session.empty() || !sessionWillExpire)) { // Nothing changed and no cookie-expire or empty, consequently send nothing back. return null; } session.id(); // ensure session ID is generated if (sessionWillExpire && !session.contains(KEY_EXPIRATION)) { // session get cleared before session.put(KEY_EXPIRATION, $.ms() + ttlInMillis); } return dissolveIntoCookieContent(session, true); }
@Override public String encodeSession(H.Session session) { if (null == session) { return null; } boolean sessionChanged = session.changed(); if (!sessionChanged && (session.empty() || !sessionWillExpire)) { // Nothing changed and no cookie-expire or empty, consequently send nothing back. return null; } session.id(); // ensure session ID is generated if (sessionWillExpire && !session.contains(KEY_EXPIRATION)) { // session get cleared before session.put(KEY_EXPIRATION, $.ms() + ttlInMillis); } return populateToken(jwt.newToken(), session).toString(jwt); }
public H.Session session(String key, String value) { return session.put(key, value); }
public H.Session session(String key, String value) { return session.put(key, value); }
/** * Update the context session to mark a user logged in * * @param userIdentifier * the user identifier, could be either userId or username */ public void login(Object userIdentifier) { session().put(config().sessionKeyUsername(), userIdentifier); app().eventBus().trigger(new LoginEvent(userIdentifier.toString())); }
@PostAction("i18n/timezone") @Description("Set timezone into session. The value should be offset to UTC in minutes") public static void updateTimezoneOffset( @Description("the timezone offset to UTC in minutes") int offset, H.Session session ) { session.put(SESSION_KEY, offset); }
@Override public void outputToken(String token, String cookieName, String cookieDomain, ActionContext context) { context.session().put(cookieName, token); } };
@Override public void outputToken(String token, String cookieName, String cookieDomain, ActionContext context) { context.session().put(cookieName, token); } };
/** * Update the context session to mark a user logged in * * @param userIdentifier * the user identifier, could be either userId or username */ public void login(Object userIdentifier) { session().put(config().sessionKeyUsername(), userIdentifier); }
@PostAction("i18n/timezone") @Description("Set timezone into session. The value should be offset to UTC in minutes") public static void updateTimezoneOffset( @Description("the timezone offset to UTC in minutes") int offset, H.Session session ) { session.put(SESSION_KEY, offset); }