MSP-634 add secure endpoints to routes

This commit is contained in:
DeniskaRediska authored and d1slike committed 2022-08-04 22:13:28 +03:00
1 parent fff9ddcbf8
commit dd41024768
2 files changed
+21

No files matched your search

+4
View File
@@ -10,6 +10,7 @@ import (
"isp-system-service/repository"
"isp-system-service/routes"
"isp-system-service/service"
"isp-system-service/service/secure"
"isp-system-service/transaction"
)
@@ -38,6 +39,7 @@ func (l Locator) Handler(cfg conf.Remote) isp.BackendServiceServer {
serviceRep := repository.NewService(l.db)
tokenRep := repository.NewToken(l.db)
secureService := secure.NewService(tokenRep, accessListRep)
accessListService := service.NewAccessList(txManager, accessListRep, applicationRep)
applicationService := service.NewApplication(txManager, applicationRep, domainRep, serviceRep, tokenRep)
domainService := service.NewDomain(domainRep)
@@ -48,6 +50,7 @@ func (l Locator) Handler(cfg conf.Remote) isp.BackendServiceServer {
applicationRep, domainRep, serviceRep, tokenRep,
)
secureController := controller.NewSecure(secureService)
accessListController := controller.NewAccessList(accessListService)
applicationController := controller.NewApplication(applicationService)
domainController := controller.NewDomain(domainService)
@@ -55,6 +58,7 @@ func (l Locator) Handler(cfg conf.Remote) isp.BackendServiceServer {
tokenController := controller.NewToken(tokenService)
c := routes.Controllers{
Secure: secureController,
AccessList: accessListController,
Domain: domainController,
Service: serviceController,
+17
View File
@@ -14,6 +14,7 @@ type Controllers struct {
Service controller.Service
Application controller.Application
Token controller.Token
Secure controller.Secure
}
func EndpointDescriptors() []cluster.EndpointDescriptor {
@@ -30,6 +31,7 @@ func Handler(wrapper endpoint.Wrapper, c Controllers) isp.BackendServiceServer {
func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor {
return concatCluster([][]cluster.EndpointDescriptor{
secureCluster(c),
accessListCluster(c),
domainCluster(c),
serviceCluster(c),
@@ -38,6 +40,21 @@ func endpointDescriptors(c Controllers) []cluster.EndpointDescriptor {
})
}
func secureCluster(c Controllers) []cluster.EndpointDescriptor {
return []cluster.EndpointDescriptor{
{
Path: "system/secure/authenticate",
Inner: true,
Handler: c.Secure.Authenticate,
},
{
Path: "system/secure/authorize",
Inner: true,
Handler: c.Secure.Authorize,
},
}
}
func accessListCluster(c Controllers) []cluster.EndpointDescriptor {
return []cluster.EndpointDescriptor{
{