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)
| 136 | // 200 OK and the JSON session object. For invalid credentials, the HTML login prompt form |
| 137 | // is sent. |
| 138 | func (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. |
nothing calls this directly
no test coverage detected