Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authorJaime Martinez <jmartinez@gitlab.com>2020-11-26 07:25:47 +0300
committerJaime Martinez <jmartinez@gitlab.com>2020-12-17 06:24:23 +0300
commitcd780a18d7c07a8af72cf75dc7b6819cdb5026bd (patch)
treee75234a19119a675d7de66ade10974ac9050e427 /app.go
parent21066de52d7f7af759bdf2395694c935110da1bb (diff)
Encrypt and sign OAuth code
Add AES GCM encryption/decryption to auth Add signing key to Auth Abstract key generation and Auth init to their own funcs. Cleanup and DRY unit tests. Use same code parameter in auth redirect Cleanup auth and add tests for enc/dec oauth code Add acceptance test for fix Apply suggestion from review Add missing test and apply feedback Fix unit test Simplify acceptance test
Diffstat (limited to 'app.go')
-rw-r--r--app.go18
1 files changed, 14 insertions, 4 deletions
diff --git a/app.go b/app.go
index ed06893e..89f0b0da 100644
--- a/app.go
+++ b/app.go
@@ -483,10 +483,7 @@ func runApp(config appConfig) {
a.Artifact = artifact.New(config.ArtifactsServer, config.ArtifactsServerTimeout, config.Domain)
}
- if config.ClientID != "" {
- a.Auth = auth.New(config.Domain, config.StoreSecret, config.ClientID, config.ClientSecret,
- config.RedirectURI, config.GitLabServer)
- }
+ a.setAuth(config)
a.Handlers = handlers.New(a.Auth, a.Artifact)
@@ -524,6 +521,19 @@ func runApp(config appConfig) {
a.Run()
}
+func (a *theApp) setAuth(config appConfig) {
+ if config.ClientID == "" {
+ return
+ }
+
+ var err error
+ a.Auth, err = auth.New(config.Domain, config.StoreSecret, config.ClientID, config.ClientSecret,
+ config.RedirectURI, config.GitLabServer)
+ if err != nil {
+ log.WithError(err).Fatal("could not initialize auth package")
+ }
+}
+
// fatal will log a fatal error and exit.
func fatal(err error, message string) {
log.WithError(err).Fatal(message)