mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 20:50:14 +08:00
CasLogout
This commit is contained in:
@@ -173,21 +173,4 @@ public class CasAuthorizeEndpoint extends CasBaseAuthorizeEndpoint{
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
/**
|
||||
* for cas logout then redirect to logout
|
||||
* @param request
|
||||
* @param response
|
||||
* @param casService
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "CAS注销接口", description = "CAS注销接口",method="GET")
|
||||
@RequestMapping(CasConstants.ENDPOINT.ENDPOINT_LOGOUT)
|
||||
public ModelAndView logout(HttpServletRequest request , HttpServletResponse response,
|
||||
@RequestParam(value = CasConstants.PARAMETER.SERVICE , required = false) String casService){
|
||||
StringBuffer logoutUrl = new StringBuffer("/force/logout");
|
||||
if(StringUtils.isNotBlank(casService)){
|
||||
logoutUrl.append("?").append("redirect_uri=").append(casService);
|
||||
}
|
||||
return WebContext.forward(logoutUrl.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.maxkey.authz.cas.endpoint;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.maxkey.authz.cas.endpoint.ticket.CasConstants;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
/**
|
||||
* @author Crystal.Sea
|
||||
* https://apereo.github.io/cas/6.2.x/protocol/CAS-Protocol.html
|
||||
*/
|
||||
@Tag(name = "2-3-CAS API文档模块")
|
||||
@Controller
|
||||
public class CasLogoutEndpoint extends CasBaseAuthorizeEndpoint{
|
||||
|
||||
final static Logger _logger = LoggerFactory.getLogger(CasLogoutEndpoint.class);
|
||||
|
||||
/**
|
||||
* for cas logout then redirect to logout
|
||||
* @param request
|
||||
* @param response
|
||||
* @param casService
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "CAS注销接口", description = "CAS注销接口",method="GET")
|
||||
@RequestMapping(CasConstants.ENDPOINT.ENDPOINT_LOGOUT)
|
||||
public ModelAndView logout(HttpServletRequest request , HttpServletResponse response,
|
||||
@RequestParam(value = CasConstants.PARAMETER.SERVICE , required = false) String casService){
|
||||
StringBuffer logoutUrl = new StringBuffer("/force/logout");
|
||||
if(StringUtils.isNotBlank(casService)){
|
||||
logoutUrl.append("?").append("redirect_uri=").append(casService);
|
||||
}
|
||||
return WebContext.forward(logoutUrl.toString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user