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 12:24:31 +01:00
parent 67ce1d51e2
commit 213874dbec

View File

@@ -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{})