commit
6111a2559e
6 changed files with 10 additions and 16 deletions
|
@ -71,7 +71,7 @@ func Handler(repos core.RepositoryStore) http.HandlerFunc {
|
|||
}
|
||||
|
||||
func encrypt(plaintext, key []byte) (ciphertext []byte, err error) {
|
||||
block, err := aes.NewCipher(key[:])
|
||||
block, err := aes.NewCipher(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ func HandleLogin(
|
|||
logger.Debugf("authentication successful")
|
||||
|
||||
session.Create(w, user)
|
||||
http.Redirect(w, r, redirect, 303)
|
||||
http.Redirect(w, r, redirect, http.StatusSeeOther)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,7 +199,7 @@ func synchronize(ctx context.Context, syncer core.Syncer, user *core.User) {
|
|||
}
|
||||
|
||||
func writeLoginError(w http.ResponseWriter, r *http.Request, err error) {
|
||||
http.Redirect(w, r, "/login/error?message="+err.Error(), 303)
|
||||
http.Redirect(w, r, "/login/error?message="+err.Error(), http.StatusSeeOther)
|
||||
}
|
||||
|
||||
func writeLoginErrorStr(w http.ResponseWriter, r *http.Request, s string) {
|
||||
|
|
|
@ -44,9 +44,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
user, _ := s.session.Get(r)
|
||||
switch {
|
||||
case !s.anonymous && user == nil:
|
||||
http.Error(w, errInvalidToken.Error(), 401)
|
||||
http.Error(w, errInvalidToken.Error(), http.StatusUnauthorized)
|
||||
case !s.anonymous && !user.Admin && !user.Machine:
|
||||
http.Error(w, errAccessDenied.Error(), 403)
|
||||
http.Error(w, errAccessDenied.Error(), http.StatusForbidden)
|
||||
default:
|
||||
s.metrics.ServeHTTP(w, r)
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ func getEncrypted(manifest *yaml.Manifest, match string) (data string, ok bool)
|
|||
}
|
||||
|
||||
func decrypt(ciphertext []byte, key []byte) (plaintext []byte, err error) {
|
||||
block, err := aes.NewCipher(key[:])
|
||||
block, err := aes.NewCipher(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ func getEncrypted(manifest *yaml.Manifest, match string) (data string, ok bool)
|
|||
}
|
||||
|
||||
func decrypt(ciphertext []byte, key []byte) (plaintext []byte, err error) {
|
||||
block, err := aes.NewCipher(key[:])
|
||||
block, err := aes.NewCipher(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -67,9 +67,7 @@ func (s Server) listenAndServe(ctx context.Context) error {
|
|||
|
||||
return s1.Shutdown(ctxShutdown)
|
||||
})
|
||||
g.Go(func() error {
|
||||
return s1.ListenAndServe()
|
||||
})
|
||||
g.Go(s1.ListenAndServe)
|
||||
return g.Wait()
|
||||
}
|
||||
|
||||
|
@ -83,9 +81,7 @@ func (s Server) listenAndServeTLS(ctx context.Context) error {
|
|||
Addr: ":https",
|
||||
Handler: s.Handler,
|
||||
}
|
||||
g.Go(func() error {
|
||||
return s1.ListenAndServe()
|
||||
})
|
||||
g.Go(s1.ListenAndServe)
|
||||
g.Go(func() error {
|
||||
return s2.ListenAndServeTLS(
|
||||
s.Cert,
|
||||
|
@ -134,9 +130,7 @@ func (s Server) listenAndServeAcme(ctx context.Context) error {
|
|||
MinVersion: tls.VersionTLS12,
|
||||
},
|
||||
}
|
||||
g.Go(func() error {
|
||||
return s1.ListenAndServe()
|
||||
})
|
||||
g.Go(s1.ListenAndServe)
|
||||
g.Go(func() error {
|
||||
return s2.ListenAndServeTLS("", "")
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue