Add Namespace to Auth (#1438)

Co-authored-by: Ben Toogood <ben@micro.mu>
This commit is contained in:
ben-toogood
2020-03-30 09:51:37 +01:00
committed by GitHub
parent 3d7d5ce6b4
commit 4db2f5e79d
8 changed files with 120 additions and 64 deletions

View File

@@ -73,6 +73,8 @@ type GenerateOptions struct {
Roles []string
// SecretExpiry is the time the secret should live for
SecretExpiry time.Duration
// Namespace the account belongs too
Namespace string
}
type GenerateOption func(o *GenerateOptions)
@@ -91,6 +93,13 @@ func WithRoles(rs ...string) GenerateOption {
}
}
// WithNamespace for the generated account
func WithNamespace(n string) GenerateOption {
return func(o *GenerateOptions) {
o.Namespace = n
}
}
// WithSecretExpiry for the generated account's secret expires
func WithSecretExpiry(ex time.Duration) GenerateOption {
return func(o *GenerateOptions) {