Skip to content

Commit 4b05456

Browse files
authored
Merge pull request #29 from oidc-mytoken/fix/profile
fix profile usage with default capabilities
2 parents e81c0a7 + 2a2a089 commit 4b05456

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

internal/commands/mt.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func (opts *mtOpts) Request(ctx *cli.Context) (*api.GeneralMytokenRequest, error
224224
if err != nil {
225225
return nil, err
226226
}
227-
if len(opts.request.Capabilities) == 0 {
227+
if len(opts.request.Capabilities) == 0 && len(opts.request.IncludedProfiles) == 0 {
228228
opts.request.Capabilities = api.NewCapabilities(config.Get().DefaultTokenCapabilities)
229229
}
230230
return opts.request, nil
@@ -502,10 +502,12 @@ func obtainMT(context *cli.Context) (string, error) {
502502
}
503503
mtGrant := mtCommand.GetToken()
504504
if mtGrant != "" && !mtCommand.UseOIDCFlow {
505-
506-
mtRes, err := mytoken.Mytoken.APIFromMytoken(
507-
mtGrant, req.Issuer, req.Restrictions, req.Capabilities,
508-
req.Rotation, req.ResponseType, req.Name,
505+
req.GrantType = api.GrantTypeMytoken
506+
mtRes, err := mytoken.Mytoken.APIFromRequest(
507+
api.MytokenFromMytokenRequest{
508+
GeneralMytokenRequest: *req,
509+
Mytoken: mtGrant,
510+
},
509511
)
510512
if err != nil {
511513
return "", err

0 commit comments

Comments
 (0)