diff --git a/cmd/authz/jwt.go b/cmd/authz/jwt.go index 90898c7..5c4d16e 100644 --- a/cmd/authz/jwt.go +++ b/cmd/authz/jwt.go @@ -25,7 +25,6 @@ func JWTCmd(imsConfig *ims.Config) *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { cmd.SilenceUsage = true - resp, err := imsConfig.AuthorizeJWTExchange() if err != nil { return fmt.Errorf("error in jwt authorization: %w", err) @@ -41,6 +40,8 @@ func JWTCmd(imsConfig *ims.Config) *cobra.Command { cmd.Flags().StringVarP(&imsConfig.Account, "account", "A", "", "Technical Account ID.") cmd.Flags().StringVarP(&imsConfig.PrivateKeyPath, "privateKey", "k", "", "Private Key file.") cmd.Flags().StringSliceVarP(&imsConfig.Metascopes, "metascopes", "m", []string{}, "Metascopes to request.") + cmd.Flags().StringSliceVarP(&imsConfig.Resource, "resource", "r", nil, + "RFC 8707 resource indicator URI(s) for audience-restricted tokens.") return cmd } diff --git a/cmd/refresh.go b/cmd/refresh.go index f7944ec..9704bec 100644 --- a/cmd/refresh.go +++ b/cmd/refresh.go @@ -55,8 +55,5 @@ func refreshCmd(imsConfig *ims.Config) *cobra.Command { "Scopes to request in the new token. Subset of the scopes of the original token. Optional value, if no "+ "scopes are requested the same scopes of the original token will be provided.") cmd.Flags().BoolVarP(&imsConfig.FullOutput, "fullOutput", "F", false, "Output a JSON with access and refresh tokens.") - cmd.Flags().StringSliceVarP(&imsConfig.Resource, "resource", "r", nil, - "RFC 8707 resource indicator URI(s) for audience-restricted tokens.") - return cmd } diff --git a/go.mod b/go.mod index 544c039..b9c2e2a 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ go 1.23.0 toolchain go1.26.2 require ( - github.com/adobe/ims-go v0.23.0 + github.com/adobe/ims-go v0.24.0 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c github.com/spf13/cobra v1.10.2 github.com/spf13/viper v1.21.0 diff --git a/go.sum b/go.sum index 8919923..80934a3 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/adobe/ims-go v0.23.0 h1:OYtCXoNJEAgG30CnLVd4PFvWN5Vv4u/Q72OZlGkfkEA= github.com/adobe/ims-go v0.23.0/go.mod h1:zGpx0ylsumBjkgd8fYgzJ8+Ci/zFABiBTAxbCscsyR8= +github.com/adobe/ims-go v0.24.0 h1:GCChkRMHyAun419OmL/TqYX7WJ/9FZMn0ey3z/0K6Ow= +github.com/adobe/ims-go v0.24.0/go.mod h1:zGpx0ylsumBjkgd8fYgzJ8+Ci/zFABiBTAxbCscsyR8= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/ims/jwt_exchange.go b/ims/jwt_exchange.go index f994f9f..d2b215b 100644 --- a/ims/jwt_exchange.go +++ b/ims/jwt_exchange.go @@ -65,9 +65,8 @@ func (i Config) AuthorizeJWTExchange() (TokenInfo, error) { } }() - // Metascopes are passed as generic claims with the format map[string]any - // where the strings are in the form: baseIMSUrl/s/metascope - // and the value is 'true' + // Metascopes are passed as generic claims with the format map[string]any, + // where the strings are in the form: baseIMSUrl/s/metascope and the value is 'true' baseURL := strings.TrimRight(i.URL, "/") claims := make(map[string]any) @@ -83,6 +82,7 @@ func (i Config) AuthorizeJWTExchange() (TokenInfo, error) { ClientID: i.ClientID, ClientSecret: i.ClientSecret, Claims: claims, + Resources: i.Resource, }) if err != nil { return TokenInfo{}, fmt.Errorf("error exchanging JWT: %w", err) diff --git a/ims/refresh.go b/ims/refresh.go index 404e3ff..389b38a 100644 --- a/ims/refresh.go +++ b/ims/refresh.go @@ -50,7 +50,6 @@ func (i Config) Refresh() (RefreshInfo, error) { ClientSecret: i.ClientSecret, RefreshToken: i.RefreshToken, Scope: i.Scopes, - Resource: i.Resource, }) if err != nil { return RefreshInfo{}, fmt.Errorf("error during the token refresh: %w", err)