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

@@ -57,6 +57,8 @@ type GenerateOptions struct {
Metadata map[string]string
// Roles/scopes associated with the account
Roles []string
// Namespace the account belongs too
Namespace string
}
type GenerateOption func(o *GenerateOptions)
@@ -82,6 +84,13 @@ func WithRoles(rs ...string) func(o *GenerateOptions) {
}
}
// WithNamespace for the token
func WithNamespace(n string) func(o *GenerateOptions) {
return func(o *GenerateOptions) {
o.Namespace = n
}
}
// NewGenerateOptions from a slice of options
func NewGenerateOptions(opts ...GenerateOption) GenerateOptions {
var options GenerateOptions