diff --git a/cmd/authz/service.go b/cmd/authz/service.go index 2f9e370..4a592b5 100644 --- a/cmd/authz/service.go +++ b/cmd/authz/service.go @@ -21,7 +21,7 @@ func ServiceCmd(imsConfig *ims.Config) *cobra.Command { cmd := &cobra.Command{ Use: "service", Short: "Negotiate a service to service token.", - Long: "Perform the 'Client Credential Authorization Flow' to negotiate an access token for a service.'", + Long: "Perform the 'Authorization Code Exchange' to negotiate an access token for a service.", RunE: func(cmd *cobra.Command, args []string) error { cmd.SilenceUsage = true cmd.SilenceErrors = true diff --git a/cmd/decode.go b/cmd/decode.go index 4ae70d7..727328a 100644 --- a/cmd/decode.go +++ b/cmd/decode.go @@ -33,9 +33,8 @@ func decodeCmd(imsConfig *ims.Config) *cobra.Command { return fmt.Errorf("error decoding the token: %w", err) } - fmt.Println(pretty.JSON(decoded.Header)) - fmt.Println() - fmt.Println(pretty.JSON(decoded.Payload)) + output := fmt.Sprintf(`{"header":%s,"payload":%s}`, decoded.Header, decoded.Payload) + fmt.Println(pretty.JSON(output)) return nil }, diff --git a/cmd/exchange.go b/cmd/exchange.go index 0f4a974..4ac7ee0 100644 --- a/cmd/exchange.go +++ b/cmd/exchange.go @@ -47,5 +47,7 @@ func exchangeCmd(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.MarkFlagsMutuallyExclusive("organization", "userID") + return cmd } diff --git a/cmd/profile.go b/cmd/profile.go index 4ab29ba..24eecd4 100644 --- a/cmd/profile.go +++ b/cmd/profile.go @@ -22,7 +22,7 @@ func profileCmd(imsConfig *ims.Config) *cobra.Command { cmd := &cobra.Command{ Use: "profile", - Short: "Requests an user profile.", + Short: "Requests a user profile.", Long: "Requests the user profile associated to the provided access token.", RunE: func(cmd *cobra.Command, args []string) error { cmd.SilenceUsage = true diff --git a/cmd/refresh.go b/cmd/refresh.go index cb2aa52..7f2d20e 100644 --- a/cmd/refresh.go +++ b/cmd/refresh.go @@ -41,7 +41,7 @@ func refreshCmd(imsConfig *ims.Config) *cobra.Command { if err != nil { return fmt.Errorf("error marshalling full JSON response: %w", err) } - fmt.Printf("%s", jsonData) + fmt.Printf("%s\n", jsonData) return nil } fmt.Println(resp.AccessToken) diff --git a/ims/admin_profile.go b/ims/admin_profile.go index 5b34cfa..042d43a 100644 --- a/ims/admin_profile.go +++ b/ims/admin_profile.go @@ -42,7 +42,7 @@ func (i Config) validateGetAdminProfileConfig() error { return nil } -// GetAdminProfile requests the user profile using an access token. +// GetAdminProfile requests the user profile using a service token. func (i Config) GetAdminProfile() (string, error) { err := i.validateGetAdminProfileConfig() diff --git a/ims/decode.go b/ims/decode.go index 991f1f4..b961474 100644 --- a/ims/decode.go +++ b/ims/decode.go @@ -33,7 +33,7 @@ func (i Config) validateDecodeTokenConfig() error { func (i Config) DecodeToken() (*DecodedToken, error) { err := i.validateDecodeTokenConfig() if err != nil { - return nil, fmt.Errorf("incomplete parameters for token decodification: %w", err) + return nil, fmt.Errorf("incomplete parameters for token decoding: %w", err) } parts := strings.Split(i.Token, ".") diff --git a/ims/profile.go b/ims/profile.go index 6358856..28ba15c 100644 --- a/ims/profile.go +++ b/ims/profile.go @@ -117,7 +117,7 @@ func findFulfillableData(data interface{}) { } decodedFulfillableData, err := modifyFulfillableData(strValue) if err != nil { - fmt.Printf("Error decoding fulfillable_data: %v", err) + log.Printf("Error decoding fulfillable_data: %v", err) return } data["fulfillable_data"] = decodedFulfillableData