Auth: Add OrgRole to ID token (#100383)
* Changes for Users and ServiceAccounts * Align tests
This commit is contained in:
@@ -109,6 +109,10 @@ func (s *Service) SignIdentity(ctx context.Context, id identity.Requester) (stri
|
||||
idClaims.Rest.DisplayName = id.GetName()
|
||||
}
|
||||
|
||||
if id.GetOrgRole().IsValid() {
|
||||
idClaims.Rest.Role = string(id.GetOrgRole())
|
||||
}
|
||||
|
||||
token, err := s.signer.SignIDToken(ctx, idClaims)
|
||||
if err != nil {
|
||||
s.metrics.failedTokenSigningCounter.Inc()
|
||||
|
||||
@@ -34,7 +34,7 @@ func Test_ProvideService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestService_SignIdentity(t *testing.T) {
|
||||
signer := &idtest.MockSigner{
|
||||
signer := &idtest.FakeSigner{
|
||||
SignIDTokenFn: func(_ context.Context, claims *auth.IDClaims) (string, error) {
|
||||
key := []byte("key")
|
||||
s, err := jose.NewSigner(jose.SigningKey{Algorithm: jose.HS256, Key: key}, nil)
|
||||
|
||||
Reference in New Issue
Block a user