mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-03 00:40:25 +02:00
authenticate: support for per-route client id and client secret (#3030)
* implement dynamic provider support * authenticate: support per-route client id and secret
This commit is contained in:
parent
99ffaf233d
commit
f9b95a276b
19 changed files with 557 additions and 183 deletions
29
authenticate/config.go
Normal file
29
authenticate/config.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
package authenticate
|
||||
|
||||
import (
|
||||
"github.com/pomerium/pomerium/config"
|
||||
"github.com/pomerium/pomerium/internal/identity"
|
||||
)
|
||||
|
||||
type authenticateConfig struct {
|
||||
getIdentityProvider func(options *config.Options, idpID string) (identity.Authenticator, error)
|
||||
}
|
||||
|
||||
// An Option customizes the Authenticate config.
|
||||
type Option func(*authenticateConfig)
|
||||
|
||||
func getAuthenticateConfig(options ...Option) *authenticateConfig {
|
||||
cfg := new(authenticateConfig)
|
||||
WithGetIdentityProvider(defaultGetIdentityProvider)(cfg)
|
||||
for _, option := range options {
|
||||
option(cfg)
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
// WithGetIdentityProvider sets the getIdentityProvider function in the config.
|
||||
func WithGetIdentityProvider(getIdentityProvider func(options *config.Options, idpID string) (identity.Authenticator, error)) Option {
|
||||
return func(cfg *authenticateConfig) {
|
||||
cfg.getIdentityProvider = getIdentityProvider
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue