mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-08 09:58:56 +08:00
ONLINE_TICKET cookie
This commit is contained in:
parent
b2f9875595
commit
16cba997e8
@ -150,12 +150,11 @@ public class RealmAuthenticationProvider extends AbstractAuthenticationProvider
|
|||||||
|
|
||||||
OnlineTicket onlineTicket = new OnlineTicket(onlineTickitId);
|
OnlineTicket onlineTicket = new OnlineTicket(onlineTickitId);
|
||||||
|
|
||||||
|
//set ONLINE_TICKET cookie
|
||||||
WebContext.setCookie(WebContext.getResponse(),
|
WebContext.setCookie(WebContext.getResponse(),
|
||||||
this.applicationConfig.getBaseDomainName(),
|
this.applicationConfig.getBaseDomainName(),
|
||||||
WebConstants.ONLINE_TICKET_NAME,
|
WebConstants.ONLINE_TICKET_NAME,
|
||||||
onlineTickitId,
|
onlineTickitId);
|
||||||
0);
|
|
||||||
|
|
||||||
SigninPrincipal signinPrincipal = new SigninPrincipal(userInfo);
|
SigninPrincipal signinPrincipal = new SigninPrincipal(userInfo);
|
||||||
//set OnlineTicket
|
//set OnlineTicket
|
||||||
|
|||||||
@ -368,7 +368,7 @@ public final class WebContext {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// 单位:秒
|
// 单位:秒
|
||||||
if(time > 0) {
|
if(time >= 0) {
|
||||||
cookie.setMaxAge(time);
|
cookie.setMaxAge(time);
|
||||||
}
|
}
|
||||||
// 将Cookie添加到Response中,使之生效
|
// 将Cookie添加到Response中,使之生效
|
||||||
@ -376,6 +376,18 @@ public final class WebContext {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HttpServletResponse expiryCookie(
|
||||||
|
HttpServletResponse response, String domain ,String name, String value) {
|
||||||
|
WebContext.setCookie(response,domain,name, value,0);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HttpServletResponse setCookie(
|
||||||
|
HttpServletResponse response, String domain ,String name, String value) {
|
||||||
|
WebContext.setCookie(response,domain,name, value,-1);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get Current Date,eg 2012-07-10.
|
* get Current Date,eg 2012-07-10.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package org.maxkey.web.endpoint;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -125,6 +126,13 @@ public class LogoutEndpoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
onlineTicketServices.remove(onlineTicketId);
|
onlineTicketServices.remove(onlineTicketId);
|
||||||
|
|
||||||
|
//remove ONLINE_TICKET cookie
|
||||||
|
WebContext.expiryCookie(WebContext.getResponse(),
|
||||||
|
this.applicationConfig.getBaseDomainName(),
|
||||||
|
WebConstants.ONLINE_TICKET_NAME,
|
||||||
|
UUID.randomUUID().toString());
|
||||||
|
|
||||||
request.getSession().invalidate();
|
request.getSession().invalidate();
|
||||||
SecurityContextHolder.clearContext();
|
SecurityContextHolder.clearContext();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user