@@ -3,14 +3,15 @@ package token
33import (
44 "encoding/json"
55 "fmt"
6+ "os"
7+ "strings"
8+
69 rtUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/utils"
710 "github.com/jfrog/jfrog-cli-core/v2/utils/config"
811 "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
912 "github.com/jfrog/jfrog-client-go/access/services"
1013 "github.com/jfrog/jfrog-client-go/auth"
1114 "github.com/jfrog/jfrog-client-go/utils/log"
12- "os"
13- "strings"
1415)
1516
1617const (
@@ -73,6 +74,9 @@ type OidcParams struct {
7374 JobId string
7475 RunId string
7576 Repository string
77+ VcsUrl string
78+ VcsBranch string
79+ VcsRevision string
7680}
7781
7882type ExchangeCommandOutputStruct struct {
@@ -133,6 +137,21 @@ func (otc *OidcTokenExchangeCommand) SetRepository(repo string) *OidcTokenExchan
133137 return otc
134138}
135139
140+ func (otc * OidcTokenExchangeCommand ) SetVcsUrl (vcsUrl string ) * OidcTokenExchangeCommand {
141+ otc .VcsUrl = vcsUrl
142+ return otc
143+ }
144+
145+ func (otc * OidcTokenExchangeCommand ) SetVcsBranch (vcsBranch string ) * OidcTokenExchangeCommand {
146+ otc .VcsBranch = vcsBranch
147+ return otc
148+ }
149+
150+ func (otc * OidcTokenExchangeCommand ) SetVcsRevision (vcsRevision string ) * OidcTokenExchangeCommand {
151+ otc .VcsRevision = vcsRevision
152+ return otc
153+ }
154+
136155func (otc * OidcTokenExchangeCommand ) Response () (response * auth.OidcTokenResponseData ) {
137156 return otc .response
138157}
@@ -191,5 +210,14 @@ func (otc *OidcTokenExchangeCommand) getOidcTokenParams() services.CreateOidcTok
191210 oidcTokenParams .Repo = otc .Repository
192211 oidcTokenParams .Audience = otc .Audience
193212 oidcTokenParams .ProviderName = otc .ProviderName
213+ oidcTokenParams .ProviderType = otc .ProviderType .String ()
214+ oidcTokenParams .Context = & services.Context {
215+ VcsCommit : & services.VcsCommit {
216+ VcsUrl : otc .VcsUrl ,
217+ Branch : otc .VcsBranch ,
218+ Revision : otc .VcsRevision ,
219+ },
220+ }
221+
194222 return oidcTokenParams
195223}
0 commit comments