fix: fix CAS callback url not match bug (#1728)

Co-authored-by: mfk <mfk@hengwei.com.cn>
This commit is contained in:
rune
2023-04-11 19:26:57 +08:00
committed by GitHub
parent 984a69cb4b
commit fe647939ce

View File

@ -72,6 +72,11 @@ func (c *RootController) CasProxyValidate() {
c.CasP3ServiceAndProxyValidate()
}
func queryUnescape(service string) string {
s, _ := url.QueryUnescape(service)
return s
}
func (c *RootController) CasP3ServiceAndProxyValidate() {
ticket := c.Input().Get("ticket")
format := c.Input().Get("format")
@ -91,7 +96,7 @@ func (c *RootController) CasP3ServiceAndProxyValidate() {
// find the token
if ok {
// check whether service is the one for which we previously issued token
if strings.HasPrefix(service, issuedService) {
if strings.HasPrefix(service, issuedService) || strings.HasPrefix(queryUnescape(service), issuedService) {
serviceResponse.Success = response
} else {
// service not match