22 lines
421 B
Go
22 lines
421 B
Go
package handlers
|
|
|
|
import (
|
|
"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) { // Exact match only
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|