Skip to content

Commit

Permalink
Complete deprecation for SSO Auth Request http endpoints - #13073.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joerger committed Oct 5, 2022
1 parent 2a12068 commit d309917
Showing 1 changed file with 1 addition and 67 deletions.
68 changes: 1 addition & 67 deletions lib/auth/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,9 @@ func NewAPIServer(config *APIConfig) (http.Handler, error) {
srv.DELETE("/:version/configuration/static_tokens", srv.withAuth(srv.deleteStaticTokens))
srv.POST("/:version/configuration/static_tokens", srv.withAuth(srv.setStaticTokens))

// OIDC
srv.POST("/:version/oidc/requests/create", srv.withAuth(srv.createOIDCAuthRequest)) // DELETE in 11.0.0
// SSO validation handlers
srv.POST("/:version/oidc/requests/validate", srv.withAuth(srv.validateOIDCAuthCallback))

// SAML handlers
srv.POST("/:version/saml/requests/create", srv.withAuth(srv.createSAMLAuthRequest)) // DELETE in 11.0.0
srv.POST("/:version/saml/requests/validate", srv.withAuth(srv.validateSAMLResponse))

// Github connector
srv.POST("/:version/github/requests/create", srv.withAuth(srv.createGithubAuthRequest)) // DELETE in 11.0.0
srv.POST("/:version/github/requests/validate", srv.withAuth(srv.validateGithubAuthCallback))

// Audit logs AKA events
Expand Down Expand Up @@ -843,23 +836,6 @@ func (s *APIServer) deleteCertAuthority(auth ClientI, w http.ResponseWriter, r *
return message(fmt.Sprintf("cert '%v' deleted", id)), nil
}

type createOIDCAuthRequestReq struct {
Req types.OIDCAuthRequest `json:"req"`
}

// DELETE IN 11.0.0
func (s *APIServer) createOIDCAuthRequest(auth ClientI, w http.ResponseWriter, r *http.Request, p httprouter.Params, version string) (interface{}, error) {
var req *createOIDCAuthRequestReq
if err := httplib.ReadJSON(r, &req); err != nil {
return nil, trace.Wrap(err)
}
response, err := auth.CreateOIDCAuthRequest(r.Context(), req.Req)
if err != nil {
return nil, trace.Wrap(err)
}
return response, nil
}

type validateOIDCAuthCallbackReq struct {
Query url.Values `json:"query"`
}
Expand Down Expand Up @@ -918,23 +894,6 @@ func (s *APIServer) validateOIDCAuthCallback(auth ClientI, w http.ResponseWriter
return &raw, nil
}

type createSAMLAuthRequestReq struct {
Req types.SAMLAuthRequest `json:"req"`
}

// DELETE IN 11.0.0
func (s *APIServer) createSAMLAuthRequest(auth ClientI, w http.ResponseWriter, r *http.Request, p httprouter.Params, version string) (interface{}, error) {
var req *createSAMLAuthRequestReq
if err := httplib.ReadJSON(r, &req); err != nil {
return nil, trace.Wrap(err)
}
response, err := auth.CreateSAMLAuthRequest(r.Context(), req.Req)
if err != nil {
return nil, trace.Wrap(err)
}
return response, nil
}

type validateSAMLResponseReq struct {
Response string `json:"response"`
ConnectorID string `json:"connector_id,omitempty"`
Expand Down Expand Up @@ -994,31 +953,6 @@ func (s *APIServer) validateSAMLResponse(auth ClientI, w http.ResponseWriter, r
return &raw, nil
}

// createGithubAuthRequestReq is a request to start Github OAuth2 flow
type createGithubAuthRequestReq struct {
// Req is the request parameters
Req types.GithubAuthRequest `json:"req"`
}

/* createGithubAuthRequest creates a new request for Github OAuth2 flow
POST /:version/github/requests/create
Success response: types.GithubAuthRequest
*/
// DELETE IN 11.0.0
func (s *APIServer) createGithubAuthRequest(auth ClientI, w http.ResponseWriter, r *http.Request, p httprouter.Params, version string) (interface{}, error) {
var req createGithubAuthRequestReq
if err := httplib.ReadJSON(r, &req); err != nil {
return nil, trace.Wrap(err)
}
response, err := auth.CreateGithubAuthRequest(r.Context(), req.Req)
if err != nil {
return nil, trace.Wrap(err)
}
return response, nil
}

// validateGithubAuthCallbackReq is a request to validate Github OAuth2 callback
type validateGithubAuthCallbackReq struct {
// Query is the callback query string
Expand Down

0 comments on commit d309917

Please sign in to comment.