List of usage examples for org.apache.shiro.web.servlet Cookie getName
String getName();
From source file:com.rekoe.shiro.web.SimpleCookie.java
License:Apache License
public SimpleCookie(Cookie cookie) { this.name = cookie.getName(); this.value = cookie.getValue(); this.comment = cookie.getComment(); this.domain = cookie.getDomain(); this.path = cookie.getPath(); this.maxAge = Math.max(DEFAULT_MAX_AGE, cookie.getMaxAge()); this.version = Math.max(DEFAULT_VERSION, cookie.getVersion()); this.secure = cookie.isSecure(); this.httpOnly = cookie.isHttpOnly(); }
From source file:com.rekoe.shiro.web.SimpleCookie.java
License:Apache License
/** * Returns the cookie with the given name from the request or {@code null} * if no cookie with that name could be found. * * @param request/* w ww. j av a2 s . c o m*/ * the current executing http request. * @param cookieName * the name of the cookie to find and return. * @return the cookie with the given name from the request or {@code null} * if no cookie with that name could be found. */ private static javax.servlet.http.Cookie getCookie(HttpServletRequest request, String cookieName) { if (request == null) { return null; } javax.servlet.http.Cookie cookies[] = request.getCookies(); if (cookies != null) { for (javax.servlet.http.Cookie cookie : cookies) { if (cookie.getName().equals(cookieName)) { return cookie; } } } return null; }
From source file:org.tolven.shiro.web.session.mgt.TolvenWebSessionManager.java
License:Open Source License
@Override protected void onStart(Session session, SessionContext context) { super.onStart(session, context); HttpServletRequest request = WebUtils.getHttpRequest(context); HttpServletResponse response = WebUtils.getHttpResponse(context); //Remove cookie added by super class Cookie template = getSessionIdCookie(); Cookie cookie = new SimpleCookie(template); cookie.removeFrom(request, response); /*/* ww w . j a v a 2s . co m*/ * Now place the secret key in a cookie by combining it with the sessionId using a * two way algorithm */ if (logger.isDebugEnabled()) { logger.debug("Creating secret key cookie for cookie template name: " + template.getName()); } String sessionId = session.getId().toString(); cookie.setValue(SecretKeyThreadLocal.getExtendedSessionId(sessionId, SecretKeyThreadLocal.get())); cookie.saveTo(request, response); if (logger.isDebugEnabled()) { logger.debug("Saved secret key cookie to response for session: " + sessionId); } }