| OLD | NEW |
| 1 // login handles logging in users. | 1 // login handles logging in users. |
| 2 package login | 2 package login |
| 3 | 3 |
| 4 // Theory of operation. | 4 // Theory of operation. |
| 5 // | 5 // |
| 6 // We use OAuth 2.0 handle authentication. We are essentially doing OpenID | 6 // We use OAuth 2.0 handle authentication. We are essentially doing OpenID |
| 7 // Connect, but vastly simplified since we are hardcoded to Google's endpoints. | 7 // Connect, but vastly simplified since we are hardcoded to Google's endpoints. |
| 8 // | 8 // |
| 9 // We do a simple OAuth 2.0 flow where the user is asked to grant permission to | 9 // We do a simple OAuth 2.0 flow where the user is asked to grant permission to |
| 10 // the 'email' scope. See https://developers.google.com/+/api/oauth#email for | 10 // the 'email' scope. See https://developers.google.com/+/api/oauth#email for |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 // | 255 // |
| 256 func StatusHandler(w http.ResponseWriter, r *http.Request) { | 256 func StatusHandler(w http.ResponseWriter, r *http.Request) { |
| 257 glog.Infof("StatusHandler\n") | 257 glog.Infof("StatusHandler\n") |
| 258 w.Header().Set("Content-Type", "application/json") | 258 w.Header().Set("Content-Type", "application/json") |
| 259 enc := json.NewEncoder(w) | 259 enc := json.NewEncoder(w) |
| 260 body := map[string]string{ | 260 body := map[string]string{ |
| 261 "Email": LoggedInAs(r), | 261 "Email": LoggedInAs(r), |
| 262 "LoginURL": LoginURL(w, r), | 262 "LoginURL": LoginURL(w, r), |
| 263 } | 263 } |
| 264 if err := enc.Encode(body); err != nil { | 264 if err := enc.Encode(body); err != nil { |
| 265 » » glog.Errorf("Failed to encode Login status to JSON", err) | 265 » » glog.Errorf("Failed to encode Login status to JSON: %s", err) |
| 266 } | 266 } |
| 267 } | 267 } |
| OLD | NEW |