File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11package token
22
33import (
4+ "encoding/json"
45 "fmt"
56 rtUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils"
67 "github.com/jfrog/jfrog-cli-core/v2/utils/config"
@@ -74,6 +75,11 @@ type OidcParams struct {
7475 Repository string
7576}
7677
78+ type ExchangeCommandOutputStruct struct {
79+ AccessToken string `json:"AccessToken"`
80+ Username string `json:"Username"`
81+ }
82+
7783func NewOidcTokenExchangeCommand () * OidcTokenExchangeCommand {
7884 return & OidcTokenExchangeCommand {response : new (auth.OidcTokenResponseData ), OidcParams : & OidcParams {}}
7985}
@@ -150,7 +156,16 @@ func (otc *OidcTokenExchangeCommand) SetProviderTypeAsString(providerType string
150156}
151157
152158func (otc * OidcTokenExchangeCommand ) PrintResponseToConsole () {
153- log .Output (fmt .Sprintf ("{ AccessToken: %s Username: %s }" , otc .response .AccessToken , otc .response .Username ))
159+ response := ExchangeCommandOutputStruct {
160+ AccessToken : otc .response .AccessToken ,
161+ Username : otc .response .Username ,
162+ }
163+ jsonOutput , err := json .Marshal (response )
164+ if err != nil {
165+ log .Error ("Failed to marshal response to JSON:" , err )
166+ return
167+ }
168+ log .Output (string (jsonOutput ))
154169}
155170
156171func (otc * OidcTokenExchangeCommand ) Run () (err error ) {
You can’t perform that action at this time.
0 commit comments