Files
Authentication/handlers/redirect.go
T
2026-01-07 15:32:30 +08:00

24 lines
454 B
Go

package handlers
import (
"log"
"os"
"strings"
)
func IsAllowedRedirectURI(uri string) bool {
allowedRedirectURIsEnv := os.Getenv("ALLOWED_REDIRECT_URIS")
if allowedRedirectURIsEnv == "" {
return false
}
allowedRedirectURIs := strings.Split(allowedRedirectURIsEnv, ",")
for _, allowed := range allowedRedirectURIs {
if uri == strings.TrimSpace(allowed) {
return true
}
}
log.Print("Redirect URI not allowed: ", uri)
return false
}