Java Code Examples for org.springframework.web.util.CookieGenerator

The following examples show how to use org.springframework.web.util.CookieGenerator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public String getToken(final HttpServletRequest request, final HttpServletResponse response) {
	final Cookie tokenCookie = WebUtils.getCookie(request, COOKIE_KEY);
	if (tokenCookie != null && tokenCookie.getValue() != null) {
		logger.debug("Detected profile token from cookie: {}", tokenCookie.getValue());
		return tokenCookie.getValue();
	}
	final String token = UUID.randomUUID().toString();
	final CookieGenerator g = new CookieGenerator();
	g.setCookieMaxAge(Integer.MAX_VALUE);
	g.setCookiePath("/");
	g.setCookieName(COOKIE_KEY);
	g.addCookie(response, token);
	logger.debug("Generated a new token: {}", token);
	return token;
}
 
Example 2
@Before
public void onSetUp() throws Exception {
    this.action = new AuthenticationViaFormAction();

    this.warnCookieGenerator = new CookieGenerator();
    this.warnCookieGenerator.setCookieName("WARN");
    this.warnCookieGenerator.setCookieName("TGT");
    this.warnCookieGenerator.setCookieDomain("/");
    this.warnCookieGenerator.setCookiePath("/");

    this.action.setCentralAuthenticationService(getCentralAuthenticationService());
    this.action.setWarnCookieGenerator(this.warnCookieGenerator);
}
 
Example 3
@Before
   public void onSetUp() throws Exception {
       this.action = new AuthenticationViaFormAction();

       this.warnCookieGenerator = new CookieGenerator();
       this.warnCookieGenerator.setCookieName("WARN");
       this.warnCookieGenerator.setCookieName("TGT");
       this.warnCookieGenerator.setCookieDomain("/");
       this.warnCookieGenerator.setCookiePath("/");

       this.action
           .setCentralAuthenticationService(getCentralAuthenticationService());
       this.action.setWarnCookieGenerator(this.warnCookieGenerator);
//       this.action.afterPropertiesSet();
   }
 
Example 4
Source Project: taoshop   Source File: AuthenticationViaFormAction.java    License: Apache License 2.0 4 votes vote down vote up
public void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example 5
public final void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example 6
public final void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example 7
/**
 * Sets the warn cookie generator.
 *
 * @param warnCookieGenerator the new warn cookie generator
 */
public final void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
    this.wrapperAuthenticationAction.setWarnCookieGenerator(warnCookieGenerator);
}