Skip to content

Commit

Permalink
Ensure all instances of NewAuthenticationService have a key
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Jun 12, 2024
1 parent c22b7a3 commit f425400
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ services:
JIMM_ACCESS_TOKEN_EXPIRY_DURATION: 1h
JIMM_SECURE_SESSION_COOKIES: false
JIMM_SESSION_COOKIE_MAX_AGE: 86400
JIMM_SESSION_STORE_SECRET_KEY: WHoyUmtSOWc4N003NXhmb3VtaEVzNU9tR3ppSVg4RDg4Ums1WVc4RlN2a0JQU2dlSzl0NUFTOUl2UERKM05uQgo=
JIMM_SESSION_SECRET_KEY: Xz2RkR9g87M75xfoumhEs5OmGziIX8D88Rk5YW8FSvkBPSgeK9t5AS9IvPDJ3NnB
volumes:
- ./:/jimm/
- ./local/vault/approle.json:/vault/approle.json:rw
Expand Down
1 change: 1 addition & 0 deletions internal/auth/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ func (as *AuthenticationService) MintSessionToken(email string) (string, error)

freshToken, err := jwt.Sign(token, jwt.WithKey(as.signingAlg, []byte(as.sessionSecretKey)))
if err != nil {
zapctx.Error(context.Background(), "failed to sign access token", zap.Error(err))
return "", errors.E(op, err, "failed to sign access token")
}

Expand Down
2 changes: 1 addition & 1 deletion internal/auth/oauth2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ func setupTestAuthSvc(ctx context.Context, c *qt.C, expiry time.Duration) (*auth
ClientSecret: "SwjDofnbDzJDm9iyfUhEp67FfUFMY8L4",
Scopes: []string{oidc.ScopeOpenID, "profile", "email"},
SessionTokenExpiry: expiry,
SessionSecretKey: "secret-key",
RedirectURL: "http://localhost:8080/auth/callback",
Store: db,
SessionStore: sessionStore,
SessionCookieMaxAge: 60,
SessionSecretKey: "secret-key",
})
c.Assert(err, qt.IsNil)

Expand Down
1 change: 1 addition & 0 deletions internal/jimm/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func TestGetOpenFGAUser(t *testing.T) {
Store: db,
SessionStore: sessionStore,
SessionCookieMaxAge: 60,
SessionSecretKey: "test-secret",
})
c.Assert(err, qt.IsNil)

Expand Down
1 change: 1 addition & 0 deletions internal/jimmtest/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ func SetupTestDashboardCallbackHandler(browserURL string, db *db.Database, sessi
Store: db,
SessionStore: sessionStore,
SessionCookieMaxAge: 60,
SessionSecretKey: "test-secret",
})
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions internal/jujuapi/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func (s *adminSuite) SetUpTest(c *gc.C) {
Store: &s.JIMM.Database,
SessionStore: sessionStore,
SessionCookieMaxAge: 60,
SessionSecretKey: "test-secret",
})
c.Assert(err, gc.Equals, nil)
s.JIMM.OAuthAuthenticator = authSvc
Expand Down

0 comments on commit f425400

Please sign in to comment.