org.springframework.web.util.CookieGenerator Java Examples

The following examples show how to use org.springframework.web.util.CookieGenerator. 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
Source File: CookieTokenProvider.java    From logsniffer with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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
Source File: AuthenticationViaFormActionTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@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
Source File: AuthenticationViaFormActionTests.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@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 File: AuthenticationViaFormAction.java    From taoshop with Apache License 2.0 4 votes vote down vote up
public void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example #5
Source File: AuthenticationViaFormAction.java    From springboot-shiro-cas-mybatis with MIT License 4 votes vote down vote up
public final void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example #6
Source File: AuthenticationViaFormAction.java    From cas4.0.x-server-wechat with Apache License 2.0 4 votes vote down vote up
public final void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
    this.warnCookieGenerator = warnCookieGenerator;
}
 
Example #7
Source File: InitiatingMultiFactorAuthenticationViaFormAction.java    From cas-mfa with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the warn cookie generator.
 *
 * @param warnCookieGenerator the new warn cookie generator
 */
public final void setWarnCookieGenerator(final CookieGenerator warnCookieGenerator) {
    this.wrapperAuthenticationAction.setWarnCookieGenerator(warnCookieGenerator);
}