2025-11-26 13:43:01: merge [main:e9c5c9b80517122ca122933c111070bf470e31c1];
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s

This commit is contained in:
txix committed 2025-11-26 13:43:01 +03:00
1 parent f3c801e4a4
commit 9b18fe7351
5 files changed
+20 -9

No files matched your search

+1 -1
View File
@@ -1 +1 @@
5.5.0
5.5.1
+2
View File
@@ -1,3 +1,5 @@
### v5.5.1
* повышен приоритет `x-application-token` над basic-auth, при поиске в запросе токена приложения
### v5.5.0
* Добавлена поддержка basic-auth, где `username` - название приложения, `password` - токен приложения
### v5.4.1
+1 -1
View File
@@ -10,7 +10,7 @@ require (
github.com/redis/go-redis/v9 v9.11.0
github.com/stretchr/testify v1.11.1
github.com/tomakado/websocketproxy v0.1.0
github.com/txix-open/isp-kit v1.62.0
github.com/txix-open/isp-kit v1.63.3
github.com/txix-open/jsonschema v1.3.0
golang.org/x/net v0.44.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090
+2 -2
View File
@@ -125,8 +125,8 @@ github.com/txix-open/etp/v4 v4.0.1 h1:5VSYgGsvnMz0tvUHsjVWFETI0qWBTCF1O3ARCHaCIg
github.com/txix-open/etp/v4 v4.0.1/go.mod h1:FIu7TUDdwcgmtmF6tFTV1bGA2fRY/iVaPQdsGzvqYc8=
github.com/txix-open/grmq v1.9.0 h1:ArDbJJcFX9zXKEcPf49rp9nYiRyGMJxGKJAxdbSsfaM=
github.com/txix-open/grmq v1.9.0/go.mod h1:EyFOP17KrwEFOUjR+PH8iH3LCtiN9TSQ8t0ysyk62po=
github.com/txix-open/isp-kit v1.62.0 h1:SfY8x5/3yYEicr5phGTJBaUwFvgktSIsD/NubrKYbg4=
github.com/txix-open/isp-kit v1.62.0/go.mod h1:hyCFmWF0qoVY2loTLyHJx8QPZJuULntG0JfthqFCdsA=
github.com/txix-open/isp-kit v1.63.3 h1:UJLgR4z8sYXUX6r1sl6Ww1aijPx6b7ieMeB+elZoViM=
github.com/txix-open/isp-kit v1.63.3/go.mod h1:rwqKqB3PyZxaoep6iH1PKL89LS9nzRklA6+S4II72M4=
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
github.com/txix-open/validator/v10 v10.0.0-20250506161033-f8ce404fffdb h1:UJgT4u/QMv5QHKOQeJ7igShHa36c2/vIRqJiRLdDlf0=
+14 -5
View File
@@ -4,10 +4,11 @@ import (
"context"
"net/http"
"github.com/pkg/errors"
"isp-gate-service/domain"
"isp-gate-service/httperrors"
"isp-gate-service/request"
"github.com/pkg/errors"
)
const (
@@ -61,17 +62,25 @@ func Authenticate(authenticator Authenticator) Middleware {
}
func extractToken(ctx *request.Context) (string, string, error) {
appName, token, ok := ctx.Request().BasicAuth()
if !ok {
return ctx.Param(applicationTokenHeader), "", nil
var (
appName string
token string
ok bool
)
token = ctx.Param(applicationTokenHeader)
if token != "" {
return token, "", nil
}
if appName == "" {
appName, token, ok = ctx.Request().BasicAuth()
if ok && appName == "" {
return "", "", httperrors.New(
http.StatusUnauthorized,
"application name required",
errors.New("authenticate: application name required on basic auth"),
)
}
return token, appName, nil
}