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.
52 lines
1.5 KiB
52 lines
1.5 KiB
3 years ago
|
/**
|
||
|
* Copyright (C), 2015-2021
|
||
|
* FileName: CustomLogInOut
|
||
|
* Author: fr.open
|
||
|
* Date: 2019/6/19 16:25
|
||
|
* Description: CustomLogInOut
|
||
|
* History:
|
||
|
* <author> <time> <version> <desc>
|
||
|
*/
|
||
|
package com.fr.plugin.icjb;
|
||
|
|
||
|
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 com.fr.plugin.icjb.config.IcjbConfig;
|
||
|
|
||
|
import static com.fr.plugin.icjb.request.OAuthLogin.SSO_ACCESS_TOKEN;
|
||
|
|
||
|
/**
|
||
|
* 〈Function Description〉<br>
|
||
|
* 〈CustomLogInOut〉
|
||
|
*
|
||
|
* @author fr.open
|
||
|
* @since 1.0.0
|
||
|
*/
|
||
|
public class CustomLogInOut extends AbstractLogInOutEventProvider {
|
||
|
|
||
|
public static final String LOGOUT_PATH = "/logout";
|
||
|
private final IcjbConfig config;
|
||
|
|
||
|
public CustomLogInOut() {
|
||
|
this.config = IcjbConfig.getInstance();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 用户登出处理
|
||
|
*
|
||
|
* @param result
|
||
|
* @return
|
||
|
*/
|
||
|
@Override
|
||
|
public String logoutAction(LogInOutResultInfo result) {
|
||
|
String accessToken = String.valueOf(result.getRequest().getSession().getAttribute(SSO_ACCESS_TOKEN));
|
||
|
if (StringKit.isNotBlank(accessToken) && !StringKit.equals(accessToken, "null")) {
|
||
|
String url = this.config.getUriBase() + LOGOUT_PATH + "?access_token=" + accessToken;
|
||
|
LogKit.info("ijbd-CustomLogInOut-logoutAction-logoutUrl:{}", url);
|
||
|
return url;
|
||
|
}
|
||
|
return StringKit.EMPTY;
|
||
|
}
|
||
|
}
|