Bump loofah from 2.2.3 to 2.3.1 in /apps/workbench
[arvados.git] / sdk / go / arvados / login.go
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: Apache-2.0
4
5 package arvados
6
7 import (
8         "bytes"
9         "net/http"
10 )
11
12 type LoginResponse struct {
13         RedirectLocation string
14         HTML             bytes.Buffer
15 }
16
17 func (resp LoginResponse) ServeHTTP(w http.ResponseWriter, req *http.Request) {
18         if resp.RedirectLocation != "" {
19                 w.Header().Set("Location", resp.RedirectLocation)
20                 w.WriteHeader(http.StatusFound)
21         } else {
22                 w.Write(resp.HTML.Bytes())
23         }
24 }