support both stateful and stateless authenticate

Update the initialization logic for the authenticate, authorize, and
proxy services to automatically select between the stateful
authentication flow and the stateless authentication flow, depending on
whether Pomerium is configured to use the hosted authenticate service.
This commit is contained in:
Kenneth Jenkins 2023-12-06 14:08:35 -08:00
parent c01d0e045d
commit f7dc76c6e5
6 changed files with 51 additions and 12 deletions

View file

@ -144,13 +144,17 @@ func newAuthenticateStateFromConfig(
}
}
state.flow, err = authenticateflow.NewStateless(
cfg,
cookieStore,
authenticateConfig.getIdentityProvider,
authenticateConfig.profileTrimFn,
authenticateConfig.authEventFn,
)
if cfg.Options.UseStatelessAuthenticateFlow() {
state.flow, err = authenticateflow.NewStateless(
cfg,
cookieStore,
authenticateConfig.getIdentityProvider,
authenticateConfig.profileTrimFn,
authenticateConfig.authEventFn,
)
} else {
state.flow, err = authenticateflow.NewStateful(cfg, cookieStore)
}
if err != nil {
return nil, err
}