Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
121f63f57a |
No files matched your search
@@ -1,3 +1,6 @@
|
|||||||
|
### v6.3.0
|
||||||
|
* убрана интеграция с LDAP
|
||||||
|
* исправлен сброс разблокировки и назначения ролей на пользователя
|
||||||
### v6.2.6
|
### v6.2.6
|
||||||
* добавлен `Dockerfile` и скрипт для сборки и публикации образа в `GitHub Contaier Registry`
|
* добавлен `Dockerfile` и скрипт для сборки и публикации образа в `GitHub Contaier Registry`
|
||||||
* обновлены зависимости
|
* обновлены зависимости
|
||||||
|
|||||||
@@ -16,10 +16,8 @@ import (
|
|||||||
"github.com/txix-open/isp-kit/http/httpclix"
|
"github.com/txix-open/isp-kit/http/httpclix"
|
||||||
"github.com/txix-open/isp-kit/log"
|
"github.com/txix-open/isp-kit/log"
|
||||||
"msp-admin-service/conf"
|
"msp-admin-service/conf"
|
||||||
ldapRepo "msp-admin-service/repository/ldap"
|
|
||||||
"msp-admin-service/service/delete_old_audit_worker"
|
"msp-admin-service/service/delete_old_audit_worker"
|
||||||
"msp-admin-service/service/inactive_worker"
|
"msp-admin-service/service/inactive_worker"
|
||||||
"msp-admin-service/service/ldap"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Assembly struct {
|
type Assembly struct {
|
||||||
@@ -65,13 +63,7 @@ func (a *Assembly) ReceiveConfig(ctx context.Context, remoteConfig []byte) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
locator := NewLocator(a.logger, a.httpCli, a.db)
|
locator := NewLocator(a.logger, a.httpCli, a.db)
|
||||||
config := locator.Config(ctx, func(config *conf.Ldap) (ldap.Repo, error) {
|
config := locator.Config(ctx, newCfg, time.Minute)
|
||||||
repo, err := ldapRepo.NewRepository(config)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.WithMessage(err, "new repository")
|
|
||||||
}
|
|
||||||
return repo, nil
|
|
||||||
}, newCfg, time.Minute)
|
|
||||||
|
|
||||||
a.server.Upgrade(config.Handler)
|
a.server.Upgrade(config.Handler)
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import (
|
|||||||
"msp-admin-service/service"
|
"msp-admin-service/service"
|
||||||
"msp-admin-service/service/delete_old_audit_worker"
|
"msp-admin-service/service/delete_old_audit_worker"
|
||||||
"msp-admin-service/service/inactive_worker"
|
"msp-admin-service/service/inactive_worker"
|
||||||
"msp-admin-service/service/ldap"
|
|
||||||
"msp-admin-service/service/secure"
|
"msp-admin-service/service/secure"
|
||||||
"msp-admin-service/transaction"
|
"msp-admin-service/transaction"
|
||||||
)
|
)
|
||||||
@@ -49,7 +48,6 @@ type Config struct {
|
|||||||
//nolint:funlen
|
//nolint:funlen
|
||||||
func (l Locator) Config(
|
func (l Locator) Config(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
ldapRepoSupplier ldap.RepoSupplier,
|
|
||||||
cfg conf.Remote,
|
cfg conf.Remote,
|
||||||
jobPollInterval time.Duration,
|
jobPollInterval time.Duration,
|
||||||
) Config {
|
) Config {
|
||||||
@@ -68,8 +66,6 @@ func (l Locator) Config(
|
|||||||
|
|
||||||
txManager := transaction.NewManager(l.db)
|
txManager := transaction.NewManager(l.db)
|
||||||
|
|
||||||
ldapService := ldap.NewService(cfg.Ldap, ldapRepoSupplier, userRoleRepo, roleRepo, l.logger)
|
|
||||||
|
|
||||||
userService := service.NewUser(
|
userService := service.NewUser(
|
||||||
userRepo,
|
userRepo,
|
||||||
userRoleRepo,
|
userRoleRepo,
|
||||||
@@ -77,7 +73,6 @@ func (l Locator) Config(
|
|||||||
tokenRepo,
|
tokenRepo,
|
||||||
auditService,
|
auditService,
|
||||||
txManager,
|
txManager,
|
||||||
ldapService,
|
|
||||||
tokenService,
|
tokenService,
|
||||||
cfg.IdleTimeoutMs,
|
cfg.IdleTimeoutMs,
|
||||||
l.logger,
|
l.logger,
|
||||||
@@ -115,11 +110,9 @@ func (l Locator) Config(
|
|||||||
)
|
)
|
||||||
|
|
||||||
inactiveBlocker := inactive_worker.NewInactiveBlocker(
|
inactiveBlocker := inactive_worker.NewInactiveBlocker(
|
||||||
tokenRepo,
|
|
||||||
userRepo,
|
userRepo,
|
||||||
auditService,
|
auditService,
|
||||||
userRoleRepo,
|
userRoleRepo,
|
||||||
ldapService,
|
|
||||||
cfg.BlockInactiveWorker,
|
cfg.BlockInactiveWorker,
|
||||||
l.logger,
|
l.logger,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ type Remote struct {
|
|||||||
AntiBruteforce AntiBruteforce `schema:"Настройки антибрут для admin login"`
|
AntiBruteforce AntiBruteforce `schema:"Настройки антибрут для admin login"`
|
||||||
BlockInactiveWorker BlockInactiveWorker `validate:"required" schema:"Блокировка неактивных УЗ"`
|
BlockInactiveWorker BlockInactiveWorker `validate:"required" schema:"Блокировка неактивных УЗ"`
|
||||||
Permissions []Permission `schema:"Список разрешений"`
|
Permissions []Permission `schema:"Список разрешений"`
|
||||||
Ldap *Ldap `schema:"Настройки LDAP"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Audit struct {
|
type Audit struct {
|
||||||
@@ -73,10 +72,3 @@ type Permission struct {
|
|||||||
Key string
|
Key string
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Ldap struct {
|
|
||||||
Address string `validate:"required" schema:"Адрес LDAP"`
|
|
||||||
Username string `validate:"required" schema:"Пользователь сервисной УЗ"`
|
|
||||||
Password string `validate:"required" schema:"Пароль сервисной УЗ"`
|
|
||||||
BaseDn string `validate:"required"`
|
|
||||||
}
|
|
||||||
+11
-10
@@ -3,16 +3,17 @@ package entity
|
|||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
SudirUserId *string
|
SudirUserId *string
|
||||||
Id int64
|
Id int64
|
||||||
FirstName string
|
FirstName string
|
||||||
LastName string
|
LastName string
|
||||||
Description string
|
Description string
|
||||||
Email string
|
Email string
|
||||||
Password string
|
Password string
|
||||||
Blocked bool
|
Blocked bool
|
||||||
UpdatedAt time.Time
|
LastActiveAt time.Time
|
||||||
CreatedAt time.Time
|
UpdatedAt time.Time
|
||||||
|
CreatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
type SudirUser struct {
|
type SudirUser struct {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ go 1.24
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Masterminds/squirrel v1.5.4
|
github.com/Masterminds/squirrel v1.5.4
|
||||||
github.com/go-ldap/ldap/v3 v3.4.8
|
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/pkg/errors v0.9.1
|
github.com/pkg/errors v0.9.1
|
||||||
github.com/stretchr/testify v1.10.0
|
github.com/stretchr/testify v1.10.0
|
||||||
@@ -17,7 +16,6 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
|
|
||||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/buger/jsonparser v1.1.1 // indirect
|
github.com/buger/jsonparser v1.1.1 // indirect
|
||||||
@@ -27,7 +25,6 @@ require (
|
|||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
|
||||||
github.com/getsentry/sentry-go v0.32.0 // indirect
|
github.com/getsentry/sentry-go v0.32.0 // indirect
|
||||||
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
|
|
||||||
github.com/go-logr/logr v1.4.2 // indirect
|
github.com/go-logr/logr v1.4.2 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
|
||||||
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
|
||||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8=
|
|
||||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
|
|
||||||
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
|
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
|
||||||
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
|
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
|
||||||
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa h1:LHTHcTQiSGT7VVbI0o4wBRNQIgn917usHWOd6VAffYI=
|
|
||||||
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
|
||||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||||
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
|
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
|
||||||
@@ -31,12 +27,8 @@ github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBv
|
|||||||
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
|
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
|
||||||
github.com/getsentry/sentry-go v0.32.0 h1:YKs+//QmwE3DcYtfKRH8/KyOOF/I6Qnx7qYGNHCGmCY=
|
github.com/getsentry/sentry-go v0.32.0 h1:YKs+//QmwE3DcYtfKRH8/KyOOF/I6Qnx7qYGNHCGmCY=
|
||||||
github.com/getsentry/sentry-go v0.32.0/go.mod h1:CYNcMMz73YigoHljQRG+qPF+eMq8gG72XcGN/p71BAY=
|
github.com/getsentry/sentry-go v0.32.0/go.mod h1:CYNcMMz73YigoHljQRG+qPF+eMq8gG72XcGN/p71BAY=
|
||||||
github.com/go-asn1-ber/asn1-ber v1.5.5 h1:MNHlNMBDgEKD4TcKr36vQN68BA00aDfjIt3/bD50WnA=
|
|
||||||
github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
|
|
||||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||||
github.com/go-ldap/ldap/v3 v3.4.8 h1:loKJyspcRezt2Q3ZRMq2p/0v8iOurlmeXDPw6fikSvQ=
|
|
||||||
github.com/go-ldap/ldap/v3 v3.4.8/go.mod h1:qS3Sjlu76eHfHGpUdWkAXQTw4beih+cHsco2jXlIXrk=
|
|
||||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
@@ -60,13 +52,8 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX
|
|||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
|
||||||
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
|
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
|
||||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
|
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
|
||||||
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
|
||||||
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
|
|
||||||
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
|
||||||
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
|
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
|
||||||
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
||||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||||
@@ -77,18 +64,6 @@ github.com/jackc/pgx/v5 v5.7.4 h1:9wKznZrhWa2QiHL+NjTSPP6yjl3451BX3imWDnokYlg=
|
|||||||
github.com/jackc/pgx/v5 v5.7.4/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=
|
github.com/jackc/pgx/v5 v5.7.4/go.mod h1:ncY89UGWxg82EykZUwSpUKEfccBGGYq1xjrOpsbsfGQ=
|
||||||
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
|
github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo=
|
||||||
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
|
||||||
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
|
|
||||||
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
|
|
||||||
github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=
|
|
||||||
github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM=
|
|
||||||
github.com/jcmturner/gofork v1.7.6 h1:QH0l3hzAU1tfT3rZCnW5zXl+orbkNMMRGJfdJjHVETg=
|
|
||||||
github.com/jcmturner/gofork v1.7.6/go.mod h1:1622LH6i/EZqLloHfE7IeZ0uEJwMSUyQ/nDd82IeqRo=
|
|
||||||
github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o=
|
|
||||||
github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg=
|
|
||||||
github.com/jcmturner/gokrb5/v8 v8.4.4 h1:x1Sv4HaTpepFkXbt2IkL29DXRf8sOfZXo8eRKh687T8=
|
|
||||||
github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs=
|
|
||||||
github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY=
|
|
||||||
github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc=
|
|
||||||
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
|
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
|
||||||
github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY=
|
github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY=
|
||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
@@ -160,11 +135,9 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
|
|||||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
@@ -192,7 +165,6 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo
|
|||||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||||
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
||||||
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 h1:0tY123n7CdWMem7MOVdKOt0YfshufLCwfE5Bob+hQuM=
|
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 h1:0tY123n7CdWMem7MOVdKOt0YfshufLCwfE5Bob+hQuM=
|
||||||
@@ -221,63 +193,18 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
|||||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
|
||||||
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
|
||||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
|
||||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
|
||||||
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
||||||
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
||||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
|
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
|
||||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
|
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
|
||||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
|
||||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
|
||||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
|
||||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
|
||||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
|
||||||
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
|
||||||
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|
||||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
|
||||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
|
||||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
|
||||||
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
|
||||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
|
||||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
|
||||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2 h1:vPV0tzlsK6EzEDHNNH5sa7Hs9bd7iXR7B1tSiPepkV0=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2 h1:vPV0tzlsK6EzEDHNNH5sa7Hs9bd7iXR7B1tSiPepkV0=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:pKLAc5OolXC3ViWGI62vvC0n10CpwAtRcTNCFwTKBEw=
|
google.golang.org/genproto/googleapis/api v0.0.0-20250505200425-f936aa4a68b2/go.mod h1:pKLAc5OolXC3ViWGI62vvC0n10CpwAtRcTNCFwTKBEw=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 h1:IqsN8hx+lWLqlN+Sc3DoMy/watjofWiU8sRFgQ8fhKM=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250505200425-f936aa4a68b2 h1:IqsN8hx+lWLqlN+Sc3DoMy/watjofWiU8sRFgQ8fhKM=
|
||||||
@@ -291,7 +218,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
|
|||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
-- +goose Up
|
||||||
|
ALTER TABLE users
|
||||||
|
ADD COLUMN last_active_at TIMESTAMP DEFAULT (now() at time zone 'utc') NOT NULL;
|
||||||
|
|
||||||
|
-- +goose Down
|
||||||
|
ALTER TABLE users
|
||||||
|
DROP COLUMN last_active_at;
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
package ldap
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"net"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-ldap/ldap/v3"
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"msp-admin-service/conf"
|
|
||||||
"msp-admin-service/domain"
|
|
||||||
"msp-admin-service/entity"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
dialTimeout = 5 * time.Second
|
|
||||||
)
|
|
||||||
|
|
||||||
type Repository struct {
|
|
||||||
baseDn string
|
|
||||||
conn *ldap.Conn
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewRepository(config *conf.Ldap) (*Repository, error) {
|
|
||||||
if config == nil {
|
|
||||||
return nil, errors.New("ldap config is not initialized")
|
|
||||||
}
|
|
||||||
|
|
||||||
c, err := net.DialTimeout("tcp", config.Address, dialTimeout)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.WithMessagef(err, "net dial to %s", config.Address)
|
|
||||||
}
|
|
||||||
|
|
||||||
conn := ldap.NewConn(c, false)
|
|
||||||
conn.Start()
|
|
||||||
|
|
||||||
err = conn.Bind(config.Username, config.Password)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.WithMessagef(err, "ldap auth, username: %s", config.Username)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &Repository{
|
|
||||||
conn: conn,
|
|
||||||
baseDn: config.BaseDn,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Repository) IsExist(ctx context.Context, dn string) (bool, error) {
|
|
||||||
request := ldap.NewSearchRequest(
|
|
||||||
dn,
|
|
||||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
|
||||||
"(objectClass=*)",
|
|
||||||
[]string{"name"},
|
|
||||||
nil,
|
|
||||||
)
|
|
||||||
result, err := r.conn.Search(request)
|
|
||||||
if err != nil {
|
|
||||||
return false, errors.WithMessage(err, "search by full dn")
|
|
||||||
}
|
|
||||||
return len(result.Entries) > 0, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Repository) DnByUserPrincipalName(ctx context.Context, principalName string) (string, error) {
|
|
||||||
filter := fmt.Sprintf("(&(userPrincipalName=%s))", principalName)
|
|
||||||
request := ldap.NewSearchRequest(
|
|
||||||
r.baseDn, // The base dn to search
|
|
||||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
|
||||||
filter,
|
|
||||||
[]string{"name"},
|
|
||||||
nil,
|
|
||||||
)
|
|
||||||
result, err := r.conn.Search(request)
|
|
||||||
if err != nil {
|
|
||||||
return "", errors.WithMessagef(err, "search by '%s'", filter)
|
|
||||||
}
|
|
||||||
if len(result.Entries) == 0 {
|
|
||||||
return "", errors.Errorf("not found entities by principalName: %s", principalName)
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.Entries[0].DN, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Repository) ModifyMemberAttr(ctx context.Context, userDn string, groupDn string, operation string) error {
|
|
||||||
modifyReq := ldap.NewModifyRequest(groupDn, nil)
|
|
||||||
switch operation {
|
|
||||||
case entity.GroupOperationAdd:
|
|
||||||
modifyReq.Add("member", []string{userDn})
|
|
||||||
case entity.GroupOperationDelete:
|
|
||||||
modifyReq.Delete("member", []string{userDn})
|
|
||||||
}
|
|
||||||
|
|
||||||
err := r.conn.Modify(modifyReq)
|
|
||||||
if ldap.IsErrorAnyOf(err, ldap.LDAPResultUnwillingToPerform, ldap.LDAPResultEntryAlreadyExists) {
|
|
||||||
return errors.WithMessage(domain.ErrNoActionRequired, err.Error())
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessagef(err, "modify entity by dn %s, operation: %s member from group", groupDn, operation)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Repository) Close() error {
|
|
||||||
return errors.WithMessage(r.conn.Close(), "close ldap connection")
|
|
||||||
}
|
|
||||||
+1
-24
@@ -3,9 +3,9 @@ package repository
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"github.com/Masterminds/squirrel"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Masterminds/squirrel"
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/txix-open/isp-kit/db"
|
"github.com/txix-open/isp-kit/db"
|
||||||
"github.com/txix-open/isp-kit/db/query"
|
"github.com/txix-open/isp-kit/db/query"
|
||||||
@@ -139,29 +139,6 @@ func (r Token) UpdateStatusByUserId(ctx context.Context, userId int, status stri
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r Token) LastAccessNotBlockedUsers(ctx context.Context) (map[int64]time.Time, error) {
|
|
||||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.LastAccessNotBlockedUsers")
|
|
||||||
|
|
||||||
query := `
|
|
||||||
select t.user_id, max(t.created_at) as created_at from tokens t
|
|
||||||
join users u on t.user_id = u.id
|
|
||||||
where u.blocked = false
|
|
||||||
group by t.user_id
|
|
||||||
`
|
|
||||||
tokens := make([]entity.Token, 0)
|
|
||||||
err := r.db.Select(ctx, &tokens, query)
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.WithMessagef(err, "select query: %s", query)
|
|
||||||
}
|
|
||||||
|
|
||||||
result := make(map[int64]time.Time, 0)
|
|
||||||
for _, token := range tokens {
|
|
||||||
result[token.UserId] = token.CreatedAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return result, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Token) LastAccessByUserIds(ctx context.Context, userIds []int) (map[int64]*time.Time, error) {
|
func (r Token) LastAccessByUserIds(ctx context.Context, userIds []int) (map[int64]*time.Time, error) {
|
||||||
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.LastAccessNotBlockedUsers")
|
ctx = sql_metrics.OperationLabelToContext(ctx, "Token.LastAccessNotBlockedUsers")
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package repository
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/Masterminds/squirrel"
|
"github.com/Masterminds/squirrel"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@@ -233,6 +234,32 @@ func (u User) Block(ctx context.Context, userId int) (*entity.User, error) {
|
|||||||
return &user, nil
|
return &user, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u User) LastAccessNotBlockedUsers(ctx context.Context) (map[int64]time.Time, error) {
|
||||||
|
ctx = sql_metrics.OperationLabelToContext(ctx, "User.LastAccessNotBlockedUsers")
|
||||||
|
|
||||||
|
q, args, err := query.New().
|
||||||
|
Select("id, last_active_at").
|
||||||
|
From("users").
|
||||||
|
Where(squirrel.Eq{"blocked": false}).
|
||||||
|
ToSql()
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessage(err, "build query")
|
||||||
|
}
|
||||||
|
|
||||||
|
users := make([]entity.User, 0)
|
||||||
|
err = u.db.Select(ctx, &users, q, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.WithMessagef(err, "select query: %s", q)
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make(map[int64]time.Time, 0)
|
||||||
|
for _, user := range users {
|
||||||
|
result[user.Id] = user.LastActiveAt
|
||||||
|
}
|
||||||
|
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (u User) ChangePassword(ctx context.Context, userId int64, newPassword string) error {
|
func (u User) ChangePassword(ctx context.Context, userId int64, newPassword string) error {
|
||||||
ctx = sql_metrics.OperationLabelToContext(ctx, "User.ChangePassword")
|
ctx = sql_metrics.OperationLabelToContext(ctx, "User.ChangePassword")
|
||||||
|
|
||||||
@@ -252,3 +279,14 @@ func (u User) ChangePassword(ctx context.Context, userId int64, newPassword stri
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (u User) UpdateLastActiveAt(ctx context.Context, userId int64, lastActiveAt time.Time) error {
|
||||||
|
ctx = sql_metrics.OperationLabelToContext(ctx, "User.UpdateLastActiveAt")
|
||||||
|
|
||||||
|
q := "update users set last_active_at = $1 where id = $2"
|
||||||
|
_, err := u.db.Exec(ctx, q, lastActiveAt, userId)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessagef(err, "user.repo.UpdateLastActiveAt: exec query: %s", q)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
+30
-5
@@ -31,6 +31,7 @@ type userRepository interface {
|
|||||||
GetUserByEmail(ctx context.Context, email string) (*entity.User, error)
|
GetUserByEmail(ctx context.Context, email string) (*entity.User, error)
|
||||||
UpsertBySudirUserId(ctx context.Context, user entity.User) (*entity.User, error)
|
UpsertBySudirUserId(ctx context.Context, user entity.User) (*entity.User, error)
|
||||||
UpdateUser(ctx context.Context, id int64, user entity.UpdateUser) (*entity.User, error)
|
UpdateUser(ctx context.Context, id int64, user entity.UpdateUser) (*entity.User, error)
|
||||||
|
UpdateLastActiveAt(ctx context.Context, userId int64, lastActiveAt time.Time) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type tokenService interface {
|
type tokenService interface {
|
||||||
@@ -118,6 +119,12 @@ func (a Auth) Login(ctx context.Context, request domain.LoginRequest) (*domain.L
|
|||||||
return errors.WithMessage(err, "generate token")
|
return errors.WithMessage(err, "generate token")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastActiveAt := time.Now().UTC()
|
||||||
|
err = tx.UpdateLastActiveAt(ctx, user.Id, lastActiveAt)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "update user last_active_at")
|
||||||
|
}
|
||||||
|
|
||||||
a.auditService.SaveAuditAsync(ctx, user.Id, "Успешный вход через форму входа", entity.EventSuccessLogin)
|
a.auditService.SaveAuditAsync(ctx, user.Id, "Успешный вход через форму входа", entity.EventSuccessLogin)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -185,6 +192,12 @@ func (a Auth) LoginWithSudir(ctx context.Context, request domain.LoginSudirReque
|
|||||||
return errors.WithMessage(err, "generate token")
|
return errors.WithMessage(err, "generate token")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastActiveAt := time.Now().UTC()
|
||||||
|
err = tx.UpdateLastActiveAt(ctx, user.Id, lastActiveAt)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "update user last_active_at")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -201,12 +214,24 @@ func (a Auth) LoginWithSudir(ctx context.Context, request domain.LoginSudirReque
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a Auth) Logout(ctx context.Context, adminId int64) error {
|
func (a Auth) Logout(ctx context.Context, adminId int64) error {
|
||||||
err := a.tokenService.RevokeAllByUserId(ctx, adminId)
|
err := a.txRunner.AuthTransaction(ctx, func(ctx context.Context, tx AuthTransaction) error {
|
||||||
if err != nil {
|
err := a.tokenService.RevokeAllByUserId(ctx, adminId)
|
||||||
return errors.WithMessage(err, "revoke all tokens by user id")
|
if err != nil {
|
||||||
}
|
return errors.WithMessage(err, "revoke all tokens by user id")
|
||||||
|
}
|
||||||
|
|
||||||
a.auditService.SaveAuditAsync(ctx, adminId, "Выход", entity.EventSuccessLogout)
|
lastActiveAt := time.Now().UTC()
|
||||||
|
err = tx.UpdateLastActiveAt(ctx, adminId, lastActiveAt)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "update user last_active_at")
|
||||||
|
}
|
||||||
|
|
||||||
|
a.auditService.SaveAuditAsync(ctx, adminId, "Выход", entity.EventSuccessLogout)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "auth transaction")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -19,48 +19,35 @@ type AuditRepo interface {
|
|||||||
SaveAuditAsync(ctx context.Context, userId int64, message string, event string)
|
SaveAuditAsync(ctx context.Context, userId int64, message string, event string)
|
||||||
}
|
}
|
||||||
|
|
||||||
type TokenRepo interface {
|
|
||||||
LastAccessNotBlockedUsers(ctx context.Context) (map[int64]time.Time, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserRepo interface {
|
type UserRepo interface {
|
||||||
|
LastAccessNotBlockedUsers(ctx context.Context) (map[int64]time.Time, error)
|
||||||
Block(ctx context.Context, userId int) (*entity.User, error)
|
Block(ctx context.Context, userId int) (*entity.User, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type LdapService interface {
|
|
||||||
SyncGroups(ctx context.Context, user entity.User) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserRoleRepo interface {
|
type UserRoleRepo interface {
|
||||||
UpsertUserRoleLinks(ctx context.Context, id int, roleIds []int) error
|
UpsertUserRoleLinks(ctx context.Context, id int, roleIds []int) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type Service struct {
|
type Service struct {
|
||||||
tokenRepo TokenRepo
|
|
||||||
userRepo UserRepo
|
userRepo UserRepo
|
||||||
auditRepo AuditRepo
|
auditRepo AuditRepo
|
||||||
userRoleRepo UserRoleRepo
|
userRoleRepo UserRoleRepo
|
||||||
ldapService LdapService
|
|
||||||
threshold time.Duration
|
threshold time.Duration
|
||||||
syncPeriod time.Duration
|
syncPeriod time.Duration
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewInactiveBlocker(
|
func NewInactiveBlocker(
|
||||||
tokensRepo TokenRepo,
|
|
||||||
userRepo UserRepo,
|
userRepo UserRepo,
|
||||||
auditRepo AuditRepo,
|
auditRepo AuditRepo,
|
||||||
userRoleRepo UserRoleRepo,
|
userRoleRepo UserRoleRepo,
|
||||||
ldapService LdapService,
|
|
||||||
config conf.BlockInactiveWorker,
|
config conf.BlockInactiveWorker,
|
||||||
logger log.Logger,
|
logger log.Logger,
|
||||||
) Service {
|
) Service {
|
||||||
return Service{
|
return Service{
|
||||||
tokenRepo: tokensRepo,
|
|
||||||
userRepo: userRepo,
|
userRepo: userRepo,
|
||||||
auditRepo: auditRepo,
|
auditRepo: auditRepo,
|
||||||
userRoleRepo: userRoleRepo,
|
userRoleRepo: userRoleRepo,
|
||||||
ldapService: ldapService,
|
|
||||||
threshold: time.Duration(config.DaysThreshold) * 24 * time.Hour,
|
threshold: time.Duration(config.DaysThreshold) * 24 * time.Hour,
|
||||||
syncPeriod: time.Minute * time.Duration(config.RunIntervalInMinutes),
|
syncPeriod: time.Minute * time.Duration(config.RunIntervalInMinutes),
|
||||||
logger: logger,
|
logger: logger,
|
||||||
@@ -79,7 +66,7 @@ func (w Service) Handle(ctx context.Context, _ bgjob.Job) bgjob.Result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w Service) do(ctx context.Context) error {
|
func (w Service) do(ctx context.Context) error {
|
||||||
lastAccess, err := w.tokenRepo.LastAccessNotBlockedUsers(ctx)
|
lastAccess, err := w.userRepo.LastAccessNotBlockedUsers(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessage(err, "get last access times")
|
return errors.WithMessage(err, "get last access times")
|
||||||
}
|
}
|
||||||
@@ -92,7 +79,7 @@ func (w Service) do(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
w.logger.Info(ctx, "block inactive user", log.Int64("userId", userId), log.Any("lastAccessTime", lastAccess))
|
w.logger.Info(ctx, "block inactive user", log.Int64("userId", userId), log.Any("lastAccessTime", lastAccess))
|
||||||
user, err := w.userRepo.Block(ctx, int(userId))
|
_, err := w.userRepo.Block(ctx, int(userId))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessagef(err, "block user %d", userId)
|
return errors.WithMessagef(err, "block user %d", userId)
|
||||||
}
|
}
|
||||||
@@ -102,11 +89,6 @@ func (w Service) do(ctx context.Context) error {
|
|||||||
return errors.WithMessage(err, "empty user roles links")
|
return errors.WithMessage(err, "empty user roles links")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = w.ldapService.SyncGroups(ctx, *user)
|
|
||||||
if err != nil {
|
|
||||||
w.logger.Error(ctx, errors.WithMessage(err, "remove ldap groups"))
|
|
||||||
}
|
|
||||||
|
|
||||||
w.auditRepo.SaveAuditAsync(ctx, userId, "Блокировка неактивной УЗ", entity.EventUserChanged)
|
w.auditRepo.SaveAuditAsync(ctx, userId, "Блокировка неактивной УЗ", entity.EventUserChanged)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,148 +0,0 @@
|
|||||||
package ldap
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"slices"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
|
||||||
"github.com/txix-open/isp-kit/log"
|
|
||||||
"msp-admin-service/conf"
|
|
||||||
"msp-admin-service/domain"
|
|
||||||
"msp-admin-service/entity"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Repo interface {
|
|
||||||
IsExist(ctx context.Context, dn string) (bool, error)
|
|
||||||
DnByUserPrincipalName(ctx context.Context, principalName string) (string, error)
|
|
||||||
ModifyMemberAttr(ctx context.Context, userDn string, groupDn string, operation string) error
|
|
||||||
Close() error
|
|
||||||
}
|
|
||||||
|
|
||||||
type RoleRepo interface {
|
|
||||||
All(ctx context.Context) ([]entity.Role, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserRoleRepo interface {
|
|
||||||
GetRolesByUserIds(ctx context.Context, identity []int) ([]entity.UserRole, error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type RepoSupplier func(config *conf.Ldap) (Repo, error)
|
|
||||||
|
|
||||||
type Service struct {
|
|
||||||
config *conf.Ldap
|
|
||||||
repoSuppler RepoSupplier
|
|
||||||
userRoleRepo UserRoleRepo
|
|
||||||
roleRepo RoleRepo
|
|
||||||
logger log.Logger
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewService(
|
|
||||||
config *conf.Ldap,
|
|
||||||
repoSuppler RepoSupplier,
|
|
||||||
userRoleRepo UserRoleRepo,
|
|
||||||
roleRepo RoleRepo,
|
|
||||||
logger log.Logger,
|
|
||||||
) Service {
|
|
||||||
return Service{
|
|
||||||
config: config,
|
|
||||||
repoSuppler: repoSuppler,
|
|
||||||
userRoleRepo: userRoleRepo,
|
|
||||||
roleRepo: roleRepo,
|
|
||||||
logger: logger,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s Service) SyncGroupsAsync(ctx context.Context, user entity.User) {
|
|
||||||
ctx = context.WithoutCancel(ctx)
|
|
||||||
go func() {
|
|
||||||
err := s.SyncGroups(ctx, user)
|
|
||||||
if err != nil {
|
|
||||||
s.logger.Warn(ctx, errors.WithMessage(err, "ldap sync groups"))
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s Service) SyncGroups(ctx context.Context, user entity.User) error {
|
|
||||||
ctx = log.ToContext(ctx, log.String("process", "ldap"), log.Int64("userId", user.Id))
|
|
||||||
|
|
||||||
ldapRepo, err := s.repoSuppler(s.config)
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessage(err, "init ldap repository")
|
|
||||||
}
|
|
||||||
defer ldapRepo.Close()
|
|
||||||
|
|
||||||
if user.SudirUserId == nil || *user.SudirUserId == "" {
|
|
||||||
s.logger.Info(ctx, "user has not sudir user id, skip")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
userDn, err := ldapRepo.DnByUserPrincipalName(ctx, *user.SudirUserId)
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessagef(err, "get user dn by principal name %s", *user.SudirUserId)
|
|
||||||
}
|
|
||||||
|
|
||||||
userRoles, err := s.userRoleRepo.GetRolesByUserIds(ctx, []int{int(user.Id)})
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessage(err, "ger roles by user ids")
|
|
||||||
}
|
|
||||||
|
|
||||||
allRoles, err := s.roleRepo.All(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessage(err, "get all roles")
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := range allRoles {
|
|
||||||
role := allRoles[i]
|
|
||||||
contains := slices.ContainsFunc(userRoles, func(userRole entity.UserRole) bool {
|
|
||||||
return userRole.RoleId == role.Id
|
|
||||||
})
|
|
||||||
operation := entity.GroupOperationDelete
|
|
||||||
if contains {
|
|
||||||
operation = entity.GroupOperationAdd
|
|
||||||
}
|
|
||||||
|
|
||||||
err := s.handleRole(ctx, role, userDn, operation, ldapRepo)
|
|
||||||
if errors.Is(err, domain.ErrNoActionRequired) {
|
|
||||||
s.logger.Info(ctx, "no action required, role is already synced")
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
s.logger.Error(ctx, errors.WithMessage(err, "handle role"))
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s Service) handleRole(
|
|
||||||
ctx context.Context,
|
|
||||||
role entity.Role,
|
|
||||||
userDn string,
|
|
||||||
operation string,
|
|
||||||
ldapRepo Repo,
|
|
||||||
) error {
|
|
||||||
if role.ExternalGroup == "" {
|
|
||||||
s.logger.Info(ctx, "role has no external group mapping, skip", log.Int("roleId", role.Id))
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
exist, err := ldapRepo.IsExist(ctx, role.ExternalGroup)
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessagef(err, "check dn %s is exist", role.ExternalGroup)
|
|
||||||
}
|
|
||||||
if !exist {
|
|
||||||
s.logger.Info(ctx, "role doesn't exist in ldap, skip", log.Int("roleId", role.Id))
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
err = ldapRepo.ModifyMemberAttr(ctx, userDn, role.ExternalGroup, operation)
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessage(err, "modify group member attr")
|
|
||||||
}
|
|
||||||
|
|
||||||
s.logger.Info(ctx, fmt.Sprintf("group %s synced for user %s, operation %s", role.ExternalGroup, userDn, operation))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
+44
-36
@@ -34,6 +34,7 @@ type UserRepo interface {
|
|||||||
Insert(ctx context.Context, user entity.User) (int, error)
|
Insert(ctx context.Context, user entity.User) (int, error)
|
||||||
ChangeBlockStatus(ctx context.Context, userId int) (bool, error)
|
ChangeBlockStatus(ctx context.Context, userId int) (bool, error)
|
||||||
ChangePassword(ctx context.Context, userId int64, newPassword string) error
|
ChangePassword(ctx context.Context, userId int64, newPassword string) error
|
||||||
|
UpdateLastActiveAt(ctx context.Context, userId int64, lastActiveAt time.Time) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type TokenRepo interface {
|
type TokenRepo interface {
|
||||||
@@ -50,10 +51,6 @@ type roleRepoUser interface {
|
|||||||
GetRoleByIds(ctx context.Context, id []int) ([]entity.Role, error)
|
GetRoleByIds(ctx context.Context, id []int) ([]entity.Role, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type LdapService interface {
|
|
||||||
SyncGroupsAsync(ctx context.Context, user entity.User)
|
|
||||||
}
|
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
userRepo UserRepo
|
userRepo UserRepo
|
||||||
userRoleRepo UserRoleRepo
|
userRoleRepo UserRoleRepo
|
||||||
@@ -61,7 +58,6 @@ type User struct {
|
|||||||
tokenRepo TokenRepo
|
tokenRepo TokenRepo
|
||||||
auditService auditService
|
auditService auditService
|
||||||
txRunner UserTransactionRunner
|
txRunner UserTransactionRunner
|
||||||
ldapService LdapService
|
|
||||||
tokenService tokenService
|
tokenService tokenService
|
||||||
idleTimeoutMs int
|
idleTimeoutMs int
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
@@ -74,7 +70,6 @@ func NewUser(
|
|||||||
tokenRepo TokenRepo,
|
tokenRepo TokenRepo,
|
||||||
service auditService,
|
service auditService,
|
||||||
txRunner UserTransactionRunner,
|
txRunner UserTransactionRunner,
|
||||||
ldapService LdapService,
|
|
||||||
tokenService tokenService,
|
tokenService tokenService,
|
||||||
idleTimeoutMs int,
|
idleTimeoutMs int,
|
||||||
logger log.Logger,
|
logger log.Logger,
|
||||||
@@ -86,7 +81,6 @@ func NewUser(
|
|||||||
tokenRepo: tokenRepo,
|
tokenRepo: tokenRepo,
|
||||||
auditService: service,
|
auditService: service,
|
||||||
txRunner: txRunner,
|
txRunner: txRunner,
|
||||||
ldapService: ldapService,
|
|
||||||
tokenService: tokenService,
|
tokenService: tokenService,
|
||||||
idleTimeoutMs: idleTimeoutMs,
|
idleTimeoutMs: idleTimeoutMs,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
@@ -217,8 +211,6 @@ func (u User) CreateUser(ctx context.Context, req domain.CreateUserRequest, admi
|
|||||||
return nil, errors.WithMessage(err, "create user transaction")
|
return nil, errors.WithMessage(err, "create user transaction")
|
||||||
}
|
}
|
||||||
|
|
||||||
u.ldapService.SyncGroupsAsync(ctx, usr)
|
|
||||||
|
|
||||||
slices.Sort(req.Roles)
|
slices.Sort(req.Roles)
|
||||||
diff := diffToString(map[string]any{
|
diff := diffToString(map[string]any{
|
||||||
"Имя": "",
|
"Имя": "",
|
||||||
@@ -298,8 +290,6 @@ func (u User) UpdateUser(ctx context.Context, req domain.UpdateUserRequest, admi
|
|||||||
return nil, errors.WithMessage(err, "update user transaction")
|
return nil, errors.WithMessage(err, "update user transaction")
|
||||||
}
|
}
|
||||||
|
|
||||||
u.ldapService.SyncGroupsAsync(ctx, *user)
|
|
||||||
|
|
||||||
slices.Sort(req.Roles)
|
slices.Sort(req.Roles)
|
||||||
diff := diffToString(map[string]any{
|
diff := diffToString(map[string]any{
|
||||||
"Имя": user.FirstName,
|
"Имя": user.FirstName,
|
||||||
@@ -371,7 +361,7 @@ func (u User) Block(ctx context.Context, adminId int64, userId int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if blocked {
|
if blocked {
|
||||||
err := tx.UpdateStatusByUserId(ctx, userId, entity.TokenStatusRevoked)
|
err = tx.UpdateStatusByUserId(ctx, userId, entity.TokenStatusRevoked)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessage(err, "revoke tokens")
|
return errors.WithMessage(err, "revoke tokens")
|
||||||
}
|
}
|
||||||
@@ -379,6 +369,11 @@ func (u User) Block(ctx context.Context, adminId int64, userId int) error {
|
|||||||
|
|
||||||
if !blocked {
|
if !blocked {
|
||||||
userBlocked = "разблокировка"
|
userBlocked = "разблокировка"
|
||||||
|
lastActiveAt := time.Now().UTC()
|
||||||
|
err = tx.UpdateLastActiveAt(ctx, int64(userId), lastActiveAt)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "update user last_active_at")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@@ -444,33 +439,46 @@ func diffToString(a map[string]any, b map[string]any) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u User) ChangePassword(ctx context.Context, adminId int64, oldPassword string, newPassword string) error {
|
func (u User) ChangePassword(ctx context.Context, adminId int64, oldPassword string, newPassword string) error {
|
||||||
admin, err := u.userRepo.GetUserById(ctx, adminId)
|
err := u.txRunner.UserTransaction(ctx, func(ctx context.Context, tx UserTransaction) error {
|
||||||
|
admin, err := tx.GetUserById(ctx, adminId)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "user.service.ChangePassword: get user by id")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = bcrypt.CompareHashAndPassword([]byte(admin.Password), []byte(oldPassword)); err != nil {
|
||||||
|
u.auditService.SaveAuditAsync(ctx, adminId, "Указан неверный старый пароль", entity.EventErrorPasswordChange)
|
||||||
|
return domain.ErrInvalidPassword
|
||||||
|
}
|
||||||
|
|
||||||
|
encryptedPassword, err := u.cryptPassword(newPassword)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "user.service.ChangePassword: crypt new password")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = tx.ChangePassword(ctx, adminId, encryptedPassword)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "user.service.ChangePassword: change password ")
|
||||||
|
}
|
||||||
|
|
||||||
|
err = u.tokenService.RevokeAllByUserId(ctx, adminId)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "revoke all tokens by user id")
|
||||||
|
}
|
||||||
|
|
||||||
|
lastActiveAt := time.Now().UTC()
|
||||||
|
err = tx.UpdateLastActiveAt(ctx, adminId, lastActiveAt)
|
||||||
|
if err != nil {
|
||||||
|
return errors.WithMessage(err, "update user last_active_at")
|
||||||
|
}
|
||||||
|
|
||||||
|
u.auditService.SaveAuditAsync(ctx, adminId, "Сменил пароль", entity.EventUserPasswordChanged)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.WithMessage(err, "user.service.ChangePassword: get user by id")
|
return errors.WithMessage(err, "user transaction")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := bcrypt.CompareHashAndPassword([]byte(admin.Password), []byte(oldPassword)); err != nil {
|
|
||||||
u.auditService.SaveAuditAsync(ctx, adminId, "Указан неверный старый пароль", entity.EventErrorPasswordChange)
|
|
||||||
return domain.ErrInvalidPassword
|
|
||||||
}
|
|
||||||
|
|
||||||
encryptedPassword, err := u.cryptPassword(newPassword)
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessage(err, "user.service.ChangePassword: crypt new password")
|
|
||||||
}
|
|
||||||
|
|
||||||
err = u.userRepo.ChangePassword(ctx, adminId, encryptedPassword)
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessage(err, "user.service.ChangePassword: change password ")
|
|
||||||
}
|
|
||||||
|
|
||||||
err = u.tokenService.RevokeAllByUserId(ctx, adminId)
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithMessage(err, "revoke all tokens by user id")
|
|
||||||
}
|
|
||||||
|
|
||||||
u.auditService.SaveAuditAsync(ctx, adminId, "Сменил пароль", entity.EventUserPasswordChanged)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -66,7 +66,7 @@ func (t *AuditSuite) SetupTest() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
cfg := assembly.NewLocator(testInstance.Logger(), httpcli.New(), t.db).
|
cfg := assembly.NewLocator(testInstance.Logger(), httpcli.New(), t.db).
|
||||||
Config(context.Background(), emptyLdap, remote, time.Minute)
|
Config(context.Background(), remote, time.Minute)
|
||||||
|
|
||||||
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
|
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
|
||||||
t.grpcCli = apiCli
|
t.grpcCli = apiCli
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ func (s *AuthTestSuite) SetupTest() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
cfg := assembly.NewLocator(testInstance.Logger(), s.httpCli, s.db).
|
cfg := assembly.NewLocator(testInstance.Logger(), s.httpCli, s.db).
|
||||||
Config(context.Background(), emptyLdap, remote, time.Minute)
|
Config(context.Background(), remote, time.Minute)
|
||||||
|
|
||||||
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
|
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
|
||||||
s.grpcCli = apiCli
|
s.grpcCli = apiCli
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func (s *CustomizationTestSuite) SetupTest() {
|
|||||||
ExpireSec: 0,
|
ExpireSec: 0,
|
||||||
}
|
}
|
||||||
cfg := assembly.NewLocator(testInstance.Logger(), nil, s.db).
|
cfg := assembly.NewLocator(testInstance.Logger(), nil, s.db).
|
||||||
Config(context.Background(), emptyLdap, remote, time.Minute)
|
Config(context.Background(), remote, time.Minute)
|
||||||
|
|
||||||
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
|
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
|
||||||
s.grpcCli = apiCli
|
s.grpcCli = apiCli
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ func InsertUser(db *dbt.TestDb, user entity.User) int64 {
|
|||||||
user.Password = string(passwordBytes)
|
user.Password = string(passwordBytes)
|
||||||
}
|
}
|
||||||
var id int64
|
var id int64
|
||||||
db.Must().SelectRow(&id, `insert into users (first_name, last_name, email, password, blocked)
|
db.Must().SelectRow(&id, `insert into users (first_name, last_name, email, password, blocked, last_active_at)
|
||||||
values($1,$2,$3,$4,$5) returning id`,
|
values($1,$2,$3,$4,$5,$6) returning id`,
|
||||||
user.FirstName, user.LastName, user.Email, user.Password, user.Blocked)
|
user.FirstName, user.LastName, user.Email, user.Password, user.Blocked, user.LastActiveAt)
|
||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-17
@@ -21,25 +21,11 @@ func TestInactiveWorker(t *testing.T) {
|
|||||||
test, require := test.New(t)
|
test, require := test.New(t)
|
||||||
db := dbt.New(test, dbx.WithMigrationRunner("../migrations", test.Logger()))
|
db := dbt.New(test, dbx.WithMigrationRunner("../migrations", test.Logger()))
|
||||||
|
|
||||||
userId := InsertUser(db, entity.User{Email: "a@test"})
|
userId := InsertUser(db, entity.User{Email: "a@test", LastActiveAt: time.Now().UTC().Add(-5 * 24 * time.Hour)})
|
||||||
InsertUser(db, entity.User{Email: "b@test"})
|
InsertUser(db, entity.User{Email: "b@test", LastActiveAt: time.Now().UTC()})
|
||||||
InsertTokenEntity(db, entity.Token{
|
|
||||||
Id: 0,
|
|
||||||
Token: "123",
|
|
||||||
UserId: userId,
|
|
||||||
Status: entity.TokenStatusAllowed,
|
|
||||||
CreatedAt: time.Now().UTC().Add(-48 * time.Hour),
|
|
||||||
})
|
|
||||||
InsertTokenEntity(db, entity.Token{
|
|
||||||
Id: 0,
|
|
||||||
Token: "234",
|
|
||||||
UserId: userId,
|
|
||||||
Status: entity.TokenStatusAllowed,
|
|
||||||
CreatedAt: time.Now().UTC().Add(-5 * 24 * time.Hour),
|
|
||||||
})
|
|
||||||
|
|
||||||
config := assembly.NewLocator(test.Logger(), nil, db).
|
config := assembly.NewLocator(test.Logger(), nil, db).
|
||||||
Config(t.Context(), emptyLdap, conf.Remote{
|
Config(t.Context(), conf.Remote{
|
||||||
BlockInactiveWorker: conf.BlockInactiveWorker{
|
BlockInactiveWorker: conf.BlockInactiveWorker{
|
||||||
DaysThreshold: 1,
|
DaysThreshold: 1,
|
||||||
RunIntervalInMinutes: 1,
|
RunIntervalInMinutes: 1,
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
package tests_test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"msp-admin-service/conf"
|
|
||||||
"msp-admin-service/service/ldap"
|
|
||||||
)
|
|
||||||
|
|
||||||
type mockLdap struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m mockLdap) IsExist(ctx context.Context, dn string) (bool, error) {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m mockLdap) DnByUserPrincipalName(ctx context.Context, principalName string) (string, error) {
|
|
||||||
return principalName, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m mockLdap) ModifyMemberAttr(ctx context.Context, userDn string, groupDn string, operation string) error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m mockLdap) Close() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
|
||||||
//nolint:gochecknoglobals
|
|
||||||
emptyLdap = ldap.RepoSupplier(func(config *conf.Ldap) (ldap.Repo, error) {
|
|
||||||
return mockLdap{}, nil
|
|
||||||
})
|
|
||||||
)
|
|
||||||
@@ -40,7 +40,7 @@ func (s *SecureSuite) SetupTest() {
|
|||||||
ExpireSec: 3600,
|
ExpireSec: 3600,
|
||||||
}
|
}
|
||||||
cfg := assembly.NewLocator(s.test.Logger(), httpCli, s.db).
|
cfg := assembly.NewLocator(s.test.Logger(), httpCli, s.db).
|
||||||
Config(context.Background(), emptyLdap, remote, time.Minute)
|
Config(context.Background(), remote, time.Minute)
|
||||||
|
|
||||||
server, apiCli := grpct.TestServer(s.test, cfg.Handler)
|
server, apiCli := grpct.TestServer(s.test, cfg.Handler)
|
||||||
s.test.T().Cleanup(func() {
|
s.test.T().Cleanup(func() {
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ func (s *UserTestSuite) SetupTest() {
|
|||||||
ExpireSec: 0,
|
ExpireSec: 0,
|
||||||
}
|
}
|
||||||
cfg := assembly.NewLocator(testInstance.Logger(), s.httpCli, s.db).
|
cfg := assembly.NewLocator(testInstance.Logger(), s.httpCli, s.db).
|
||||||
Config(context.Background(), emptyLdap, remote, time.Minute)
|
Config(context.Background(), remote, time.Minute)
|
||||||
|
|
||||||
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
|
server, apiCli := grpct.TestServer(testInstance, cfg.Handler)
|
||||||
s.grpcCli = apiCli
|
s.grpcCli = apiCli
|
||||||
|
|||||||
Reference in new issue
Block a user