Add Gitea Oauth
With fallback to basic auth if Gitea server does not support oauth
This commit is contained in:
parent
dd2cc872c2
commit
665398fb4f
2 changed files with 14 additions and 3 deletions
|
@ -293,9 +293,11 @@ type (
|
|||
|
||||
// Gitea provides the gitea client configuration.
|
||||
Gitea struct {
|
||||
Server string `envconfig:"DRONE_GITEA_SERVER"`
|
||||
SkipVerify bool `envconfig:"DRONE_GITEA_SKIP_VERIFY"`
|
||||
Debug bool `envconfig:"DRONE_GITEA_DEBUG"`
|
||||
ClientID string `envconfig:"DRONE_GITEA_CLIENT_ID"`
|
||||
ClientSecret string `envconfig:"DRONE_GITEA_CLIENT_SECRET"`
|
||||
Server string `envconfig:"DRONE_GITEA_SERVER"`
|
||||
SkipVerify bool `envconfig:"DRONE_GITEA_SKIP_VERIFY"`
|
||||
Debug bool `envconfig:"DRONE_GITEA_DEBUG"`
|
||||
}
|
||||
|
||||
// Github provides the github client configuration.
|
||||
|
|
|
@ -91,6 +91,15 @@ func provideGiteaLogin(config config.Config) login.Middleware {
|
|||
if config.Gitea.Server == "" {
|
||||
return nil
|
||||
}
|
||||
if config.Gitea.ClientID != "" {
|
||||
return &gitea.Config {
|
||||
ClientID: config.Gitea.ClientID,
|
||||
ClientSecret: config.Gitea.ClientSecret,
|
||||
Server: config.Gitea.Server,
|
||||
Client: defaultClient(config.Gitea.SkipVerify),
|
||||
Logger: logrus.StandardLogger(),
|
||||
}
|
||||
}
|
||||
return &gogs.Config{
|
||||
Label: "drone",
|
||||
Login: "/login/form",
|
||||
|
|
Loading…
Reference in a new issue