-
Notifications
You must be signed in to change notification settings - Fork 2
/
interfaces.go
44 lines (36 loc) · 926 Bytes
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package service
import (
"net/http"
"github.com/dpb587/ssoca/auth"
"github.com/dpb587/ssoca/server/service/req"
)
//go:generate counterfeiter . Factory
type Factory interface {
Create(string, string, map[string]interface{}) (Service, error)
}
//go:generate counterfeiter . ServiceFactory
type ServiceFactory interface {
Create(string, map[string]interface{}) (Service, error)
Type() string
}
//go:generate counterfeiter . Manager
type Manager interface {
Add(Service)
Get(string) (Service, error)
GetAuth() (AuthService, error)
Services() []string
}
//go:generate counterfeiter . Service
type Service interface {
Name() string
Type() string
Version() string
Metadata() interface{}
GetRoutes() []req.RouteHandler
VerifyAuthorization(http.Request, *auth.Token) error
}
//go:generate counterfeiter . AuthService
type AuthService interface {
Service
ParseRequestAuth(http.Request) (*auth.Token, error)
}