Skip to content

Commit

Permalink
Add EnvironmentAccountID
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmendelope committed Dec 1, 2023
1 parent f693863 commit d70953b
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions pkg/interceptors/jwt_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ func GetClaimFromContext(ctx context.Context) (*njwt.ExtendedAuthxClaim, error)
if exists {
envIDVal = envID[0]
}
envAccountIDVal := ""
envAccountID, exists := md[helper.EnvironmentAccountKey]
if exists {
envAccountIDVal = envAccountID[0]
}
accountAdminVal := false
accountAdmin, exists := md[helper.AccountAdminKey]
if exists && accountAdmin[0] == "true" {
Expand Down Expand Up @@ -185,15 +190,16 @@ func GetClaimFromContext(ctx context.Context) (*njwt.ExtendedAuthxClaim, error)
IssuedAt: issuedAt,
},
AuthxClaim: njwt.AuthxClaim{
UserID: userID[0],
Username: username[0],
AccountID: accountIDVal,
AccountName: accountNameVal,
EnvironmentID: envIDVal,
AccountAdmin: accountAdminVal,
ZoneID: zoneIDVal,
ZoneURL: zoneURLVal,
Accounts: userAccounts,
UserID: userID[0],
Username: username[0],
AccountID: accountIDVal,
AccountName: accountNameVal,
EnvironmentID: envIDVal,
EnvironmentAccountID: envAccountIDVal,
AccountAdmin: accountAdminVal,
ZoneID: zoneIDVal,
ZoneURL: zoneURLVal,
Accounts: userAccounts,
},
}, nil
}
Expand Down

0 comments on commit d70953b

Please sign in to comment.