Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Commit cf48a9b

Browse files
committed
Decouple CA load from request lifecycle
1 parent c96e2e2 commit cf48a9b

16 files changed

+1051
-114
lines changed

cmd/main.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ import (
3030

3131
func main() {
3232
var (
33+
lifecycle = run.NewLifecycle()
3334
configFile = &internal.LocalConfigFile{}
3435
logging = internal.NewLogSystem(log.New(), &configFile.Config)
35-
jwks = oidc.NewJWKSProvider()
36+
tlsPool = internal.NewTLSConfigPool(lifecycle.Context())
37+
jwks = oidc.NewJWKSProvider(tlsPool)
3638
sessions = oidc.NewSessionStoreFactory(&configFile.Config)
37-
envoyAuthz = server.NewExtAuthZFilter(&configFile.Config, jwks, sessions)
39+
envoyAuthz = server.NewExtAuthZFilter(&configFile.Config, tlsPool, jwks, sessions)
3840
authzServer = server.New(&configFile.Config, envoyAuthz.Register)
3941
healthz = server.NewHealthServer(&configFile.Config)
4042
)
@@ -50,6 +52,7 @@ func main() {
5052
g := run.Group{Logger: internal.Logger(internal.Default)}
5153

5254
g.Register(
55+
lifecycle, // manage the lifecycle of the run.Services
5356
configFile, // load the configuration
5457
logging, // set up the logging system
5558
configLog, // log the configuration

config/gen/go/v1/oidc/config.pb.go

+81-54
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/gen/go/v1/oidc/config.pb.validate.go

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/v1/oidc/config.proto

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ syntax = "proto3";
1616

1717
package authservice.config.v1.oidc;
1818

19+
import "google/protobuf/duration.proto";
1920
import "google/protobuf/struct.proto";
2021
import "validate/validate.proto";
2122

@@ -202,6 +203,14 @@ message OIDCConfig {
202203
string trusted_certificate_authority_file = 20;
203204
}
204205

206+
// The duration between refreshes of the trusted certificate authority if `trusted_certificate_authority_file` is set.
207+
// Unset or 0 means disables the refresh, useful is no rotation is expected.
208+
// Default is unset, means disabled.
209+
// Is a String that ends in `s` to indicate seconds and is preceded by the number of seconds,
210+
// with nanoseconds expressed as fractional seconds, e.g. `120.15s`.
211+
// Optional.
212+
google.protobuf.Duration trusted_certificate_authority_refresh_interval = 21;
213+
205214
// The Authservice makes two kinds of direct network connections directly to the OIDC Provider.
206215
// Both are POST requests to the configured `token_uri` of the OIDC Provider.
207216
// The first is to exchange the authorization code for tokens, and the other is to use the

e2e/keycloak/authz-config.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"redis_session_store_config": {
2929
"server_uri": "redis://redis:6379"
3030
},
31-
"trusted_certificate_authority_file": "/etc/authservice/certs/ca.crt"
31+
"trusted_certificate_authority_file": "/etc/authservice/certs/ca.crt",
32+
"trusted_certificate_authority_refresh_interval": "60.25s"
3233
}
3334
}
3435
]

0 commit comments

Comments
 (0)