mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-07 02:20:28 +08:00
Support regex in CheckRedirectUriValid()
This commit is contained in:
@@ -17,6 +17,7 @@ package object
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/casdoor/casdoor/util"
|
"github.com/casdoor/casdoor/util"
|
||||||
@@ -322,7 +323,8 @@ func (application *Application) GetId() string {
|
|||||||
func CheckRedirectUriValid(application *Application, redirectUri string) bool {
|
func CheckRedirectUriValid(application *Application, redirectUri string) bool {
|
||||||
validUri := false
|
validUri := false
|
||||||
for _, tmpUri := range application.RedirectUris {
|
for _, tmpUri := range application.RedirectUris {
|
||||||
if strings.Contains(redirectUri, tmpUri) {
|
tmpUriRegex := regexp.MustCompile(tmpUri)
|
||||||
|
if tmpUriRegex.MatchString(redirectUri) || strings.Contains(redirectUri, tmpUri) {
|
||||||
validUri = true
|
validUri = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user