#IAZNZS oauth2单点注销没有生效修复
This commit is contained in:
@@ -20,22 +20,21 @@ package org.dromara.maxkey.authz.singlelogout;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.dromara.maxkey.authn.SignPrincipal;
|
||||
import org.dromara.maxkey.entity.apps.Apps;
|
||||
import org.dromara.maxkey.authn.session.VisitedDto;
|
||||
import org.dromara.maxkey.util.DateUtils;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
public class DefaultSingleLogout extends SingleLogout{
|
||||
|
||||
@Override
|
||||
public void sendRequest(Authentication authentication,Apps logoutApp) {
|
||||
public void sendRequest(Authentication authentication,VisitedDto visited) {
|
||||
HashMap<String,Object> logoutParameters = new HashMap<String,Object>();
|
||||
logoutParameters.put("id", UUID.randomUUID().toString());
|
||||
logoutParameters.put("principal", authentication.getName());
|
||||
logoutParameters.put("request", "logoutRequest");
|
||||
logoutParameters.put("issueInstant", DateUtils.getCurrentDateAsString(DateUtils.FORMAT_DATE_ISO_TIMESTAMP));
|
||||
logoutParameters.put("ticket", ((SignPrincipal)authentication.getPrincipal()).getSessionId());
|
||||
postMessage(logoutApp.getLogoutUrl(),logoutParameters);
|
||||
logoutParameters.put("ticket", visited.getTicket());
|
||||
postMessage(visited.getLogoutUrl(),logoutParameters);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ package org.dromara.maxkey.authz.singlelogout;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.dromara.maxkey.entity.apps.Apps;
|
||||
import org.dromara.maxkey.authn.session.VisitedDto;
|
||||
import org.dromara.maxkey.util.DateUtils;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
@@ -43,17 +43,17 @@ public class SamlSingleLogout extends SingleLogout{
|
||||
+ "</saml:NameID><samlp:SessionIndex>%s</samlp:SessionIndex></samlp:LogoutRequest>";
|
||||
|
||||
@Override
|
||||
public void sendRequest(Authentication authentication,Apps logoutApp) {
|
||||
public void sendRequest(Authentication authentication,VisitedDto visited) {
|
||||
String requestMessage = String.format(logoutRequestMessage,
|
||||
UUID.randomUUID().toString(),
|
||||
DateUtils.getCurrentDateAsString(DateUtils.FORMAT_DATE_ISO_TIMESTAMP),
|
||||
authentication.getName(),
|
||||
logoutApp.getOnlineTicket()
|
||||
visited.getTicket()
|
||||
);
|
||||
|
||||
HashMap<String,Object> logoutParameters = new HashMap<String,Object>();
|
||||
logoutParameters.put(LOGOUT_REQUEST_PARAMETER, requestMessage);
|
||||
postMessage(logoutApp.getLogoutUrl(),logoutParameters);
|
||||
postMessage(visited.getLogoutUrl(),logoutParameters);
|
||||
}
|
||||
|
||||
public SamlSingleLogout() {
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.dromara.maxkey.authz.singlelogout;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.dromara.maxkey.entity.apps.Apps;
|
||||
import org.dromara.maxkey.authn.session.VisitedDto;
|
||||
import org.dromara.maxkey.web.HttpRequestAdapter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -28,7 +28,7 @@ import org.springframework.security.core.Authentication;
|
||||
public abstract class SingleLogout {
|
||||
private static final Logger _logger = LoggerFactory.getLogger(SingleLogout.class);
|
||||
|
||||
public abstract void sendRequest(Authentication authentication,Apps logoutApp) ;
|
||||
public abstract void sendRequest(Authentication authentication,VisitedDto visited) ;
|
||||
|
||||
public void postMessage(String url,Map<String, Object> paramMap) {
|
||||
_logger.debug("post logout message to url {}" , url);
|
||||
|
||||
Reference in New Issue
Block a user