MSP-6673 Add app name to response system/secure/authenticate

This commit is contained in:
Синельник Тимур Романович committed 2025-11-06 14:50:04 +03:00
1 parent 8da4fcb819
commit cb387196d8
6 files changed
+8 -1

No files matched your search

+2
View File
@@ -129,6 +129,8 @@ definitions:
type: object
domain.AuthData:
properties:
appName:
type: string
applicationId:
type: integer
domainId:
+1
View File
@@ -11,6 +11,7 @@ type AuthenticateResponse struct {
}
type AuthData struct {
AppName string
SystemId int
DomainId int
ServiceId int
+1
View File
@@ -12,6 +12,7 @@ type Token struct {
}
type AuthData struct {
AppName string
SystemId int
DomainId int
ApplicationGroupId int
+1 -1
View File
@@ -101,7 +101,7 @@ func (r Token) DeleteToken(ctx context.Context, tokens []string) (int, error) {
func (r Token) AuthDataByToken(ctx context.Context, token string) (*entity.AuthData, error) {
q := `
SELECT system_id, domain_id, application_group_id, app_id, token.expire_time, token.created_at
SELECT system_id, domain_id, application_group_id, app_id, application.name AS app_name , token.expire_time, token.created_at
FROM token
LEFT JOIN application
ON token.app_id = application.id
+1
View File
@@ -45,6 +45,7 @@ func (s Service) Authenticate(ctx context.Context, token string) (*domain.AuthDa
}
return &domain.AuthData{
AppName: authData.AppName,
SystemId: authData.SystemId,
DomainId: authData.DomainId,
ServiceId: authData.ApplicationGroupId,
+2
View File
@@ -69,6 +69,7 @@ func (s *SecureSuite) TestAuthenticate_Success() {
Authenticated: true,
ErrorReason: "",
AuthData: &domain.AuthData{
AppName: "test_application",
SystemId: 1,
DomainId: 3,
ServiceId: 5,
@@ -110,6 +111,7 @@ func (s *SecureSuite) TestAuthenticate_NotExpired() {
Authenticated: true,
ErrorReason: "",
AuthData: &domain.AuthData{
AppName: "test_application",
SystemId: 1,
DomainId: 3,
ServiceId: 5,