git.iko.soy/typeable/oauth2-proxy
on master help sign in
handle sign in directly (if using htpasswd)
c97de52Jehiah Czebotar
oauthproxy.go+8−8
@@ -201,19 +201,19 @@ func (p *OauthProxy) SignInPage(rw http.ResponseWriter, req *http.Request, code
201 p.ClearCookie(rw, req)
201 p.ClearCookie(rw, req)
202 rw.WriteHeader(code)
202 rw.WriteHeader(code)
203 templates := getTemplates()
203 templates := getTemplates()
204−
204+
205− t := struct{
205+ t := struct {
206 SignInMessage string
206 SignInMessage string
207− Htpasswd bool
207+ Htpasswd bool
208 }{
208 }{
209− SignInMessage: p.SignInMessage,
209+ SignInMessage: p.SignInMessage,
210− Htpasswd: p.HtpasswdFile != nil,
210+ Htpasswd: p.HtpasswdFile != nil,
211 }
211 }
212 templates.ExecuteTemplate(rw, "sign_in.html", t)
212 templates.ExecuteTemplate(rw, "sign_in.html", t)
213}
213}
214
214
215−func (p *OauthProxy) ManualSignIn(rw http.ResponseWriter, req *http.Request) (string, bool){
215+func (p *OauthProxy) ManualSignIn(rw http.ResponseWriter, req *http.Request) (string, bool) {
216− if req.Method != "POST" || p.HtpasswdFile == nil{
216+ if req.Method != "POST" || p.HtpasswdFile == nil {
217 return "", false
217 return "", false
218 }
218 }
219 user := req.FormValue("username")
219 user := req.FormValue("username")
@@ -236,7 +236,7 @@ func (p *OauthProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
236 remoteIP = req.RemoteAddr
236 remoteIP = req.RemoteAddr
237 }
237 }
238 log.Printf("%s %s %s", remoteIP, req.Method, req.URL.Path)
238 log.Printf("%s %s %s", remoteIP, req.Method, req.URL.Path)
239−
239+
240 var ok bool
240 var ok bool
241 var user string
241 var user string
242 if req.URL.Path == signInPath {
242 if req.URL.Path == signInPath {