micro/auth/default.go
Asim Aslam 6aaaf54275
add MICRO_AUTH_TOKEN, parse token in wrapper, preload config and othe… (#1261)
* add MICRO_AUTH_TOKEN, parse token in wrapper, preload config and other things

* fix wrapper panic
2020-02-25 22:15:44 +00:00

48 lines
716 B
Go

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