MSP-6673 Add app name to response system/secure/authenticate
This commit is contained in:
1 parent
8da4fcb819
commit
cb387196d8
6 files changed
+8
-1
No files matched your search
@@ -129,6 +129,8 @@ definitions:
|
||||
type: object
|
||||
domain.AuthData:
|
||||
properties:
|
||||
appName:
|
||||
type: string
|
||||
applicationId:
|
||||
type: integer
|
||||
domainId:
|
||||
|
||||
@@ -11,6 +11,7 @@ type AuthenticateResponse struct {
|
||||
}
|
||||
|
||||
type AuthData struct {
|
||||
AppName string
|
||||
SystemId int
|
||||
DomainId int
|
||||
ServiceId int
|
||||
|
||||
@@ -12,6 +12,7 @@ type Token struct {
|
||||
}
|
||||
|
||||
type AuthData struct {
|
||||
AppName string
|
||||
SystemId int
|
||||
DomainId int
|
||||
ApplicationGroupId int
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user