This commit is contained in:
2022-03-17 15:55:27 +08:00
commit bd5a9fad97
92 changed files with 13861 additions and 0 deletions

23
logic/auth/auth.go Normal file
View File

@@ -0,0 +1,23 @@
package auth
import "time"
var execAuth = make(map[string]CreateFunc)
type CreateFunc func(url string, timeout time.Duration) Auth
func Register(name string, exec CreateFunc) {
execAuth[name] = exec
}
func Load(name string) (CreateFunc, error) {
exec, ok := execAuth[name]
if !ok {
return nil, nil
}
return exec, nil
}
type Auth interface {
DoAuth(token string) (string, error)
}