Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions .changeset/ripe-banks-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"chainlink": minor
tags:
- "#added"
- "#auth"
- "#oidc"
---

Add OIDC Based Authentication
1 change: 1 addition & 0 deletions core/cmd/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func Test_initServerConfig(t *testing.T) {
"../services/chainlink/testdata/mergingsecretsdata/secrets-mercury-split-two.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-threshold.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-webserver-ldap.toml",
"../services/chainlink/testdata/mergingsecretsdata/secrets-webserver-oidc.toml",
},
},
wantErr: false,
Expand Down
25 changes: 25 additions & 0 deletions core/config/docs/core.toml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,31 @@ 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]
# ClientID is the ID of the OIDC application registered with the identity provider
ClientID = 'abcd1234' # Example
# ProviderURL is the base URL for your OIDC Identity provider.
ProviderURL = 'https://id[.]example[.]com/oauth2/default' # Example
# RedirectURL will always be <NODE_BASE_URL>/signin. This needs to match the configuration on the provider side.
RedirectURL = 'http://localhost:8080/signin' # Example
# ClaimName is the name of the field in the id_token where to find the user's ID claims.
ClaimName = 'groups' # Default
# AdminClaim is string label of the id claim that maps the core node's 'Admin' role
AdminClaim = 'NodeAdmins' # Default
# EditClaim is string label of the id claim that maps the core node's 'Edit' role
EditClaim = 'NodeEditors' # Default
# RunClaim is string label of the id claim that maps the core node's 'Run' role
RunClaim = 'NodeRunners' # Default
# ReadClaim is string label of the id claim that maps the core node's 'Read' role
ReadClaim = '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]
# clientSecret is the secret value sent to the OIDC provider to exchange authorization code for ID token
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
187 changes: 156 additions & 31 deletions core/config/toml/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ type WebServer struct {
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,42 +794,78 @@ func (w *WebServer) setFrom(f *WebServer) {
}

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):
if w.OIDC.ClientID == nil || *w.OIDC.ClientID == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.ClientID", Msg: "OIDC ClientID can not be empty"})
}
if w.OIDC.ProviderURL == nil || *w.OIDC.ProviderURL == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.ProviderURL", Msg: "OIDC ProviderURL can not be empty"})
}
if w.OIDC.RedirectURL == nil || *w.OIDC.RedirectURL == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.RedirectURL", Msg: "OIDC RedirectURL can not be empty"})
}
if w.OIDC.ClaimName == nil || *w.OIDC.ClaimName == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.ClaimName", Msg: "OIDC ClaimName can not be empty"})
}
if w.OIDC.AdminClaim == nil || *w.OIDC.AdminClaim == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.AdminClaim", Msg: "OIDC AdminClaim can not be empty"})
}
if w.OIDC.EditClaim == nil || *w.OIDC.EditClaim == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.EditClaim", Msg: "OIDC EditClaim can not be empty"})
}
if w.OIDC.RunClaim == nil || *w.OIDC.RunClaim == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.RunClaim", Msg: "OIDC RunClaim can not be empty"})
}
if w.OIDC.ReadClaim == nil || *w.OIDC.ReadClaim == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "OIDC.ReadClaim", Msg: "OIDC ReadClaim 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
}

Expand Down Expand Up @@ -976,9 +1013,9 @@ func (w *WebServerLDAP) setFrom(f *WebServerLDAP) {
}

type WebServerLDAPSecrets struct {
ServerAddress *models.SecretURL
ReadOnlyUserLogin *models.Secret
ReadOnlyUserPass *models.Secret
ServerAddress *commonconfig.SecretURL
ReadOnlyUserLogin *commonconfig.SecretString
ReadOnlyUserPass *commonconfig.SecretString
}

func (w *WebServerLDAPSecrets) setFrom(f *WebServerLDAPSecrets) {
Expand All @@ -993,15 +1030,103 @@ func (w *WebServerLDAPSecrets) setFrom(f *WebServerLDAPSecrets) {
}
}

type WebServerOIDC struct {
ClientID *string
ProviderURL *string
RedirectURL *string
ClaimName *string
AdminClaim *string
EditClaim *string
RunClaim *string
ReadClaim *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.ProviderURL; v != nil {
w.ProviderURL = v
}
if v := f.RedirectURL; v != nil {
w.RedirectURL = v
}
if v := f.ClaimName; v != nil {
w.ClaimName = v
}
if v := f.AdminClaim; v != nil {
w.AdminClaim = v
}
if v := f.EditClaim; v != nil {
w.EditClaim = v
}
if v := f.RunClaim; v != nil {
w.RunClaim = v
}
if v := f.ReadClaim; v != nil {
w.ReadClaim = 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 *commonconfig.SecretString
}

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
}

func (w *WebServerSecrets) ValidateConfig() (err error) {
// Validate LDAP if it has non-zero values
if w.LDAP != (WebServerLDAPSecrets{}) {
if w.LDAP.ServerAddress == nil || w.LDAP.ServerAddress.URL().String() == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "WebServerLDAPSecrets.ServerAddress", Msg: "WebServerLDAPSecrets ServerAddress cannot be empty"})
}

if w.LDAP.ReadOnlyUserLogin == nil || *w.LDAP.ReadOnlyUserLogin == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "w.LDAP.bServerLDAPSecrets.ReadOnlyUserLogin", Msg: "WebServerLDAPSecrets ReadOnlyUserLogin cannot be empty"})
}

if w.LDAP.ReadOnlyUserPass == nil || *w.LDAP.ReadOnlyUserPass == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "w.LDAP.bServerLDAPSecrets.ReadOnlyUserPass", Msg: "WebServerLDAPSecrets ReadOnlyUserPass cannot be empty"})
}
}

// Validate OIDC if it has non-zero values
if w.OIDC != (WebServerOIDCSecrets{}) {
if w.OIDC.ClientSecret.String() == "" {
err = multierr.Append(err, configutils.ErrInvalid{Name: "WebServerOIDCSecrets.ClientSecret", Msg: "WebServerOIDCSecrets ClientSecret cannot be empty"})
}
}

return err
}

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

type OIDC interface {
ClientID() string
ClientSecret() string
ProviderURL() string
RedirectURL() string
ClaimName() string
AdminClaim() string
EditClaim() string
RunClaim() string
ReadClaim() string
SessionTimeout() commonconfig.Duration
UserAPITokenEnabled() bool
UserAPITokenDuration() commonconfig.Duration
}

type WebServer interface {
AuthenticationMethod() string
AllowOrigins() string
Expand All @@ -74,4 +89,5 @@ type WebServer interface {
RateLimit() RateLimit
MFA() MFA
LDAP() LDAP
OIDC() OIDC
}
2 changes: 2 additions & 0 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ require (
github.com/consensys/gnark-crypto v0.16.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v1.0.0-rc.1 // indirect
github.com/coreos/go-oidc/v3 v3.11.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.1.1 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.5 // indirect
Expand Down Expand Up @@ -210,6 +211,7 @@ require (
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
github.com/go-chi/chi v1.5.5 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
github.com/go-json-experiment/json v0.0.0-20250223041408-d3c622f1b874 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
github.com/containerd/platforms v1.0.0-rc.1 h1:83KIq4yy1erSRgOVHNk1HYdPvzdJ5CnsWaRoJX4C41E=
github.com/containerd/platforms v1.0.0-rc.1/go.mod h1:J71L7B+aiM5SdIEqmd9wp6THLVRzJGXfNuWCZCllLA4=
github.com/coreos/go-oidc/v3 v3.11.0 h1:Ia3MxdwpSw702YW0xgfmP1GVCMA9aEFWu12XUZ3/OtI=
github.com/coreos/go-oidc/v3 v3.11.0/go.mod h1:gE3LgjOgFoHi9a4ce4/tJczr0Ai2/BoDhf0r5lltWI0=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
Expand Down Expand Up @@ -504,6 +506,8 @@ github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3Bop
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-jose/go-jose/v4 v4.0.4 h1:VsjPI33J0SB9vQM6PLmNjoHqMQNGPiZ0rHL7Ni7Q6/E=
github.com/go-jose/go-jose/v4 v4.0.4/go.mod h1:NKb5HO1EZccyMpiZNbdUw/14tiXNyUJh188dfnMCAfc=
github.com/go-json-experiment/json v0.0.0-20250223041408-d3c622f1b874 h1:F8d1AJ6M9UQCavhwmO6ZsrYLfG8zVFWfEfMS2MXPkSY=
github.com/go-json-experiment/json v0.0.0-20250223041408-d3c622f1b874/go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
Expand Down
14 changes: 12 additions & 2 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,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 @@ -444,7 +445,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 @@ -461,6 +462,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