refac: removed 7 direct and 12 indirect go modules for custom code instead
This commit is contained in:
1 parent
cfcf108488
commit
c68e9a7858
73 files changed
+2455
-428
No files matched your search
@@ -23,8 +23,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"RenewCMS/api/pkg/authtoken"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/jwtauth/v5"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -44,7 +44,7 @@ type activityHTTPEnv struct {
|
||||
keys *mockAPIKeyRepo
|
||||
articles *mockArticleRepo
|
||||
mail *mockMailRepo
|
||||
token *jwtauth.JWTAuth
|
||||
token *authtoken.Auth
|
||||
generator *hashing.SHA256KeyGenerator
|
||||
router http.Handler
|
||||
}
|
||||
@@ -59,7 +59,7 @@ func newActivityHTTPEnv(t *testing.T, attempts int) *activityHTTPEnv {
|
||||
keys: newMockAPIKeyRepo(),
|
||||
articles: newMockArticleRepo(),
|
||||
mail: newMockMailRepo(),
|
||||
token: jwtauth.New("HS256", []byte("test-secret"), nil),
|
||||
token: authtoken.New([]byte("test-secret")),
|
||||
generator: hashing.NewSHA256KeyGenerator(),
|
||||
}
|
||||
e.users.users[activityOwnerID] = user.User{ID: activityOwnerID, Username: "marta", DisplayName: "Marta Alves", Email: "marta@example.com", Password: "hashed:" + activityPassword, IsVerified: true, Role: user.RoleOwner}
|
||||
@@ -99,7 +99,7 @@ type activityRequest func(*http.Request)
|
||||
|
||||
func asUser(e *activityHTTPEnv, id uint32) activityRequest {
|
||||
return func(r *http.Request) {
|
||||
_, tokenString, _ := e.token.Encode(map[string]any{"user_id": id, "token_version": 0})
|
||||
tokenString, _ := e.token.Encode(map[string]any{"user_id": id, "token_version": 0})
|
||||
r.AddCookie(&http.Cookie{Name: "jwt", Value: tokenString})
|
||||
}
|
||||
}
|
||||
@@ -1037,7 +1037,7 @@ func TestActivityLogBackendAuditContext(t *testing.T) {
|
||||
t.Helper()
|
||||
probe := &auditOriginProbe{}
|
||||
r := chi.NewRouter()
|
||||
r.Use(jwtauth.Verifier(e.token))
|
||||
r.Use(authtoken.Verifier(e.token))
|
||||
r.Use(middleware.APIKeyAuth(useCases.NewAuthenticateAPIKeyUseCase(e.keys, e.generator, e.users, e.clock), 100, time.Minute))
|
||||
r.Use(middleware.AuditContext(useCases.NewGetUserUseCase(e.users), trusted))
|
||||
r.Get("/probe", func(w http.ResponseWriter, req *http.Request) {
|
||||
|
||||
Reference in new issue
Block a user