diff --git a/Makefile b/Makefile index 6159270..49e177b 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ build: .PHONY: dev dev: build - srepanel/srepanel -config test_config.json + srepanel/srepanel -dev -config test_config.json .PHONY: jaas jaas: diff --git a/srepanel/web/auth.go b/srepanel/web/auth.go index 278c8fd..3748efb 100644 --- a/srepanel/web/auth.go +++ b/srepanel/web/auth.go @@ -25,6 +25,21 @@ func (s *Server) handleLogin(wr http.ResponseWriter, req *http.Request) { panic(err) } case http.MethodPost: + if s.Config.Dev { + ident := &common.Identity{ + ID: 1, + Username: "testuser", + } + http.SetCookie(wr, &http.Cookie{ + Name: "token", + Value: s.Issuer.Issue(ident), + Path: "/", + HttpOnly: true, + Secure: true, + }) + http.Redirect(wr, req, "/", http.StatusTemporaryRedirect) + return + } authURL := s.Auth.AuthURL() http.Redirect(wr, req, authURL, http.StatusTemporaryRedirect) default: