Implement new interface

This commit is contained in:
Ben Toogood
2020-03-31 18:17:01 +01:00
parent 8dbb5153f4
commit 134bc1c68a
7 changed files with 275 additions and 110 deletions

View File

@@ -34,17 +34,22 @@ func (n *noop) Options() Options {
}
// Generate a new account
func (n *noop) Generate(id string, opts ...GenerateOption) (*Account, error) {
func (n *noop) Generate(id, secret string, opts ...GenerateOption) (*Account, error) {
options := NewGenerateOptions(opts...)
return &Account{
ID: id,
Roles: options.Roles,
Metadata: options.Metadata,
Secret: uuid.New().String(),
ID: id,
Roles: options.Roles,
Metadata: options.Metadata,
RefreshToken: uuid.New().String(),
}, nil
}
// Login to an existing account
func (n *noop) Login(id, secret string) (*Account, error) {
return &Account{ID: id}, nil
}
// Grant access to a resource
func (n *noop) Grant(role string, res *Resource) error {
return nil
@@ -68,6 +73,6 @@ func (n *noop) Inspect(token string) (*Account, error) {
}
// Token generation using an account id and secret
func (n *noop) Token(id, secret string, opts ...TokenOption) (*Token, error) {
func (n *noop) Token(id, tok string, opts ...TokenOption) (*Token, error) {
return &Token{}, nil
}