Merge branch '21535-multi-wf-delete'
[arvados.git] / sdk / go / arvados / login.go
index 7107ac57ab76c029ccc28764762ad4b08de42bbe..ab7637546289a659651c9648907b0558cfe1c064 100644 (file)
@@ -10,8 +10,8 @@ import (
 )
 
 type LoginResponse struct {
-       RedirectLocation string
-       HTML             bytes.Buffer
+       RedirectLocation string       `json:"redirect_location,omitempty"`
+       HTML             bytes.Buffer `json:"-"`
 }
 
 func (resp LoginResponse) ServeHTTP(w http.ResponseWriter, req *http.Request) {
@@ -24,3 +24,12 @@ func (resp LoginResponse) ServeHTTP(w http.ResponseWriter, req *http.Request) {
                w.Write(resp.HTML.Bytes())
        }
 }
+
+type LogoutResponse struct {
+       RedirectLocation string `json:"redirect_location,omitempty"`
+}
+
+func (resp LogoutResponse) ServeHTTP(w http.ResponseWriter, req *http.Request) {
+       w.Header().Set("Location", resp.RedirectLocation)
+       w.WriteHeader(http.StatusFound)
+}