Skip to content

Commit

Permalink
Revert "feat: add support for wildcard redirect uris"
Browse files Browse the repository at this point in the history
This reverts commit 3b9638f.
  • Loading branch information
its-felix committed Jul 12, 2024
1 parent 3b9638f commit b0e4170
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 342 deletions.
198 changes: 0 additions & 198 deletions util/urlmatch.go

This file was deleted.

129 changes: 0 additions & 129 deletions util/urlmatch_test.go

This file was deleted.

15 changes: 0 additions & 15 deletions web/dev_application_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package web

import (
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/binary"
"errors"
"github.com/gofrs/uuid/v5"
Expand Down Expand Up @@ -493,13 +491,6 @@ func preprocessRedirectURIs(applicationId, clientId uuid.UUID, redirectURIs []st
func validateRedirectURIs(redirectURIs []string) error {
var err error
for _, redirectURI := range redirectURIs {
originalRedirectURI := redirectURI
if strings.ContainsRune(redirectURI, '*') {
hashBytes := sha256.Sum256([]byte(redirectURI))
hash := base64.RawURLEncoding.EncodeToString(hashBytes[:])
redirectURI = strings.ReplaceAll(redirectURI, "*", "a"+hash+"z") // surround with "a" and "z" to ensure valid hostnames
}

u, parseErr := url.Parse(redirectURI)
if parseErr != nil {
err = errors.Join(err, parseErr)
Expand All @@ -513,12 +504,6 @@ func validateRedirectURIs(redirectURIs []string) error {
} else if u.Hostname() == "" {
err = errors.Join(err, errors.New("invalid hostname"))
}

if redirectURI != originalRedirectURI {
if !util.URLMatch(originalRedirectURI, u) {
err = errors.Join(err, errors.New("invalid pattern"))
}
}
}

return err
Expand Down

0 comments on commit b0e4170

Please sign in to comment.