2020-02-03 11:16:02 +03:00
|
|
|
package auth
|
|
|
|
|
|
|
|
var (
|
2020-02-24 18:07:27 +03:00
|
|
|
DefaultAuth = NewAuth()
|
2020-02-03 11:16:02 +03:00
|
|
|
)
|
|
|
|
|
2020-02-24 18:07:27 +03:00
|
|
|
// NewAuth returns a new default registry which is noop
|
|
|
|
func NewAuth(opts ...Option) Auth {
|
|
|
|
return noop{}
|
2020-02-03 11:16:02 +03:00
|
|
|
}
|
|
|
|
|
2020-02-24 18:07:27 +03:00
|
|
|
type noop struct{}
|
2020-02-03 11:16:02 +03:00
|
|
|
|
2020-02-24 18:07:27 +03:00
|
|
|
func (noop) Init(opts ...Option) error {
|
2020-02-03 11:16:02 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-24 18:07:27 +03:00
|
|
|
func (noop) Options() Options {
|
|
|
|
return Options{}
|
2020-02-10 11:26:28 +03:00
|
|
|
}
|
|
|
|
|
2020-02-24 18:07:27 +03:00
|
|
|
func (noop) Generate(id string, opts ...GenerateOption) (*Account, error) {
|
2020-02-03 11:16:02 +03:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2020-02-24 18:07:27 +03:00
|
|
|
func (noop) Revoke(token string) error {
|
2020-02-03 11:16:02 +03:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-02-24 18:07:27 +03:00
|
|
|
func (noop) Validate(token string) (*Account, error) {
|
2020-02-03 11:16:02 +03:00
|
|
|
return nil, nil
|
|
|
|
}
|
2020-02-24 18:07:27 +03:00
|
|
|
|
|
|
|
func (noop) String() string {
|
|
|
|
return "noop"
|
|
|
|
}
|