Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f88738f78 |
No files matched your search
@@ -1,3 +1,5 @@
|
|||||||
|
### v5.6.2
|
||||||
|
* Обновлено заполнение заголовка `x-application-name` для поддержки кириллических символов
|
||||||
### v5.6.1
|
### v5.6.1
|
||||||
* Добавлен проброс заголовка `x-application-name`
|
* Добавлен проброс заголовка `x-application-name`
|
||||||
### v5.6.0
|
### v5.6.0
|
||||||
|
|||||||
+3
-1
@@ -3,6 +3,7 @@ package proxy
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
@@ -83,7 +84,8 @@ func (p Grpc) Handle(ctx *request.Context) error {
|
|||||||
md[grpc.DomainIdHeader] = []string{strconv.Itoa(authData.DomainId)}
|
md[grpc.DomainIdHeader] = []string{strconv.Itoa(authData.DomainId)}
|
||||||
md[grpc.ServiceIdHeader] = []string{strconv.Itoa(authData.ServiceId)}
|
md[grpc.ServiceIdHeader] = []string{strconv.Itoa(authData.ServiceId)}
|
||||||
md[grpc.ApplicationIdHeader] = []string{strconv.Itoa(authData.ApplicationId)}
|
md[grpc.ApplicationIdHeader] = []string{strconv.Itoa(authData.ApplicationId)}
|
||||||
md[grpc.ApplicationNameHeader] = []string{authData.AppName}
|
encodedAppName := base64.StdEncoding.EncodeToString([]byte(authData.AppName))
|
||||||
|
md[grpc.ApplicationNameHeader] = []string{encodedAppName}
|
||||||
if ctx.IsAdminAuthenticated() {
|
if ctx.IsAdminAuthenticated() {
|
||||||
md[xAdminIdHeader] = []string{strconv.Itoa(ctx.AdminId())}
|
md[xAdminIdHeader] = []string{strconv.Itoa(ctx.AdminId())}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,6 +1,7 @@
|
|||||||
package proxy
|
package proxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -100,7 +101,8 @@ func setHttpHeaders(ctx *request.Context, header http.Header, skipAuth bool) err
|
|||||||
header.Set(grpc.DomainIdHeader, strconv.Itoa(authData.DomainId))
|
header.Set(grpc.DomainIdHeader, strconv.Itoa(authData.DomainId))
|
||||||
header.Set(grpc.ServiceIdHeader, strconv.Itoa(authData.ServiceId))
|
header.Set(grpc.ServiceIdHeader, strconv.Itoa(authData.ServiceId))
|
||||||
header.Set(grpc.ApplicationIdHeader, strconv.Itoa(authData.ApplicationId))
|
header.Set(grpc.ApplicationIdHeader, strconv.Itoa(authData.ApplicationId))
|
||||||
header.Set(grpc.ApplicationNameHeader, authData.AppName) //nolint:canonicalheader
|
encodedAppName := base64.StdEncoding.EncodeToString([]byte(authData.AppName))
|
||||||
|
header.Set(grpc.ApplicationNameHeader, encodedAppName) //nolint:canonicalheader
|
||||||
if ctx.IsAdminAuthenticated() {
|
if ctx.IsAdminAuthenticated() {
|
||||||
header.Set(xAdminIdHeader, strconv.Itoa(ctx.AdminId())) //nolint:canonicalheader
|
header.Set(xAdminIdHeader, strconv.Itoa(ctx.AdminId())) //nolint:canonicalheader
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package tests
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/base64"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
@@ -367,7 +368,8 @@ func assertHeaders(require *require.Assertions, requestId string, ctx context.Co
|
|||||||
require.EqualValues(2, domainId)
|
require.EqualValues(2, domainId)
|
||||||
require.EqualValues(3, serviceId)
|
require.EqualValues(3, serviceId)
|
||||||
require.EqualValues(4, applicationId)
|
require.EqualValues(4, applicationId)
|
||||||
require.EqualValues("test", headers.Get("x-application-name"))
|
expectedAppName := base64.StdEncoding.EncodeToString([]byte("test"))
|
||||||
|
require.EqualValues(expectedAppName, headers.Get("x-application-name"))
|
||||||
|
|
||||||
adminId, err := strconv.Atoi(headers.Get("x-admin-id"))
|
adminId, err := strconv.Atoi(headers.Get("x-admin-id"))
|
||||||
require.NoError(err)
|
require.NoError(err)
|
||||||
|
|||||||
Reference in new issue
Block a user