auth: rename auth.Namespace to auth.Issuer (#1710)

This commit is contained in:
ben-toogood
2020-06-17 12:26:27 +01:00
committed by GitHub
parent 2efb459c66
commit 9d3365c4be
6 changed files with 31 additions and 31 deletions

View File

@@ -53,7 +53,7 @@ func (n *noop) Generate(id string, opts ...GenerateOption) (*Account, error) {
Secret: options.Secret,
Metadata: options.Metadata,
Scopes: options.Scopes,
Issuer: n.Options().Namespace,
Issuer: n.Options().Issuer,
}, nil
}
@@ -79,7 +79,7 @@ func (n *noop) Verify(acc *Account, res *Resource, opts ...VerifyOption) error {
// Inspect a token
func (n *noop) Inspect(token string) (*Account, error) {
return &Account{ID: uuid.New().String(), Issuer: n.Options().Namespace}, nil
return &Account{ID: uuid.New().String(), Issuer: n.Options().Issuer}, nil
}
// Token generation using an account id and secret

View File

@@ -56,7 +56,7 @@ func (j *jwt) Generate(id string, opts ...auth.GenerateOption) (*auth.Account, e
Type: options.Type,
Scopes: options.Scopes,
Metadata: options.Metadata,
Issuer: j.Options().Namespace,
Issuer: j.Options().Issuer,
}
// generate a JWT secret which can be provided to the Token() method

View File

@@ -22,8 +22,8 @@ func NewOptions(opts ...Option) Options {
}
type Options struct {
// Namespace the service belongs to
Namespace string
// Issuer of the service's account
Issuer string
// ID is the services auth ID
ID string
// Secret is used to authenticate the service
@@ -55,10 +55,10 @@ func Addrs(addrs ...string) Option {
}
}
// Namespace the service belongs to
func Namespace(n string) Option {
// Issuer of the services account
func Issuer(i string) Option {
return func(o *Options) {
o.Namespace = n
o.Issuer = i
}
}