diff --git a/ipn/localapi/localapi.go b/ipn/localapi/localapi.go index 699758d3e..e8beb8616 100644 --- a/ipn/localapi/localapi.go +++ b/ipn/localapi/localapi.go @@ -109,6 +109,8 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { h.serveStatus(w, r) case "/localapi/v0/logout": h.serveLogout(w, r) + case "/localapi/v0/login-interactive": + h.serveLoginInteractive(w, r) case "/localapi/v0/prefs": h.servePrefs(w, r) case "/localapi/v0/ping": @@ -343,6 +345,20 @@ func (h *Handler) serveStatus(w http.ResponseWriter, r *http.Request) { e.Encode(st) } +func (h *Handler) serveLoginInteractive(w http.ResponseWriter, r *http.Request) { + if !h.PermitWrite { + http.Error(w, "login access denied", http.StatusForbidden) + return + } + if r.Method != "POST" { + http.Error(w, "want POST", 400) + return + } + h.b.StartLoginInteractive() + w.WriteHeader(http.StatusNoContent) + return +} + func (h *Handler) serveLogout(w http.ResponseWriter, r *http.Request) { if !h.PermitWrite { http.Error(w, "logout access denied", http.StatusForbidden)