Skip to content

Commit 2f4a826

Browse files
authored
Return serviceIdentity in the AuthInfo.GetExtra if it's not empty (#175)
Return the `AccessTokenClaims.Rest.ServiceIdentity` in `AuthInfo.GetExtra()` if the service identity is specified/not empty.
1 parent 13c42d0 commit 2f4a826

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

authn/auth_info.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ func (a *AuthInfo) GetExtra() map[string][]string {
7171
// but this should be removed in the not-to-distant future
7272
return map[string][]string{"id-token": {a.id.token}}
7373
}
74-
return map[string][]string{}
74+
75+
result := map[string][]string{}
76+
if a.at.Rest.ServiceIdentity != "" {
77+
result[ServiceIdentityKey] = []string{a.at.Rest.ServiceIdentity}
78+
}
79+
80+
return result
7581
}
7682

7783
func (a *AuthInfo) GetAudience() []string {

authn/const.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ const (
66

77
httpHeaderAccessToken = "X-Access-Token"
88
httpHeaderIDToken = "X-Grafana-Id"
9+
10+
ServiceIdentityKey = "serviceIdentity"
911
)

0 commit comments

Comments
 (0)