fixed allowedRedirectURI
This commit is contained in:
+13
-3
@@ -8,16 +8,26 @@ import (
|
||||
|
||||
func IsAllowedRedirectURI(uri string) bool {
|
||||
allowedRedirectURIsEnv := os.Getenv("ALLOWED_REDIRECT_URIS")
|
||||
log.Print("Checking redirect URI: ", uri)
|
||||
log.Print("Allowed Redirect URIs (raw): ", allowedRedirectURIsEnv)
|
||||
|
||||
if allowedRedirectURIsEnv == "" {
|
||||
log.Print("ERROR: ALLOWED_REDIRECT_URIS environment variable is empty")
|
||||
return false
|
||||
}
|
||||
|
||||
allowedRedirectURIs := strings.Split(allowedRedirectURIsEnv, ",")
|
||||
for _, allowed := range allowedRedirectURIs {
|
||||
if uri == strings.TrimSpace(allowed) {
|
||||
log.Print("Parsed allowed URIs count: ", len(allowedRedirectURIs))
|
||||
|
||||
for i, allowed := range allowedRedirectURIs {
|
||||
trimmed := strings.TrimSpace(allowed)
|
||||
log.Printf(" [%d] Comparing '%s' with '%s'", i, uri, trimmed)
|
||||
if uri == trimmed {
|
||||
log.Print("✓ Redirect URI allowed: ", uri)
|
||||
return true
|
||||
}
|
||||
}
|
||||
log.Print("Redirect URI not allowed: ", uri)
|
||||
|
||||
log.Print("✗ Redirect URI not allowed: ", uri)
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user