Skip to content

Commit 5fb80bb

Browse files
authored
Merge pull request #146 from nuts-foundation/fix-double-slashes
Fix double slashes in redirect URL, if base URL ends with a slash
2 parents 55d7fa1 + c60a937 commit 5fb80bb

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

oidc/oidc.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ func Setup(config Config, baseURL string, e *echo.Echo, authConfig AuthConfig) e
3030
baseURL: baseURL,
3131
}
3232

33-
if o.baseURL == "" {
34-
o.baseURL = "/"
35-
}
36-
o.signInUrl = fmt.Sprintf("%s/auth/%s", o.baseURL, name)
37-
o.callbackURL = fmt.Sprintf("%s/auth/%s/callback", o.baseURL, name)
33+
normalizedBaseUrl := strings.TrimRight(baseURL, "/")
34+
o.signInUrl = fmt.Sprintf("%s/auth/%s", normalizedBaseUrl, name)
35+
o.callbackURL = fmt.Sprintf("%s/auth/%s/callback", normalizedBaseUrl, name)
3836

3937
authConfig.redirectURL = o.signInUrl
4038

0 commit comments

Comments
 (0)