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.
40 lines
1.4 KiB
40 lines
1.4 KiB
3 years ago
|
package com.fr.plugin.xxxx.gjdbjj.sso;
|
||
|
|
||
|
import com.fr.decision.fun.impl.AbstractLogInOutEventProvider;
|
||
|
import com.fr.decision.webservice.login.LogInOutResultInfo;
|
||
|
import com.fr.general.PropertiesUtils;
|
||
|
import com.fr.plugin.xxxx.gjdbjj.sso.utils.LogUtils;
|
||
|
import com.fr.stable.StringUtils;
|
||
|
import com.fr.third.springframework.web.util.WebUtils;
|
||
|
|
||
|
import javax.servlet.http.Cookie;
|
||
|
import java.util.Properties;
|
||
|
|
||
|
import static com.fr.plugin.xxxx.gjdbjj.sso.utils.CommonUtils.getProperty;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @Author fr.open
|
||
|
* @since 2021/8/24
|
||
|
**/
|
||
|
public class CustomLogInOutEventProvider extends AbstractLogInOutEventProvider {
|
||
|
|
||
|
@Override
|
||
|
public String logoutAction(LogInOutResultInfo result) {
|
||
|
Cookie token = WebUtils.getCookie(result.getRequest(), "ACCESS_TOKEN");
|
||
|
if (token != null) {
|
||
|
Properties props = PropertiesUtils.getProperties("sso");
|
||
|
String logoutURL = getProperty(props, "api.logout", true);
|
||
|
String redirectUri = getProperty(props, "api.redirectUri", true);
|
||
|
if (StringUtils.isBlank(logoutURL)) {
|
||
|
return StringUtils.EMPTY;
|
||
|
}
|
||
|
String format = String.format("%s?redirect_uri=%s&access_token=%s", logoutURL, redirectUri, token.getValue());
|
||
|
LogUtils.debug4plugin("get logout URL is {}", format);
|
||
|
return format;
|
||
|
}
|
||
|
|
||
|
return StringUtils.EMPTY;
|
||
|
}
|
||
|
}
|