github.com/resonatecoop/id@v1.1.0-43/oauth/routes.go (about) 1 package oauth 2 3 import ( 4 "github.com/gorilla/mux" 5 "github.com/resonatecoop/id/util/routes" 6 ) 7 8 const ( 9 tokensResource = "tokens" 10 tokensPath = "/" + tokensResource 11 introspectResource = "introspect" 12 introspectPath = "/" + introspectResource 13 ) 14 15 // RegisterRoutes registers route handlers for the oauth service 16 func (s *Service) RegisterRoutes(router *mux.Router, prefix string) { 17 subRouter := router.PathPrefix(prefix).Subrouter() 18 routes.AddRoutes(s.GetRoutes(), subRouter) 19 } 20 21 // GetRoutes returns []routes.Route slice for the oauth service 22 func (s *Service) GetRoutes() []routes.Route { 23 return []routes.Route{ 24 { 25 Name: "oauth_tokens", 26 Method: "POST", 27 Pattern: tokensPath, 28 HandlerFunc: s.tokensHandler, 29 }, 30 { 31 Name: "oauth_introspect", 32 Method: "POST", 33 Pattern: introspectPath, 34 HandlerFunc: s.introspectHandler, 35 }, 36 } 37 }