Skip to content

Commit

Permalink
Add new SPIRE APIs with versioning and plurality (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
maia-iyer authored Jul 12, 2024
2 parents 5316c3f + eda344f commit 65cbbe6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions api/agent/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func (s *Server) verificationMiddleware(next http.Handler) http.Handler {
cors(w, r)
return
}

userInfo := s.Authenticator.AuthenticateRequest(r)

err := s.Authorizer.AuthorizeRequest(r, userInfo)
Expand Down Expand Up @@ -586,6 +586,17 @@ func (s *Server) GetRouter() http.Handler {
apiRtr.HandleFunc("/api/entry/create", s.entryCreate)
apiRtr.HandleFunc("/api/entry/delete", s.entryDelete)

// Spire APIs with versioning
apiRtr.HandleFunc("/api/v1/spire/debugserver", s.debugServer)
apiRtr.HandleFunc("/api/v1/spire/healthcheck", s.healthcheck)
apiRtr.HandleFunc("/api/v1/spire/agents/list", s.agentList)
apiRtr.HandleFunc("/api/v1/spire/agents/ban", s.agentBan)
apiRtr.HandleFunc("/api/v1/spire/agents/delete", s.agentDelete)
apiRtr.HandleFunc("/api/v1/spire/agents/createjointoken", s.agentCreateJoinToken)
apiRtr.HandleFunc("/api/v1/spire/entries/list", s.entryList)
apiRtr.HandleFunc("/api/v1/spire/entries/create", s.entryCreate)
apiRtr.HandleFunc("/api/v1/spire/entries/delete", s.entryDelete)

// Tornjak specific
apiRtr.HandleFunc("/api/tornjak/serverinfo", s.tornjakGetServerInfo)
// Agents Selectors
Expand Down Expand Up @@ -636,7 +647,7 @@ func (s *Server) HandleRequests() {

// TODO: replace with workerGroup for thread safety
errChannel := make(chan error, 2)

serverConfig := s.TornjakConfig.Server
if serverConfig.HTTPConfig == nil {
err = fmt.Errorf("HTTP Config error: no port configured")
Expand Down

0 comments on commit 65cbbe6

Please sign in to comment.