feat(api): allow specifying access token type for user of type machine (#11599)

# Which Problems Are Solved

The user service v2 didn't allow the specify or change the access token
type for users of type machine and referred to using the management API,
which in return was already deprecated and linked to the user service.

# How the Problems Are Solved

Added a possibility to specify the access token type in the creation and
update request.

# Additional Changes

None

# Additional Context

- closes #10850
- requires backport to v4.x

---------

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Livio Spring
2026-02-19 05:05:19 +00:00
committed by GitHub
co-authored by Copilot
parent a31e435491
commit e41b70b1e3
6 changed files with 176 additions and 18 deletions
+54
View File
@@ -284,6 +284,60 @@ func TestCommandSide_ChangeUserMachine(t *testing.T) {
},
},
},
{
name: "change machine accessTokenType, ok",
fields: fields{
eventstore: expectEventstore(
expectFilter(
eventFromEventPusher(userAddedEvent),
),
expectPush(
user.NewMachineChangedEvent(context.Background(),
&userAgg.Aggregate,
[]user.MachineChanges{
user.ChangeAccessTokenType(domain.OIDCTokenTypeJWT),
},
),
),
),
checkPermission: newMockPermissionCheckAllowed(),
},
args: args{
ctx: context.Background(),
orgID: "org1",
machine: &ChangeMachine{
AccessTokenType: gu.Ptr(domain.OIDCTokenTypeJWT),
},
},
res: res{
want: &domain.ObjectDetails{
ResourceOwner: "org1",
},
},
},
{
name: "change machine accessTokenType, no change",
fields: fields{
eventstore: expectEventstore(
expectFilter(
eventFromEventPusher(userAddedEvent),
),
),
checkPermission: newMockPermissionCheckAllowed(),
},
args: args{
ctx: context.Background(),
orgID: "org1",
machine: &ChangeMachine{
AccessTokenType: gu.Ptr(domain.OIDCTokenTypeBearer),
},
},
res: res{
want: &domain.ObjectDetails{
ResourceOwner: "org1",
},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {