My scenario is user A already logged on "admin". user B try to log in as "admin", customAuthenticationHandler found "admin" is logged on and return error Exception( this part done).
after that, how to log out the "admin" in CAS?
List<Ticket> list = new ArrayList<Ticket>();
list.addAll(ticketRegistry.getTickets());
for( Ticket x : list )
{
TicketGrantingTicketImpl ticket = (TicketGrantingTicketImpl) x;
String name = ticket.getAuthentication().getPrincipal().getId();
if(username.equals(name))
{
logoutManager.performLogout(ticket);
}
}
get the ticketRegistry and logoutManager, find out the name and do performLogout.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.