You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.5 KiB
54 lines
1.5 KiB
4 years ago
|
/**
|
||
|
* Copyright (C), 2015-2019
|
||
|
* FileName: CustomLogInOutEventProvider
|
||
|
* Author: Louis
|
||
|
* Date: 2019/6/19 16:25
|
||
|
* Description: CustomLogInOutEventProvider
|
||
|
* History:
|
||
|
* <author> <time> <version> <desc>
|
||
|
*/
|
||
|
package com.fr.plugin.j7706.sso;
|
||
|
|
||
|
import com.fanruan.api.log.LogKit;
|
||
|
import com.fanruan.api.util.StringKit;
|
||
|
import com.fr.decision.fun.impl.AbstractLogInOutEventProvider;
|
||
|
import com.fr.decision.webservice.login.LogInOutResultInfo;
|
||
|
|
||
|
import javax.servlet.http.Cookie;
|
||
|
import javax.servlet.http.HttpServletResponse;
|
||
|
|
||
|
import static com.fr.plugin.j7706.sso.request.GlobalRequestFilterBridge.COOKIE_TOKEN;
|
||
|
import static com.fr.plugin.j7706.sso.request.GlobalRequestFilterBridge.getLoginUrl;
|
||
|
|
||
|
/**
|
||
|
* 〈Function Description〉<br>
|
||
|
* 〈CustomLogInOutEventProvider〉
|
||
|
*
|
||
|
* @author Louis
|
||
|
* @since 1.0.0
|
||
|
*/
|
||
|
public class CustomLogInOutEventProvider extends AbstractLogInOutEventProvider {
|
||
|
|
||
|
/**
|
||
|
* 用户登出处理
|
||
|
* @param result
|
||
|
* @return
|
||
|
*/
|
||
|
@Override
|
||
|
public String logoutAction(LogInOutResultInfo result) {
|
||
|
try {
|
||
|
clearCookie(result.getResponse());
|
||
|
return getLoginUrl(result.getRequest());
|
||
|
} catch (Exception e) {
|
||
|
LogKit.error(e.getMessage(), e);
|
||
|
}
|
||
|
return StringKit.EMPTY;
|
||
|
}
|
||
|
|
||
|
private void clearCookie(HttpServletResponse response) {
|
||
|
Cookie cookie = new Cookie(COOKIE_TOKEN, null);
|
||
|
cookie.setMaxAge(0);
|
||
|
cookie.setPath("transsion.com");
|
||
|
response.addCookie(cookie);
|
||
|
}
|
||
|
}
|