enable legacy token mapper
This commit is contained in:
parent
c393b74f63
commit
6558d53de2
4 changed files with 19 additions and 7 deletions
|
@ -259,9 +259,10 @@ type (
|
|||
|
||||
// Session provides the session configuration.
|
||||
Session struct {
|
||||
Timeout time.Duration `envconfig:"DRONE_COOKIE_TIMEOUT" default:"720h"`
|
||||
Secret string `envconfig:"DRONE_COOKIE_SECRET"`
|
||||
Secure bool `envconfig:"DRONE_COOKIE_SECURE"`
|
||||
Timeout time.Duration `envconfig:"DRONE_COOKIE_TIMEOUT" default:"720h"`
|
||||
Secret string `envconfig:"DRONE_COOKIE_SECRET"`
|
||||
Secure bool `envconfig:"DRONE_COOKIE_SECURE"`
|
||||
MappingFile string `envconfig:"DRONE_LEGACY_TOKEN_MAPPING_FILE"`
|
||||
}
|
||||
|
||||
// Status provides status configurations.
|
||||
|
|
|
@ -92,12 +92,21 @@ func provideNetrcService(client *scm.Client, renewer core.Renewer, config config
|
|||
|
||||
// provideSession is a Wire provider function that returns a
|
||||
// user session based on the environment configuration.
|
||||
func provideSession(store core.UserStore, config config.Config) core.Session {
|
||||
func provideSession(store core.UserStore, config config.Config) (core.Session, error) {
|
||||
if config.Session.MappingFile != "" {
|
||||
return session.Legacy(store, session.Config{
|
||||
Secure: config.Session.Secure,
|
||||
Secret: config.Session.Secret,
|
||||
Timeout: config.Session.Timeout,
|
||||
MappingFile: config.Session.MappingFile,
|
||||
})
|
||||
}
|
||||
|
||||
return session.New(store, session.NewConfig(
|
||||
config.Session.Secret,
|
||||
config.Session.Timeout,
|
||||
config.Session.Secure),
|
||||
)
|
||||
), nil
|
||||
}
|
||||
|
||||
// provideUserService is a Wire provider function that returns a
|
||||
|
|
|
@ -80,7 +80,10 @@ func InitializeApplication(config2 config.Config) (application, error) {
|
|||
licenseService := license.NewService(userStore, repositoryStore, buildStore, coreLicense)
|
||||
permStore := perm.New(db)
|
||||
repositoryService := repo.New(client, renewer)
|
||||
session := provideSession(userStore, config2)
|
||||
session, err := provideSession(userStore, config2)
|
||||
if err != nil {
|
||||
return application{}, err
|
||||
}
|
||||
batcher := batch.New(db)
|
||||
syncer := provideSyncer(repositoryService, repositoryStore, userStore, batcher, config2)
|
||||
server := api.New(buildStore, commitService, cronStore, corePubsub, globalSecretStore, hookService, logStore, coreLicense, licenseService, permStore, repositoryStore, repositoryService, scheduler, secretStore, stageStore, stepStore, statusService, session, logStream, syncer, system, triggerer, userStore, webhookSender)
|
||||
|
|
1
go.sum
1
go.sum
|
@ -148,7 +148,6 @@ github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uP
|
|||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6 h1:qCv4319q2q7XKn0MQbi8p37hsJ+9Xo8e6yojA73JVxk=
|
||||
github.com/hashicorp/go-retryablehttp v0.0.0-20180718195005-e651d75abec6/go.mod h1:fXcdFsQoipQa7mwORhKad5jmDCeSy/RCGzWA08PO0lM=
|
||||
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/nomad v0.0.0-20190125003214-134391155854 h1:L7WhLZt2ory/kQWxqkMwOiBpIoa4BWoadN7yx8LHEtk=
|
||||
|
|
Loading…
Reference in a new issue