From 213874dbec5ebe75d4ea9d938362d1ee4c44bfb3 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Thu, 20 Mar 2025 12:24:31 +0100 Subject: [PATCH] auth-app: Allow to set label via API Instead of using the same hardcoded label for all app tokens, allow to specify one on the API. When an app token is generate via the impersonation feature we add the string ` (Impersonation)` to the label. --- services/auth-app/pkg/service/service.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/auth-app/pkg/service/service.go b/services/auth-app/pkg/service/service.go index 613c42eb3..753d65f6f 100644 --- a/services/auth-app/pkg/service/service.go +++ b/services/auth-app/pkg/service/service.go @@ -99,7 +99,10 @@ func (a *AuthAppService) HandleCreate(w http.ResponseWriter, r *http.Request) { return } - label := "Generated via API" + label := q.Get("label") + if label == "" { + label = "Generated via API" + } // Impersonated request userID, userName := q.Get("userID"), q.Get("userName") @@ -131,7 +134,7 @@ func (a *AuthAppService) HandleCreate(w http.ResponseWriter, r *http.Request) { return } - label = "Generated via Impersonation API" + label = label + " (Impersonation)" } scopes, err := scope.AddOwnerScope(map[string]*authpb.Scope{})