From fe647939cec5b37d52c2e158b53ff1f6012dd60f Mon Sep 17 00:00:00 2001 From: rune Date: Tue, 11 Apr 2023 19:26:57 +0800 Subject: [PATCH] fix: fix CAS callback url not match bug (#1728) Co-authored-by: mfk --- controllers/cas.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/controllers/cas.go b/controllers/cas.go index f2e6bf7e..898a7510 100644 --- a/controllers/cas.go +++ b/controllers/cas.go @@ -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