Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
b9c5d08
Initial commit of OIDC auth driver module, implementation of Authenti…
CL-Andrew Sep 12, 2024
1e4d118
fix: build errors
harry-anderson Feb 25, 2025
04eb2a7
feat: fix build errors
harry-anderson Feb 24, 2025
c15e09a
chore: go tidy
harry-anderson Feb 25, 2025
8de14c0
feat: impl WebServerOIDC methods
harry-anderson Feb 25, 2025
d280b18
feat: get OIDC webserver redirect working
harry-anderson Mar 11, 2025
17e5899
fix: insert user session
harry-anderson Mar 23, 2025
77dd003
feat: add todos
harry-anderson Mar 24, 2025
4712386
feat: try extend router
harry-anderson Mar 30, 2025
2399c18
feat: refactor OIDC handlers to use gin
harry-anderson Apr 1, 2025
e47756b
feat: set cookie working
harry-anderson Apr 20, 2025
ce4bdea
revert: revert debug changes
harry-anderson May 31, 2025
03cafb4
feat: add random state
harry-anderson Jun 2, 2025
ccbf892
fix: CodeQL issues
harry-anderson Jun 2, 2025
39b880e
Merge branch 'develop' into oidc-support
harry-anderson Jun 2, 2025
67a8b38
chore: fix merge conflicts and go tidy
harry-anderson Jun 2, 2025
e284a24
feat: get oidc flow working with the frontend
harry-anderson Jun 3, 2025
e184ce0
feat: oidc-exchange and oidc-enabled endpoints
harry-anderson Jun 3, 2025
3d24842
feat: cleanup, check stored state, remove unused
harry-anderson Jun 4, 2025
5c477cd
cleanup: remove HTTPPort from OIDC config
harry-anderson Jun 4, 2025
e418e0d
feat: config changes
harry-anderson Jun 4, 2025
5de7cbb
feat: update config names
harry-anderson Jun 4, 2025
767e2fa
feat: update config names
harry-anderson Jun 4, 2025
e5549a8
fix: delete session bug
harry-anderson Jun 4, 2025
afc241d
feat: fix sonarkube issues
harry-anderson Jun 5, 2025
253ca3d
feat: update mocks and go.mod
harry-anderson Jun 6, 2025
1e60501
feat: add changeset
harry-anderson Jun 6, 2025
ab371be
feat: rename claimKey to claimName
harry-anderson Jun 6, 2025
5eb4939
chore: make tidy
harry-anderson Jun 9, 2025
c0bf129
chore: make rm-mocked
harry-anderson Jun 9, 2025
b5d43f4
fix docs test
harry-anderson Jun 10, 2025
0310974
chore: fix ci lint issues
harry-anderson Jun 10, 2025
04ea82a
try fix authentication.go
harry-anderson Jun 11, 2025
e78affd
fix: lint
harry-anderson Jun 11, 2025
22aa0a8
chore: fix sonar qube issues
harry-anderson Jun 11, 2025
12adc63
fix: lint issue
harry-anderson Jun 11, 2025
bc14996
feat: add missing oidc config blocks in testdata files
harry-anderson Jun 11, 2025
9876d5a
chore: add missing files
harry-anderson Jun 11, 2025
5438a3a
chore: update test files with oidc config blocks
harry-anderson Jun 11, 2025
562f451
chore: consistent example client_id
harry-anderson Jun 11, 2025
ccce240
fix: capital C ClientSecret in testdata
harry-anderson Jun 23, 2025
659f89d
feat: add oidc default to valid.txtar and invalid.txtar
harry-anderson Jun 23, 2025
6c30ddd
feat: add OIDC blocks for txtar files
harry-anderson Jun 23, 2025
bca75dd
fix merge confiict
harry-anderson Jun 23, 2025
e5acecc
feat: fix migration number conflict
harry-anderson Jun 23, 2025
d27f233
feat: add oidc to config_test.go
harry-anderson Jun 23, 2025
e62e8aa
fix: double quotes where should use single quotes
harry-anderson Jun 23, 2025
0ce307b
feat: groups single quotes
harry-anderson Jun 23, 2025
3167db9
chore: go mod tidy
harry-anderson Jun 23, 2025
1ee6139
chore: single quotes everywhere
harry-anderson Jun 23, 2025
51a1c89
chore: go mod
harry-anderson Jun 23, 2025
bb38a04
chore: go sum
harry-anderson Jun 23, 2025
ca3eff0
fix double quote error
harry-anderson Jun 24, 2025
6b063b7
fix double quotes
harry-anderson Jun 24, 2025
e3b57ab
feat: run make config-docs
harry-anderson Jun 24, 2025
3d206c9
chore: manual go.sum changes
harry-anderson Jun 24, 2025
62088ba
chore: try force captial C
harry-anderson Jun 24, 2025
fb80c88
chore: remove trailing whitespace and use secret string type
harry-anderson Jun 24, 2025
2d9a3ef
feat: manual go.mod changes
harry-anderson Jun 24, 2025
3ddd535
chore: go mod
harry-anderson Jun 24, 2025
0855048
Merge branch 'develop' into oidc-support
harry-anderson Jun 24, 2025
ee5faf9
chore: cast to string
harry-anderson Jun 24, 2025
e5a1b4a
chore: remove whitespace
harry-anderson Jun 24, 2025
1beb7f2
fix: UserApi casing
harry-anderson Jun 25, 2025
feb17d1
fix: add missing required field ClientID
harry-anderson Jun 25, 2025
0a17fa0
chore: go mod tidy
harry-anderson Jun 25, 2025
7cb34f8
fix: add changeset
harry-anderson Jun 25, 2025
8b0db08
chore: remove duplicate change set
harry-anderson Jun 25, 2025
8b707f2
fix: remove duplicate changeset
harry-anderson Jun 25, 2025
99b50ca
fix: remove old changeset not found and add new changeset
harry-anderson Jun 25, 2025
195cef2
feat: add back missing changeset
harry-anderson Jun 25, 2025
0210066
try: remove tags from changeset open-lizards-switch.md
harry-anderson Jun 25, 2025
14a2b16
feat: added changeset tags
harry-anderson Jun 25, 2025
2046b0f
rmove tags
harry-anderson Jun 25, 2025
008c49a
chore: add tags to change set
harry-anderson Jun 25, 2025
f181184
feat: add ValidateConfig logic
harry-anderson Jun 25, 2025
23ffcf8
chore: add validate config functions
harry-anderson Jun 25, 2025
49c68d4
chore: uncomment validate config for web secrets
harry-anderson Jun 26, 2025
1316a4d
feat: impl ValidateConfig for WebServerSecrets
harry-anderson Jun 26, 2025
b184143
test: stup test
harry-anderson Jun 26, 2025
fab4af0
feat: mock provider
harry-anderson Jun 26, 2025
f61c30a
test: OIDC findUser test
harry-anderson Jun 26, 2025
6741909
test: add more unit tests for OIDC
harry-anderson Jun 27, 2025
d2b7a13
test: createSession test and bugfix
harry-anderson Jun 27, 2025
7968bcc
test: more unit tests
harry-anderson Jun 27, 2025
da12dd6
test: more unit tests for oidc
harry-anderson Jun 27, 2025
345d4e0
test: more oidc tests
harry-anderson Jun 28, 2025
67f1cc6
chore: bump migration number
harry-anderson Jun 28, 2025
f7e5ac1
chore: revert changes to LDAP config field UserApiTokenEnabled
harry-anderson Jun 28, 2025
4d0038f
fix: lint issues
harry-anderson Jun 28, 2025
a3a866c
chore: fix lint issues
harry-anderson Jun 28, 2025
8b95c19
chore: fix lint issues
harry-anderson Jun 28, 2025
687eca6
fix: fix lint issues
harry-anderson Jun 28, 2025
288631a
fix: casing
harry-anderson Jun 28, 2025
c41c5b7
chore: remove todo
harry-anderson Jun 29, 2025
3597883
Bump operator-ui version and update web assets
CL-Andrew Jun 30, 2025
dffcef0
error logging fixes and simplify db calls
CL-Andrew Jul 1, 2025
78728da
error message casing fix
CL-Andrew Jul 1, 2025
4bf0051
simplify db transaction calls
CL-Andrew Jul 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,38 @@ StartTimeout = '15s' # Default
# ListenIP specifies the IP to bind the HTTP server to
ListenIP = '0.0.0.0' # Default

# Optional OIDC config if WebServer.AuthenticationMethod is set to 'oidc'
[WebServer.OIDC]
# Expected audience of the token, usually expected to be the ID of the client
# that initialized the login flow/the auth client application ID
ClientID = ""
# ProviderDomain is the URL identifier for the provider service.
ProviderDomain = 'accounts[.]example[.]com'
# OAuth2ProviderRouteSuffix is route suffix appended to the ProviderDomain, varies per provider
OAuth2ProviderRouteSuffix = '/oauth2/default' # Default
# OIDCCallbackURL is the URL (FQDN) that this running instance of the chainlink application listens on
# for the OIDC provider callback containing the authenticated user's claims. This should be the domain
# that the user accesses the operator UI from. OIDCCallbackURLSuffix is appended to the end
OIDCCallbackURL = 'http://localhost:8080/'
# OIDCCallbackURLSuffix is the API route name suffix used when registering the router endpoint
OIDCCallbackURLSuffix = '/auth/oidc-callback' # Default
# HTTPPort of the OIDC self contained HTTP router used to listen for the provider callback request
HTTPPort = 6689 # Default
# AdminUserGroupClaim is string label of the group returned by the OIDC claim that maps the core node's 'Admin' role
AdminUserGroupClaim = 'NodeAdmins' # Default
# EditUserGroupClaim is string label of the group returned by the OIDC claim that maps the core node's 'Edit' role
EditUserGroupClaim = 'NodeEditors' # Default
# RunUserGroupClaim is string label of the group returned by the OIDC claim that maps the core node's 'Run' role
RunUserGroupClaim = 'NodeRunners' # Default
# ReadUserGroupClaim is string label of the group returned by the OIDC claim that maps the core node's 'Read' role
ReadUserGroupClaim = 'NodeReadOnly' # Default
# SessionTimeout determines the amount of idle time to elapse before session cookies expire. This signs out GUI users from their sessions.
SessionTimeout = '15m0s' # Default
# UserApiTokenEnabled enables the users to issue API tokens with the same access of their role
UserApiTokenEnabled = false # Default
# UserAPITokenDuration is the duration of time an API token is active for before expiring
UserAPITokenDuration = '240h0m0s' # Default

# Optional LDAP config if WebServer.AuthenticationMethod is set to 'ldap'
# LDAP queries are all parameterized to support custom LDAP 'dn', 'cn', and attributes
[WebServer.LDAP]
Expand Down
5 changes: 5 additions & 0 deletions core/config/docs/secrets.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ BackupURL = "postgresql://user:[email protected]:5432/dbname?sslmode
# Environment variable: `CL_DATABASE_ALLOW_SIMPLE_PASSWORDS`
AllowSimplePasswords = false # Default

# Optional OIDC config
[WebServer.OIDC]
# Auth client application secret
clientSecret = "secret" # Example

# Optional LDAP config
[WebServer.LDAP]
# ServerAddress is the full ldaps:// address of the ldap server to authenticate with and query
Expand Down
174 changes: 145 additions & 29 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@
ListenIP *net.IP

LDAP WebServerLDAP `toml:",omitempty"`
OIDC WebServerOIDC `toml:",omitempty"`
MFA WebServerMFA `toml:",omitempty"`
RateLimit WebServerRateLimit `toml:",omitempty"`
TLS WebServerTLS `toml:",omitempty"`
Expand Down Expand Up @@ -793,43 +794,86 @@
}

w.LDAP.setFrom(&f.LDAP)
w.OIDC.setFrom(&f.OIDC)
w.MFA.setFrom(&f.MFA)
w.RateLimit.setFrom(&f.RateLimit)
w.TLS.setFrom(&f.TLS)
}

func (w *WebServer) ValidateConfig() (err error) {
// Validate LDAP fields when authentication method is LDAPAuth
if *w.AuthenticationMethod != string(sessions.LDAPAuth) {
return
switch *w.AuthenticationMethod {
case string(sessions.LDAPAuth):
// Assert LDAP fields when AuthMethod set to LDAP
if *w.LDAP.BaseDN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.BaseDN", Msg: "LDAP BaseDN can not be empty"})
}
if *w.LDAP.BaseUserAttr == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.BaseUserAttr", Msg: "LDAP BaseUserAttr can not be empty"})
}
if *w.LDAP.UsersDN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.UsersDN", Msg: "LDAP UsersDN can not be empty"})
}
if *w.LDAP.GroupsDN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.GroupsDN", Msg: "LDAP GroupsDN can not be empty"})
}
if *w.LDAP.AdminUserGroupCN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.AdminUserGroupCN", Msg: "LDAP AdminUserGroupCN can not be empty"})
}
if *w.LDAP.EditUserGroupCN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.RunUserGroupCN", Msg: "LDAP ReadUserGroupCN can not be empty"})
}
if *w.LDAP.RunUserGroupCN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.RunUserGroupCN", Msg: "LDAP RunUserGroupCN can not be empty"})
}
if *w.LDAP.ReadUserGroupCN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.ReadUserGroupCN", Msg: "LDAP ReadUserGroupCN can not be empty"})
}
return err
case string(sessions.OIDCAuth):
fmt.Println("%#v", w.OIDC)

Check failure on line 833 in core/config/toml/types.go

View workflow job for this annotation

GitHub Actions / Core Tests (go_core_race_tests)

fmt.Println call has possible Printf formatting directive %#v
if *w.OIDC.ClientID == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.ClientID", Msg: "OIDC ClientID can not be empty"})
}
if *w.OIDC.ProviderDomain == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.ProviderDomain", Msg: "OIDC ProviderDomain can not be empty"})
}
if *w.OIDC.OAuth2ProviderRouteSuffix == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.OAuth2ProviderRouteSuffix", Msg: "OIDC OAuth2ProviderRouteSuffix can not be empty"})
}
if *w.OIDC.OIDCCallbackURL == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.OIDCCallbackURL", Msg: "OIDC OIDCCallbackURL can not be empty"})
}
if *w.OIDC.OIDCCallbackURLSuffix == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.OIDCCallbackURLSuffix", Msg: "OIDC OIDCCallbackURLSuffix can not be empty"})
}
if w.OIDC.HTTPPort == 0 {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.HTTPPort", Msg: "OIDC HTTPPort can not be empty"})
}
if *w.OIDC.AdminUserGroupClaim == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.AdminUserGroupClaim", Msg: "OIDC AdminUserGroupClaim can not be empty"})
}
if *w.OIDC.EditUserGroupClaim == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.EditUserGroupClaim", Msg: "OIDC EditUserGroupClaim can not be empty"})
}
if *w.OIDC.RunUserGroupClaim == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.RunUserGroupClaim", Msg: "OIDC RunUserGroupClaim can not be empty"})
}
if *w.OIDC.ReadUserGroupClaim == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.ReadUserGroupClaim", Msg: "OIDC ReadUserGroupClaim can not be empty"})
}
if w.OIDC.SessionTimeout == commonconfig.MustNewDuration(0) {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.SessionTimeout", Msg: "OIDC SessionTimeout can not be empty"})
}
if w.OIDC.UserApiTokenEnabled == nil {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.UserApiTokenEnabled", Msg: "OIDC UserApiTokenEnabled can not be empty"})
}
if w.OIDC.UserAPITokenDuration == commonconfig.MustNewDuration(0) {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.UserAPITokenDuration", Msg: "OIDC UserAPITokenDuration can not be empty"})
}
return err
}

// Assert LDAP fields when AuthMethod set to LDAP
if *w.LDAP.BaseDN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.BaseDN", Msg: "LDAP BaseDN can not be empty"})
}
if *w.LDAP.BaseUserAttr == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.BaseUserAttr", Msg: "LDAP BaseUserAttr can not be empty"})
}
if *w.LDAP.UsersDN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.UsersDN", Msg: "LDAP UsersDN can not be empty"})
}
if *w.LDAP.GroupsDN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.GroupsDN", Msg: "LDAP GroupsDN can not be empty"})
}
if *w.LDAP.AdminUserGroupCN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.AdminUserGroupCN", Msg: "LDAP AdminUserGroupCN can not be empty"})
}
if *w.LDAP.EditUserGroupCN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.RunUserGroupCN", Msg: "LDAP ReadUserGroupCN can not be empty"})
}
if *w.LDAP.RunUserGroupCN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.RunUserGroupCN", Msg: "LDAP RunUserGroupCN can not be empty"})
}
if *w.LDAP.ReadUserGroupCN == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "LDAP.ReadUserGroupCN", Msg: "LDAP ReadUserGroupCN can not be empty"})
}
return err
return nil
}

type WebServerMFA struct {
Expand Down Expand Up @@ -993,15 +1037,87 @@
}
}

type WebServerOIDC struct {
ClientID *string
ProviderDomain *string
OAuth2ProviderRouteSuffix *string
OIDCCallbackURL *string
OIDCCallbackURLSuffix *string
HTTPPort uint16
AdminUserGroupClaim *string
EditUserGroupClaim *string
RunUserGroupClaim *string
ReadUserGroupClaim *string
SessionTimeout *commonconfig.Duration
UserApiTokenEnabled *bool
UserAPITokenDuration *commonconfig.Duration
}

func (w *WebServerOIDC) setFrom(f *WebServerOIDC) {
if v := f.ClientID; v != nil {
w.ClientID = v
}
if v := f.ProviderDomain; v != nil {
w.ProviderDomain = v
}
if v := f.OAuth2ProviderRouteSuffix; v != nil {
w.OAuth2ProviderRouteSuffix = v
}
if v := f.OIDCCallbackURL; v != nil {
w.OIDCCallbackURL = v
}
if v := f.OIDCCallbackURLSuffix; v != nil {
w.OIDCCallbackURLSuffix = v
}
if v := f.HTTPPort; v != 0 {
w.HTTPPort = v
}
if v := f.AdminUserGroupClaim; v != nil {
w.AdminUserGroupClaim = v
}
if v := f.EditUserGroupClaim; v != nil {
w.EditUserGroupClaim = v
}
if v := f.RunUserGroupClaim; v != nil {
w.RunUserGroupClaim = v
}
if v := f.ReadUserGroupClaim; v != nil {
w.ReadUserGroupClaim = v
}
if v := f.SessionTimeout; v != nil {
w.SessionTimeout = v
}
if v := f.UserApiTokenEnabled; v != nil {
w.UserApiTokenEnabled = v
}
if v := f.UserAPITokenDuration; v != nil {
w.UserAPITokenDuration = v
}
}

type WebServerOIDCSecrets struct {
ClientSecret *string
}

func (w *WebServerOIDCSecrets) setFrom(f *WebServerOIDCSecrets) {
if v := f.ClientSecret; v != nil {
w.ClientSecret = v
}
}

type WebServerSecrets struct {
LDAP WebServerLDAPSecrets `toml:",omitempty"`
OIDC WebServerOIDCSecrets `toml:",omitempty"`
}

func (w *WebServerSecrets) SetFrom(f *WebServerSecrets) error {
w.LDAP.setFrom(&f.LDAP)
w.OIDC.setFrom(&f.OIDC)
return nil
}

// TODO: harry: add Validate function for WebServerSecrets and LDAPSecrets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo


type JobPipeline struct {
ExternalInitiatorsEnabled *bool
MaxRunDuration *commonconfig.Duration
Expand Down
18 changes: 18 additions & 0 deletions core/config/web_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,23 @@ type LDAP interface {
UpstreamSyncRateLimit() commonconfig.Duration
}

type OIDC interface {
ClientID() string
ClientSecret() string
ProviderDomain() string
OAuth2ProviderRouteSuffix() string
OIDCCallbackURL() string
OIDCCallbackURLSuffix() string
HTTPPort() uint16
AdminUserGroupClaim() string
EditUserGroupClaim() string
RunUserGroupClaim() string
ReadUserGroupClaim() string
SessionTimeout() commonconfig.Duration
UserApiTokenEnabled() bool
UserAPITokenDuration() commonconfig.Duration
}

type WebServer interface {
AuthenticationMethod() string
AllowOrigins() string
Expand All @@ -74,4 +91,5 @@ type WebServer interface {
RateLimit() RateLimit
MFA() MFA
LDAP() LDAP
OIDC() OIDC
}
14 changes: 12 additions & 2 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/sessions"
"github.com/smartcontractkit/chainlink/v2/core/sessions/ldapauth"
"github.com/smartcontractkit/chainlink/v2/core/sessions/localauth"
"github.com/smartcontractkit/chainlink/v2/core/sessions/oidcauth"
"github.com/smartcontractkit/chainlink/v2/core/static"
"github.com/smartcontractkit/chainlink/v2/plugins"
)
Expand Down Expand Up @@ -162,7 +163,7 @@ type ChainlinkApplication struct {
pipelineRunner pipeline.Runner
bridgeORM bridges.ORM
localAdminUsersORM sessions.BasicAdminUsersORM
authenticationProvider sessions.AuthenticationProvider
authenticationProvider sessions.AuthenticationProvider // Note: this will be OIDC instance
txmStorageService txmgr.EvmTxStore
FeedsService feeds.Service
webhookJobRunner webhook.JobRunner
Expand Down Expand Up @@ -441,7 +442,7 @@ func NewApplication(ctx context.Context, opts ApplicationOpts) (Application, err
localAdminUsersORM := localauth.NewORM(opts.DS, cfg.WebServer().SessionTimeout().Duration(), globalLogger, auditLogger)

// Initialize Sessions ORM based on environment configured authenticator
// localDB auth or remote LDAP auth
// localDB auth, LDAP auth, or OIDC auth
authMethod := cfg.WebServer().AuthenticationMethod()
var authenticationProvider sessions.AuthenticationProvider
var sessionReaper *utils.SleeperTask
Expand All @@ -458,6 +459,15 @@ func NewApplication(ctx context.Context, opts ApplicationOpts) (Application, err
syncer := ldapauth.NewLDAPServerStateSyncer(opts.DS, cfg.WebServer().LDAP(), globalLogger)
srvcs = append(srvcs, syncer)
sessionReaper = utils.NewSleeperTaskCtx(syncer)
case sessions.OIDCAuth:
var err error
authenticationProvider, err = oidcauth.NewOIDCAuthenticator(
opts.DS, cfg.WebServer().OIDC(), globalLogger, auditLogger,
)
if err != nil {
return nil, errors.Wrap(err, "NewApplication: failed to initialize OIDC Authentication module")
}
sessionReaper = oidcauth.NewSessionReaper(opts.DS, cfg.WebServer(), globalLogger)
case sessions.LocalAuth:
authenticationProvider = localauth.NewORM(opts.DS, cfg.WebServer().SessionTimeout().Duration(), globalLogger, auditLogger)
sessionReaper = localauth.NewSessionReaper(opts.DS, cfg.WebServer(), globalLogger)
Expand Down
Loading
Loading