Add role management
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -35,6 +35,7 @@ import (
|
||||
"go.probo.inc/probo/pkg/server/api"
|
||||
trust_v1 "go.probo.inc/probo/pkg/server/api/trust/v1"
|
||||
auth_server "go.probo.inc/probo/pkg/server/auth"
|
||||
authz_server "go.probo.inc/probo/pkg/server/authz"
|
||||
"go.probo.inc/probo/pkg/server/trust"
|
||||
"go.probo.inc/probo/pkg/server/web"
|
||||
trust_pkg "go.probo.inc/probo/pkg/trust"
|
||||
@@ -65,6 +66,7 @@ type Server struct {
|
||||
webServer *web.Server
|
||||
trustServer *trust.Server
|
||||
authServer *auth_server.Server
|
||||
authzServer *authz_server.Server
|
||||
router *chi.Mux
|
||||
extraHeaderFields map[string]string
|
||||
proboService *probo.Service
|
||||
@@ -118,6 +120,18 @@ func NewServer(cfg Config) (*Server, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
authzServer, err := authz_server.NewServer(authz_server.Config{
|
||||
Auth: cfg.Auth,
|
||||
Authz: cfg.Authz,
|
||||
Logger: cfg.Logger.Named("authz"),
|
||||
CookieName: cfg.ConsoleAuth.CookieName,
|
||||
CookieSecret: cfg.ConsoleAuth.CookieSecret,
|
||||
CookieSecure: cfg.ConsoleAuth.CookieSecure,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
router := chi.NewRouter()
|
||||
|
||||
server := &Server{
|
||||
@@ -125,6 +139,7 @@ func NewServer(cfg Config) (*Server, error) {
|
||||
webServer: webServer,
|
||||
trustServer: trustServer,
|
||||
authServer: authServer,
|
||||
authzServer: authzServer,
|
||||
router: router,
|
||||
extraHeaderFields: cfg.ExtraHeaderFields,
|
||||
proboService: cfg.Probo,
|
||||
@@ -139,6 +154,7 @@ func NewServer(cfg Config) (*Server, error) {
|
||||
func (s *Server) setupRoutes() {
|
||||
s.router.Mount("/api", s.apiServer)
|
||||
s.router.Mount("/connect", s.authServer)
|
||||
s.router.Mount("/authz", s.authzServer)
|
||||
|
||||
s.router.Route("/trust/{slugOrId}", func(r chi.Router) {
|
||||
r.Use(s.loadTrustCenterBySlugOrID)
|
||||
|
||||
Reference in New Issue
Block a user