Skip to content

Commit

Permalink
[v10] Remove deprecated GenerateUserCerts HTTP endpoint (#15412)
Browse files Browse the repository at this point in the history
Remove deprecated GenerateUserCerts HTTP endpoint

Co-authored-by: Brian Joerger <[email protected]>
  • Loading branch information
strideynet and Joerger authored Aug 11, 2022
1 parent b5266f1 commit c2831a2
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions lib/auth/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ func NewAPIServer(config *APIConfig) (http.Handler, error) {

// Generating certificates for user and host authorities
srv.POST("/:version/ca/host/certs", srv.withAuth(srv.generateHostCert))
srv.POST("/:version/ca/user/certs", srv.withAuth(srv.generateUserCert)) // DELETE IN: 4.2.0

// Operations on users
srv.GET("/:version/users", srv.withAuth(srv.getUsers))
Expand Down Expand Up @@ -500,36 +499,6 @@ func (s *APIServer) getWebSession(auth ClientI, w http.ResponseWriter, r *http.R
return rawMessage(services.MarshalWebSession(sess, services.WithVersion(version)))
}

// DELETE IN: 4.2.0
type generateUserCertReq struct {
Key []byte `json:"key"`
User string `json:"user"`
TTL time.Duration `json:"ttl"`
Compatibility string `json:"compatibility,omitempty"`
}

// DELETE IN: 4.2.0
func (s *APIServer) generateUserCert(auth ClientI, w http.ResponseWriter, r *http.Request, _ httprouter.Params, version string) (interface{}, error) {
var req *generateUserCertReq
if err := httplib.ReadJSON(r, &req); err != nil {
return nil, trace.Wrap(err)
}
certificateFormat, err := utils.CheckCertificateFormatFlag(req.Compatibility)
if err != nil {
return nil, trace.Wrap(err)
}
certs, err := auth.GenerateUserCerts(r.Context(), proto.UserCertsRequest{
PublicKey: req.Key,
Username: req.User,
Expires: s.Now().UTC().Add(req.TTL),
Format: certificateFormat,
})
if err != nil {
return nil, trace.Wrap(err)
}
return string(certs.SSH), nil
}

type WebSessionReq struct {
// User is the user name associated with the session id.
User string `json:"user"`
Expand Down

0 comments on commit c2831a2

Please sign in to comment.