602 Unstar Star 2K Fork 706

GVPbaomidou / kisso

jfianl ajax请求,下发不了cookie。

Closed
ToSur丶  Opened this issue

SSOHelper.setSSOCookie(getRequest(), getResponse(), token, true);
res.setData("已下发Cookies至响应");

12260 jobob 1578914833 total 2 participants

Comments (3)

ToSur丶 2017-11-03 09:59

十一月 03, 2017 9:58:16 上午 com.baomidou.kisso.service.KissoServiceSupport generateCookie
严重: generateCookie is exception!java.lang.ClassCastException: java.lang.reflect.Method cannot be cast to java.lang.Class

ToSur丶 2017-11-03 10:00
private Cookie generateCookie( HttpServletRequest request, Token token, SSOEncrypt encrypt ) {
		try {
			Cookie cookie = new Cookie(config.getCookieName(), encryptCookie(request, token, encrypt));
			cookie.setPath(config.getCookiePath());
			cookie.setSecure(config.getCookieSecure());
			/**
			 * domain 提示
			 * <p>
			 * 有些浏览器 localhost 无法设置 cookie
			 * </p>
			 */
			String domain = config.getCookieDomain();
			cookie.setDomain(domain);
			if ( "".equals(domain) || domain.contains("localhost") ) {
				logger.fine("if you can't login, please enter normal domain. instead:" + domain);
			}

			/**
			 * 设置Cookie超时时间
			 */
			int maxAge = config.getCookieMaxage();
			Integer attrMaxAge = (Integer) request.getAttribute(SSOConfig.SSO_COOKIE_MAXAGE);
			if (attrMaxAge != null) {
				maxAge = attrMaxAge;
			}
			if ( maxAge >= 0 ) {
				cookie.setMaxAge(maxAge);
			}
			return cookie;
		} catch ( Exception e ) {
			logger.severe("generateCookie is exception!" + e.toString());
			return null;
		}
	}
12260 jobob 1578914833
青苗 2018-04-27 15:39 owner

请注意是否使用域名一般 localhost ip 某些浏览器不支持,多试几个浏览器观察

Sign in to comment

Assignees
Labels
Not set
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority
Java
1
https://gitee.com/baomidou/kisso.git
git@gitee.com:baomidou/kisso.git
baomidou
kisso
kisso

Search

132457 8cb2edc1 1899542 131848 70c8d3a4 1899542