use client for user create action
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -37,7 +37,7 @@ func NewHTTPServer(cfg *gpaste.ServerConfig) *HTTPServer {
|
||||
|
||||
// Create initial user
|
||||
// TODO: Do properly
|
||||
user := &users.User{Username: "admin"}
|
||||
user := &users.User{Username: "admin", Role: users.RoleAdmin}
|
||||
user.SetPassword("admin")
|
||||
srv.Users.Store(user)
|
||||
|
||||
|
@@ -71,7 +71,7 @@ func (s *HTTPServer) MiddlewareAuthentication(next http.Handler) http.Handler {
|
||||
ctx = context.WithValue(ctx, authCtxAuthLevel, claims.Role)
|
||||
ctx = context.WithValue(ctx, authCtxClaims, claims)
|
||||
withCtx := r.WithContext(ctx)
|
||||
s.Logger.Debugw("Request is authenticated.", "req_id", reqID, "username", claims.Subject)
|
||||
s.Logger.Debugw("Request is authenticated.", "req_id", reqID, "username", claims.Subject, "role", claims.Role)
|
||||
|
||||
next.ServeHTTP(w, withCtx)
|
||||
}
|
||||
|
Reference in New Issue
Block a user