Skip to content
This repository has been archived by the owner on Dec 7, 2020. It is now read-only.

[KEYCLOAK-10633] Fix oauth uri slash issue when using base-uri #510

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ func newDefaultConfig() *Config {
// WithOAuthURI returns the oauth uri
func (r *Config) WithOAuthURI(uri string) string {
if r.BaseURI != "" {
return fmt.Sprintf("%s/%s/%s", r.BaseURI, r.OAuthURI, uri)
return fmt.Sprintf("%s%s%s", r.BaseURI, r.OAuthURI, uri)
}

return fmt.Sprintf("%s/%s", r.OAuthURI, uri)
return fmt.Sprintf("%s%s", r.OAuthURI, uri)
}

// isValid validates if the config is valid
Expand Down
3 changes: 2 additions & 1 deletion handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ func (r *oauthProxy) getRedirectionURL(w http.ResponseWriter, req *http.Request)
w.WriteHeader(http.StatusForbidden)
return ""
}
return fmt.Sprintf("%s%s", redirect, r.config.WithOAuthURI("callback"))

return fmt.Sprintf("%s%s", redirect, r.config.WithOAuthURI(callbackURL))
n1330 marked this conversation as resolved.
Show resolved Hide resolved
}

// oauthAuthorizationHandler is responsible for performing the redirection to oauth provider
Expand Down