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.
This commit is contained in:
Ralf Haferkamp
2025-03-20 15:09:47 +01:00
parent 67ce1d51e2
commit 213874dbec
+5 -2
View File
@@ -99,7 +99,10 @@ func (a *AuthAppService) HandleCreate(w http.ResponseWriter, r *http.Request) {
return return
} }
label := "Generated via API" label := q.Get("label")
if label == "" {
label = "Generated via API"
}
// Impersonated request // Impersonated request
userID, userName := q.Get("userID"), q.Get("userName") userID, userName := q.Get("userID"), q.Get("userName")
@@ -131,7 +134,7 @@ func (a *AuthAppService) HandleCreate(w http.ResponseWriter, r *http.Request) {
return return
} }
label = "Generated via Impersonation API" label = label + " (Impersonation)"
} }
scopes, err := scope.AddOwnerScope(map[string]*authpb.Scope{}) scopes, err := scope.AddOwnerScope(map[string]*authpb.Scope{})