MSP-7007 add x-application-name to header
This commit is contained in:
1 parent
2b5ee66527
commit
e6c241f112
3 files changed
+4
No files matched your search
@@ -83,6 +83,7 @@ func (p Grpc) Handle(ctx *request.Context) error {
|
||||
md[grpc.DomainIdHeader] = []string{strconv.Itoa(authData.DomainId)}
|
||||
md[grpc.ServiceIdHeader] = []string{strconv.Itoa(authData.ServiceId)}
|
||||
md[grpc.ApplicationIdHeader] = []string{strconv.Itoa(authData.ApplicationId)}
|
||||
md[xAppNameHeader] = []string{authData.AppName}
|
||||
if ctx.IsAdminAuthenticated() {
|
||||
md[xAdminIdHeader] = []string{strconv.Itoa(ctx.AdminId())}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ func setHttpHeaders(ctx *request.Context, header http.Header, skipAuth bool) err
|
||||
header.Set(grpc.DomainIdHeader, strconv.Itoa(authData.DomainId))
|
||||
header.Set(grpc.ServiceIdHeader, strconv.Itoa(authData.ServiceId))
|
||||
header.Set(grpc.ApplicationIdHeader, strconv.Itoa(authData.ApplicationId))
|
||||
header.Set(xAppNameHeader, authData.AppName) //nolint:canonicalheader
|
||||
if ctx.IsAdminAuthenticated() {
|
||||
header.Set(xAdminIdHeader, strconv.Itoa(ctx.AdminId())) //nolint:canonicalheader
|
||||
} else {
|
||||
|
||||
@@ -324,6 +324,7 @@ func (s *HappyPathTestSuite) commonDependencies(test *test.Test) (conf.Remote, *
|
||||
DomainId: 2,
|
||||
ServiceId: 3,
|
||||
ApplicationId: 4,
|
||||
AppName: "test",
|
||||
},
|
||||
}
|
||||
}).Mock("system/secure/authorize", func() domain.AuthorizeResponse {
|
||||
@@ -366,6 +367,7 @@ func assertHeaders(require *require.Assertions, requestId string, ctx context.Co
|
||||
require.EqualValues(2, domainId)
|
||||
require.EqualValues(3, serviceId)
|
||||
require.EqualValues(4, applicationId)
|
||||
require.EqualValues("test", headers.Get("x-application-name"))
|
||||
|
||||
adminId, err := strconv.Atoi(headers.Get("x-admin-id"))
|
||||
require.NoError(err)
|
||||
|
||||
Reference in new issue
Block a user