src/server/auth/server/saml.go
func (a *apiServer) handleSAMLResponse(w http.ResponseWriter, req *http.Request) {
	var subject, authCode string
	var err *errutil.HTTPError

	logRequest := "SAML login request"
	a.LogReq(logRequest)
	defer func(start time.Time) {
		if subject != "" {
			logRequest = fmt.Sprintf("SAML login request for %s", subject)
		}
		a.LogResp(logRequest, errutil.PrettyPrintCode(err), err, time.Since(start))
	}(time.Now())

	subject, authCode, err = a.handleSAMLResponseInternal(req)
	if err != nil {
		http.Error(w, err.Error(), err.Code())
		return
	}

	// Redirect caller back to dash with auth code
	u := *defaultDashRedirectURL
	if a.redirectAddress != nil {
		u = *a.redirectAddress
	}
	u.RawQuery = url.Values{"auth_code": []string{authCode}}.Encode()
	w.Header().Set("Location", u.String())
	w.WriteHeader(http.StatusFound) // Send redirect
}
func (a *apiServer) handleSAMLResponse(w http.ResponseWriter, req *http.Request) {
	var subject, authCode string
	var err *errutil.HTTPError

	logRequest := "SAML login request"
	a.LogReq(logRequest)
	defer func(start time.Time) {
		if subject != "" {
			logRequest = fmt.Sprintf("SAML login request for %s", subject)
		}
		a.LogResp(logRequest, errutil.PrettyPrintCode(err), err, time.Since(start))
	}(time.Now())

	subject, authCode, err = a.handleSAMLResponseInternal(req)
	if err != nil {
		http.Error(w, err.Error(), err.Code())
		return
	}

	// Redirect caller back to dash with auth code
	u := *defaultDashRedirectURL
	if a.redirectAddress != nil {
		u = *a.redirectAddress
	}
	u.RawQuery = url.Values{"auth_code": []string{authCode}}.Encode()
	w.Header().Set("Location", u.String())
	w.WriteHeader(http.StatusFound) // Send redirect
}
// handleSAMLResponse is the HTTP handler for Pachyderm's ACS, which receives
// signed SAML assertions from this cluster's SAML ID provider (if one is
// configured)