generated from resonatecoop/id-server-template
/
routes.go
37 lines (33 loc) · 910 Bytes
/
routes.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
package oauth
import (
"github.com/gorilla/mux"
"github.com/litesolutions/justifay-id/util/routes"
)
const (
tokensResource = "tokens"
tokensPath = "/" + tokensResource
introspectResource = "introspect"
introspectPath = "/" + introspectResource
)
// RegisterRoutes registers route handlers for the oauth service
func (s *Service) RegisterRoutes(router *mux.Router, prefix string) {
subRouter := router.PathPrefix(prefix).Subrouter()
routes.AddRoutes(s.GetRoutes(), subRouter)
}
// GetRoutes returns []routes.Route slice for the oauth service
func (s *Service) GetRoutes() []routes.Route {
return []routes.Route{
{
Name: "oauth_tokens",
Method: "POST",
Pattern: tokensPath,
HandlerFunc: s.tokensHandler,
},
{
Name: "oauth_introspect",
Method: "POST",
Pattern: introspectPath,
HandlerFunc: s.introspectHandler,
},
}
}