Implement http.Handler interface
(w http.ResponseWriter, r *http.Request)
| 211 | |
| 212 | // Implement http.Handler interface |
| 213 | func (h oauthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
| 214 | if resp := h.H(h.svc, w, r); resp != nil { |
| 215 | if resp.redirectURL != nil { |
| 216 | http.Redirect(w, r, resp.redirectURL.String(), http.StatusTemporaryRedirect) |
| 217 | return |
| 218 | } |
| 219 | http.Error(w, resp.ErrorMessage(h.svc.log), resp.code) |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | func loginHandler(svc *AuthService, w http.ResponseWriter, r *http.Request) *oauthResp { |
| 224 | b := make([]byte, 16) |