Skip to content

Commit

Permalink
Add comment for ContainsRedirectURI about the exact match (go-gitea#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang authored Apr 13, 2024
1 parent c28bed2 commit 92e27e1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions models/auth/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ func (app *OAuth2Application) TableName() string {

// ContainsRedirectURI checks if redirectURI is allowed for app
func (app *OAuth2Application) ContainsRedirectURI(redirectURI string) bool {
// OAuth2 requires the redirect URI to be an exact match, no dynamic parts are allowed.
// https://stackoverflow.com/questions/55524480/should-dynamic-query-parameters-be-present-in-the-redirection-uri-for-an-oauth2
// https://www.rfc-editor.org/rfc/rfc6819#section-5.2.3.3
// https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
// https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics-12#section-3.1
contains := func(s string) bool {
s = strings.TrimSuffix(strings.ToLower(s), "/")
for _, u := range app.RedirectURIs {
Expand Down

0 comments on commit 92e27e1

Please sign in to comment.