Initial BYOW auth PoC (#29)
This commit is contained in:
1 parent
8ed560fc3e
commit
f748af7b02
21 files changed
+707
-404
No files matched your search
+27
-18
@@ -22,24 +22,25 @@ type Option func(*Options)
|
||||
|
||||
// Options - how Options are represented.
|
||||
type Options struct {
|
||||
withNoTokenScope bool
|
||||
withNoTokenValue bool
|
||||
withSkipDatabaseDestruction bool
|
||||
withSkipAuthMethodCreation bool
|
||||
withSkipOidcAuthMethodCreation bool
|
||||
withSkipScopesCreation bool
|
||||
withSkipHostResourcesCreation bool
|
||||
withSkipTargetCreation bool
|
||||
withContainerImage string
|
||||
withDialect string
|
||||
withDatabaseTemplate string
|
||||
withEventerConfig *event.EventerConfig
|
||||
withEventFlags *EventFlags
|
||||
withEventWrapper wrapping.Wrapper
|
||||
withAttributeFieldPrefix string
|
||||
withStatusCode int
|
||||
withHostPlugin func() (string, plugin.HostPluginServiceClient)
|
||||
withEventGating bool
|
||||
withNoTokenScope bool
|
||||
withNoTokenValue bool
|
||||
withSkipDatabaseDestruction bool
|
||||
withSkipAuthMethodCreation bool
|
||||
withSkipOidcAuthMethodCreation bool
|
||||
withSkipScopesCreation bool
|
||||
withSkipHostResourcesCreation bool
|
||||
withSkipTargetCreation bool
|
||||
withContainerImage string
|
||||
withDialect string
|
||||
withDatabaseTemplate string
|
||||
withEventerConfig *event.EventerConfig
|
||||
withEventFlags *EventFlags
|
||||
withEventWrapper wrapping.Wrapper
|
||||
withAttributeFieldPrefix string
|
||||
withStatusCode int
|
||||
withHostPlugin func() (string, plugin.HostPluginServiceClient)
|
||||
withEventGating bool
|
||||
withSkipWorkerAuthKmsInstantiation bool
|
||||
}
|
||||
|
||||
func getDefaultOptions() Options {
|
||||
@@ -188,3 +189,11 @@ func WithEventGating(with bool) Option {
|
||||
o.withEventGating = with
|
||||
}
|
||||
}
|
||||
|
||||
// WithSkipWorkerAuthKmsInstantiation causes KMS methods used for worker-auth to
|
||||
// not be processed, useful for dev mode
|
||||
func WithSkipWorkerAuthKmsInstantiation(with bool) Option {
|
||||
return func(o *Options) {
|
||||
o.withSkipWorkerAuthKmsInstantiation = with
|
||||
}
|
||||
}
|
||||
@@ -517,7 +517,9 @@ func (b *Server) SetupListeners(ui cli.Ui, config *configutil.SharedConfig, allo
|
||||
|
||||
// SetupKMSes takes in a parsed config, does some minor checking on purposes,
|
||||
// and sends each off to configutil to instantiate a wrapper.
|
||||
func (b *Server) SetupKMSes(ctx context.Context, ui cli.Ui, config *config.Config) error {
|
||||
func (b *Server) SetupKMSes(ctx context.Context, ui cli.Ui, config *config.Config, opt ...Option) error {
|
||||
opts := getOpts(opt...)
|
||||
|
||||
sharedConfig := config.SharedConfig
|
||||
var pluginLogger hclog.Logger
|
||||
var err error
|
||||
@@ -527,7 +529,11 @@ func (b *Server) SetupKMSes(ctx context.Context, ui cli.Ui, config *config.Confi
|
||||
switch purpose {
|
||||
case "":
|
||||
return errors.New("KMS block missing 'purpose'")
|
||||
case globals.KmsPurposeRoot, globals.KmsPurposeWorkerAuth, globals.KmsPurposeConfig:
|
||||
case globals.KmsPurposeWorkerAuth:
|
||||
if opts.withSkipWorkerAuthKmsInstantiation {
|
||||
continue
|
||||
}
|
||||
case globals.KmsPurposeRoot, globals.KmsPurposeConfig:
|
||||
case globals.KmsPurposeRecovery:
|
||||
if config.Controller != nil && config.DevRecoveryKey != "" {
|
||||
kms.Config["key"] = config.DevRecoveryKey
|
||||
|
||||
Reference in new issue
Block a user