feat: glob support for RedirectURIs

This commit is contained in:
David Sharnoff 2023-02-28 17:24:30 -08:00
parent 815ced424c
commit 8da9b5f665
6 changed files with 81 additions and 14 deletions

View file

@ -5,6 +5,8 @@ import (
"net/http"
"net/url"
"github.com/gobwas/glob"
httphelper "github.com/zitadel/oidc/pkg/http"
"github.com/zitadel/oidc/pkg/oidc"
)
@ -98,5 +100,16 @@ func ValidateEndSessionPostLogoutRedirectURI(postLogoutRedirectURI string, clien
return nil
}
}
if globClient, ok := client.(HasRedirectGlobs); ok {
for _, uriGlob := range globClient.PostLogoutRedirectURIGlobs() {
matcher, err := glob.Compile(uriGlob)
if err != nil {
return oidc.ErrServerError().WithParent(err)
}
if matcher.Match(postLogoutRedirectURI) {
return nil
}
}
}
return oidc.ErrInvalidRequest().WithDescription("post_logout_redirect_uri invalid")
}