add user token to extension payload
This commit is contained in:
parent
6a81c655ff
commit
7b42cd9bbd
4 changed files with 17 additions and 3 deletions
2
go.mod
2
go.mod
|
@ -12,7 +12,7 @@ require (
|
|||
github.com/coreos/go-semver v0.2.0
|
||||
github.com/dchest/authcookie v0.0.0-20120917135355-fbdef6e99866
|
||||
github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9
|
||||
github.com/drone/drone-go v1.4.1-0.20201109202657-b9e58bbbcf27
|
||||
github.com/drone/drone-go v1.7.2-0.20220308165842-f9e4fe31c2af
|
||||
github.com/drone/drone-runtime v1.1.1-0.20200623162453-61e33e2cab5d
|
||||
github.com/drone/drone-ui v2.7.1+incompatible
|
||||
github.com/drone/drone-yaml v1.2.4-0.20200326192514-6f4d6dfb39e4
|
||||
|
|
4
go.sum
4
go.sum
|
@ -75,6 +75,10 @@ github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk
|
|||
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
|
||||
github.com/drone/drone-go v1.4.1-0.20201109202657-b9e58bbbcf27 h1:58xKlW/Kwp/Apz+R5qNGzBUIzfq1Z57L7Udz1B6bgWE=
|
||||
github.com/drone/drone-go v1.4.1-0.20201109202657-b9e58bbbcf27/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
|
||||
github.com/drone/drone-go v1.7.1 h1:ZX+3Rs8YHUSUQ5mkuMLmm1zr1ttiiE2YGNxF3AnyDKw=
|
||||
github.com/drone/drone-go v1.7.1/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
|
||||
github.com/drone/drone-go v1.7.2-0.20220308165842-f9e4fe31c2af h1:I+xfWPZLMaskFvfFO5fEJ6tVI1Q9bWR9tuORZeaCTPo=
|
||||
github.com/drone/drone-go v1.7.2-0.20220308165842-f9e4fe31c2af/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
|
||||
github.com/drone/drone-runtime v1.0.7-0.20190729202838-87c84080f4a1/go.mod h1:+osgwGADc/nyl40J0fdsf8Z09bgcBZXvXXnLOY48zYs=
|
||||
github.com/drone/drone-runtime v1.1.1-0.20200623162453-61e33e2cab5d h1:P5HI/Y9hARTZ3F3EKs0kYijhjXZWQRQHYn1neTi0pWM=
|
||||
github.com/drone/drone-runtime v1.1.1-0.20200623162453-61e33e2cab5d/go.mod h1:4/2QToW5+HGD0y1sTw7X35W1f7YINS14UfDY4isggT8=
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by the Drone Non-Commercial License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
//go:build !oss
|
||||
// +build !oss
|
||||
|
||||
package config
|
||||
|
@ -33,7 +34,7 @@ func Global(endpoint, signer string, skipVerify bool, timeout time.Duration) cor
|
|||
}
|
||||
|
||||
type global struct {
|
||||
client config.Plugin
|
||||
client config.Plugin
|
||||
timeout time.Duration
|
||||
}
|
||||
|
||||
|
@ -51,6 +52,10 @@ func (g *global) Find(ctx context.Context, in *core.ConfigArgs) (*core.Config, e
|
|||
req := &config.Request{
|
||||
Repo: toRepo(in.Repo),
|
||||
Build: toBuild(in.Build),
|
||||
Token: drone.Token{
|
||||
Access: in.User.Token,
|
||||
Refresh: in.User.Refresh,
|
||||
},
|
||||
}
|
||||
|
||||
res, err := g.client.Find(ctx, req)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by the Drone Non-Commercial License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
//go:build !oss
|
||||
// +build !oss
|
||||
|
||||
package converter
|
||||
|
@ -36,7 +37,7 @@ func Remote(endpoint, signer, extension string, skipVerify bool, timeout time.Du
|
|||
type remote struct {
|
||||
client converter.Plugin
|
||||
extension string
|
||||
timeout time.Duration
|
||||
timeout time.Duration
|
||||
}
|
||||
|
||||
func (g *remote) Convert(ctx context.Context, in *core.ConvertArgs) (*core.Config, error) {
|
||||
|
@ -61,6 +62,10 @@ func (g *remote) Convert(ctx context.Context, in *core.ConvertArgs) (*core.Confi
|
|||
Config: drone.Config{
|
||||
Data: in.Config.Data,
|
||||
},
|
||||
Token: drone.Token{
|
||||
Access: in.User.Token,
|
||||
Refresh: in.User.Refresh,
|
||||
},
|
||||
}
|
||||
|
||||
res, err := g.client.Convert(ctx, req)
|
||||
|
|
Loading…
Reference in a new issue