MCPcopy Create free account
hub / github.com/crewjam/saml / HandleLogin

Method HandleLogin

samlidp/session.go:138–148  ·  view source on GitHub ↗

HandleLogin handles the `POST /login` and `GET /login` forms. If credentials are present in the request body, then they are validated. For valid credentials, the response is a 200 OK and the JSON session object. For invalid credentials, the HTML login prompt form is sent.

(c web.C, w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

136// 200 OK and the JSON session object. For invalid credentials, the HTML login prompt form
137// is sent.
138func (s *Server) HandleLogin(c web.C, w http.ResponseWriter, r *http.Request) {
139 if err := r.ParseForm(); err != nil {
140 http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
141 return
142 }
143 session := s.GetSession(w, r, &saml.IdpAuthnRequest{IDP: &s.IDP})
144 if session == nil {
145 return
146 }
147 json.NewEncoder(w).Encode(session)
148}
149
150// HandleListSessions handles the `GET /sessions/` request and responds with a JSON formatted list
151// of session names.

Callers

nothing calls this directly

Calls 3

GetSessionMethod · 0.95
EncodeMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected