Skip to content

Commit

Permalink
Merge pull request #146 from nuts-foundation/fix-double-slashes
Browse files Browse the repository at this point in the history
Fix double slashes in redirect URL, if base URL ends with a slash
  • Loading branch information
reinkrul authored Jan 25, 2025
2 parents 55d7fa1 + c60a937 commit 5fb80bb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions oidc/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ func Setup(config Config, baseURL string, e *echo.Echo, authConfig AuthConfig) e
baseURL: baseURL,
}

if o.baseURL == "" {
o.baseURL = "/"
}
o.signInUrl = fmt.Sprintf("%s/auth/%s", o.baseURL, name)
o.callbackURL = fmt.Sprintf("%s/auth/%s/callback", o.baseURL, name)
normalizedBaseUrl := strings.TrimRight(baseURL, "/")
o.signInUrl = fmt.Sprintf("%s/auth/%s", normalizedBaseUrl, name)
o.callbackURL = fmt.Sprintf("%s/auth/%s/callback", normalizedBaseUrl, name)

authConfig.redirectURL = o.signInUrl

Expand Down

0 comments on commit 5fb80bb

Please sign in to comment.