Skip to content

Commit

Permalink
Fix url prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kovayur committed May 15, 2024
1 parent b8f7468 commit c4a49d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/dinosaur/pkg/handlers/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ type compositeAuthenticationHandler struct {
adminAPIHandler http.Handler
}

var (
adminAPIPrefix = fmt.Sprintf("^%s/%s/%s%s", routes.APIEndpoint, routes.FleetManagementAPIPrefix, routes.Version, routes.AdminAPIPrefix)
privateAPIPrefix = fmt.Sprintf("^%s/%s/%s%s", routes.APIEndpoint, routes.FleetManagementAPIPrefix, routes.Version, routes.PrivateAPIPrefix)
)

func (h *compositeAuthenticationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(r.URL.Path, routes.AdminAPIPrefix) {
if strings.HasPrefix(r.URL.Path, adminAPIPrefix) {
h.adminAPIHandler.ServeHTTP(w, r)
return
}
if strings.HasPrefix(r.URL.Path, routes.PrivateAPIPrefix) {
if strings.HasPrefix(r.URL.Path, privateAPIPrefix) {
h.privateAPIHandler.ServeHTTP(w, r)
return
}
Expand Down

0 comments on commit c4a49d3

Please sign in to comment.