List of usage examples for javax.servlet ServletContext getSessionCookieConfig
public SessionCookieConfig getSessionCookieConfig();
From source file:net.prasenjit.security.login.LoginApplication.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { servletContext.getSessionCookieConfig().setName("SESSIONID"); }
From source file:configuration.WebInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { servletContext.getSessionCookieConfig().setMaxAge(-1); // HttpSessionEventPublisher sessionPublisher=new HttpSessionEventPublisher(); // servletContext.addListener(sessionPublisher); super.onStartup(servletContext); }
From source file:de.chludwig.websec.saml2sp.springconfig.MvcConfig.java
/** * Servlet context initializer that sets a custom session cookie name. * * Otherwise, saml2sp and WSO2's Identity Server overwrite each other's session cookie if they are * both serving localhost (on different ports). This breaks the SSO flow. * * @return a context initializer that sets the session cookie name to {@code "SAML2SPSESSIONID"}. *///from www .j ava 2 s.co m @Bean public ServletContextInitializer servletContextInitializer() { return new ServletContextInitializer() { @Override public void onStartup(ServletContext servletContext) throws ServletException { servletContext.getSessionCookieConfig().setName("SAML2SPSESSIONID"); } }; }
From source file:alfio.config.Initializer.java
private void configureSessionCookie(ServletContext servletContext) { SessionCookieConfig config = servletContext.getSessionCookieConfig(); config.setHttpOnly(true);//from w ww . j a v a 2 s. co m Validate.notNull(environment, "environment cannot be null!"); // set secure cookie only if current environment doesn't strictly need HTTP config.setSecure(!environment.acceptsProfiles(PROFILE_HTTP)); // // FIXME and CHECKME what a mess, ouch: https://issues.jboss.org/browse/WFLY-3448 ? config.setPath(servletContext.getContextPath() + "/"); // }
From source file:com.techlooper.config.web.DispatcherServletInitializer.java
public void onStartup(ServletContext servletContext) throws ServletException { super.onStartup(servletContext); SessionCookieConfig sessionCookieConfig = servletContext.getSessionCookieConfig(); sessionCookieConfig.setMaxAge(SessionListener.MAX_INACTIVE_INTERVAL); sessionCookieConfig.setHttpOnly(true); servletContext.addListener(new SessionListener()); }
From source file:fi.helsinki.opintoni.config.WebConfigurer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { log.info("Web application configuration, using profiles: {}", Arrays.toString(env.getActiveProfiles())); EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC);//from w ww.j a v a 2s.c o m if (env.acceptsProfiles(Constants.SPRING_PROFILE_DEVELOPMENT, Constants.SPRING_PROFILE_QA, Constants.SPRING_PROFILE_DEMO, Constants.SPRING_PROFILE_PRODUCTION)) { initMetrics(servletContext, dispatcherTypes); // Forces browser to send cookies with HTTPS connection only servletContext.getSessionCookieConfig().setSecure(true); } servletContext.getSessionCookieConfig().setName(Constants.SESSION_COOKIE_NAME); servletContext.getSessionCookieConfig().setDomain(appConfiguration.get("cookieDomain")); log.info("Web application fully configured"); }
From source file:io.lavagna.config.DispatcherServletInitializer.java
@Override public void onStartup(ServletContext servletContext) throws ServletException { super.onStartup(servletContext); // initialize cookie if (StringUtils.isNotEmpty(System.getProperty(CookieNames.PROPERTY_NAME))) { CookieNames.updatePrefix(System.getProperty(CookieNames.PROPERTY_NAME)); }/*from w w w.j av a 2 s. c om*/ // //definition order = execution order, the first executed filter is HSTSFilter addFilter(servletContext, "HSTSFilter", HSTSFilter.class, "/*"); addFilter(servletContext, "CSFRFilter", CSFRFilter.class, "/*"); addFilter(servletContext, "RememberMeFilter", RememberMeFilter.class, "/*"); addFilter(servletContext, "AnonymousUserFilter", AnonymousUserFilter.class, "/*"); addFilter(servletContext, "SecurityFilter", SecurityFilter.class, "/*"); addFilter(servletContext, "ETagFilter", ShallowEtagHeaderFilter.class, "*.js", "*.css", // "/", "/project/*", "/admin/*", "/me/", // "*.html", "*.woff", "*.eot", "*.svg", "*.ttf"); addFilter(servletContext, "GzipFilter", GzipFilter.class, "*.js", "*.css", // "/", "/project/*", "/admin/*", "/me/", // "/api/self", "/api/board/*", "/api/project/*"); servletContext.setSessionTrackingModes(Collections.singleton(SessionTrackingMode.COOKIE)); servletContext.getSessionCookieConfig().setHttpOnly(true); servletContext.getSessionCookieConfig().setName(CookieNames.getSessionCookieName()); }
From source file:org.cloudfoundry.identity.uaa.web.UaaSessionCookieConfig.java
@Override public void setServletContext(ServletContext servletContext) { logger.debug("Configuring session cookie."); try {//from ww w .j a v a 2s . c o m SessionCookieConfig config = servletContext.getSessionCookieConfig(); if (hasText(getComment())) { logger.debug(String.format("Configuring session cookie - Comment: %s", getComment())); config.setComment(getComment()); } if (hasText(getDomain())) { logger.debug(String.format("Configuring session cookie - Domain: %s", getDomain())); config.setDomain(getDomain()); } if (getMaxAge() > Integer.MIN_VALUE) { logger.debug(String.format("Configuring session cookie - MaxAge: %s", getMaxAge())); config.setMaxAge(getMaxAge()); } if (getPath() != null) { logger.debug(String.format("Configuring session cookie - Path: %s", getPath())); config.setPath(getPath()); } logger.debug(String.format("Configuring session cookie - HttpOnly: %s", isHttpOnly())); config.setHttpOnly(isHttpOnly()); logger.debug(String.format("Configuring session cookie - Secure: %s", isSecure())); config.setSecure(isSecure()); if (hasText(getName())) { logger.debug(String.format("Configuring session cookie - Name: %s", getName())); config.setName(getName()); } } catch (Exception e) { logger.error("Ignoring session cookie config - unable to configure UAA session cookie", e); } }