micro/auth/default.go
ben-toogood ffdf986aac
Refactor auth: add token and store implementations (#1230)
* Refactor auth: add token and memory implementations

* Fix typo

* Remove memory auth (implemented already by the store implementation), revert default to noop

* Add grpc header

* Global Config

* config/global => util/config

* Rename package to remove confict

* Tweak

* Improve Error Handling
2020-02-24 15:07:27 +00:00

37 lines
561 B
Go

package auth
var (
DefaultAuth = NewAuth()
)
// NewAuth returns a new default registry which is noop
func NewAuth(opts ...Option) Auth {
return noop{}
}
type noop struct{}
func (noop) Init(opts ...Option) error {
return nil
}
func (noop) Options() Options {
return Options{}
}
func (noop) Generate(id string, opts ...GenerateOption) (*Account, error) {
return nil, nil
}
func (noop) Revoke(token string) error {
return nil
}
func (noop) Validate(token string) (*Account, error) {
return nil, nil
}
func (noop) String() string {
return "noop"
}