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.
44 lines
1.4 KiB
44 lines
1.4 KiB
/* |
|
* Copyright (C), 2018-2021 |
|
* Project: starter |
|
* FileName: CustomLogInOutEventProvider |
|
* Author: Louis |
|
* Date: 2021/9/1 16:38 |
|
*/ |
|
package com.fr.plugin.hejr; |
|
|
|
import com.fanruan.api.util.StringKit; |
|
import com.fr.decision.fun.impl.AbstractLogInOutEventProvider; |
|
import com.fr.decision.webservice.login.LogInOutResultInfo; |
|
import com.fr.plugin.hejr.config.SsoConfig; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import static com.fr.plugin.hejr.request.OAuthLogin.DING_TALK_LOGIN; |
|
|
|
/** |
|
* <Function Description><br> |
|
* <CustomLogInOutEventProvider> |
|
* |
|
* @author fr.open |
|
* @since 1.0.0 |
|
*/ |
|
public class CustomLogInOutEventProvider extends AbstractLogInOutEventProvider { |
|
private final SsoConfig config; |
|
|
|
public CustomLogInOutEventProvider() { |
|
this.config = SsoConfig.getInstance(); |
|
} |
|
|
|
@Override |
|
public String logoutAction(LogInOutResultInfo logInOutResultInfo) { |
|
HttpServletRequest request = logInOutResultInfo.getRequest(); |
|
String dingTalkLogin = String.valueOf(request.getAttribute(DING_TALK_LOGIN)); |
|
if (StringKit.equals(dingTalkLogin, "true") && StringKit.isNotBlank(this.config.getDingLogOut())) { |
|
return this.config.getDingLogOut(); |
|
} else if (StringKit.isNotBlank(this.config.getSsoLogOut())) { |
|
return this.config.getSsoLogOut(); |
|
} |
|
return StringKit.EMPTY; |
|
} |
|
} |