-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrone.patch
56 lines (53 loc) · 1.91 KB
/
drone.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
diff --git a/cmd/drone-server/inject_client.go b/cmd/drone-server/inject_client.go
index ad8cda37..93197b5f 100644
--- a/cmd/drone-server/inject_client.go
+++ b/cmd/drone-server/inject_client.go
@@ -180,8 +180,13 @@ func provideGitlabClient(config config.Config) *scm.Client {
}
client.Client = &http.Client{
Transport: &oauth2.Transport{
- Source: oauth2.ContextTokenSource(),
- Base: defaultTransport(config.GitLab.SkipVerify),
+ Source: &oauth2.Refresher{
+ ClientID: config.GitLab.ClientID,
+ ClientSecret: config.GitLab.ClientSecret,
+ Endpoint: strings.TrimSuffix(config.GitLab.Server, "/") + "/oauth/token",
+ Source: oauth2.ContextTokenSource(),
+ },
+ Base: defaultTransport(config.GitLab.SkipVerify),
},
}
return client
diff --git a/cmd/drone-server/inject_login.go b/cmd/drone-server/inject_login.go
index 4360246b..106c7421 100644
--- a/cmd/drone-server/inject_login.go
+++ b/cmd/drone-server/inject_login.go
@@ -15,6 +15,8 @@
package main
import (
+ "strings"
+
"github.com/drone/drone/cmd/drone-server/config"
"github.com/drone/go-login/login"
"github.com/drone/go-login/login/bitbucket"
@@ -25,7 +27,6 @@ import (
"github.com/drone/go-login/login/gogs"
"github.com/drone/go-login/login/stash"
"github.com/drone/go-scm/scm/transport/oauth2"
- "strings"
"github.com/google/wire"
"github.com/sirupsen/logrus"
@@ -205,6 +206,14 @@ func provideRefresher(config config.Config) *oauth2.Refresher {
Source: oauth2.ContextTokenSource(),
Client: defaultClient(config.Gitee.SkipVerify),
}
+ case config.GitLab.ClientID != "":
+ return &oauth2.Refresher{
+ ClientID: config.GitLab.ClientID,
+ ClientSecret: config.GitLab.ClientSecret,
+ Endpoint: strings.TrimSuffix(config.GitLab.Server, "/") + "/oauth/token",
+ Source: oauth2.ContextTokenSource(),
+ Client: defaultClient(config.GitLab.SkipVerify),
+ }
}
return nil