From 2a2a0892fd150834b22dfd83be32c15e40f5c864 Mon Sep 17 00:00:00 2001 From: zachmann Date: Tue, 17 Jan 2023 10:44:32 +0100 Subject: [PATCH] fix profile usage with default capabilities --- internal/commands/mt.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/commands/mt.go b/internal/commands/mt.go index c16d610..de82beb 100644 --- a/internal/commands/mt.go +++ b/internal/commands/mt.go @@ -224,7 +224,7 @@ func (opts *mtOpts) Request(ctx *cli.Context) (*api.GeneralMytokenRequest, error if err != nil { return nil, err } - if len(opts.request.Capabilities) == 0 { + if len(opts.request.Capabilities) == 0 && len(opts.request.IncludedProfiles) == 0 { opts.request.Capabilities = api.NewCapabilities(config.Get().DefaultTokenCapabilities) } return opts.request, nil @@ -502,10 +502,12 @@ func obtainMT(context *cli.Context) (string, error) { } mtGrant := mtCommand.GetToken() if mtGrant != "" && !mtCommand.UseOIDCFlow { - - mtRes, err := mytoken.Mytoken.APIFromMytoken( - mtGrant, req.Issuer, req.Restrictions, req.Capabilities, - req.Rotation, req.ResponseType, req.Name, + req.GrantType = api.GrantTypeMytoken + mtRes, err := mytoken.Mytoken.APIFromRequest( + api.MytokenFromMytokenRequest{ + GeneralMytokenRequest: *req, + Mytoken: mtGrant, + }, ) if err != nil { return "", err