Fix various bad tenant isolation
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -23,20 +23,18 @@ import (
|
||||
"github.com/getprobo/probo/pkg/filemanager"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"go.gearno.de/kit/log"
|
||||
"go.gearno.de/kit/pg"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Auth *authsvc.Service
|
||||
Authz *authz.Service
|
||||
SAML *authsvc.SAMLService
|
||||
CookieName string
|
||||
CookieDomain string
|
||||
SessionDuration time.Duration
|
||||
CookieSecret string
|
||||
FileManager *filemanager.Service
|
||||
PGClient *pg.Client
|
||||
Logger *log.Logger
|
||||
Auth *authsvc.Service
|
||||
Authz *authz.Service
|
||||
SAML *authsvc.SAMLService
|
||||
CookieName string
|
||||
CookieDomain string
|
||||
SessionDuration time.Duration
|
||||
CookieSecret string
|
||||
FileManager *filemanager.Service
|
||||
Logger *log.Logger
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
@@ -46,21 +44,21 @@ type Server struct {
|
||||
func NewServer(cfg Config) (*Server, error) {
|
||||
router := chi.NewRouter()
|
||||
|
||||
MountRoutes(
|
||||
router,
|
||||
cfg.Auth,
|
||||
cfg.Authz,
|
||||
cfg.SAML,
|
||||
RoutesConfig{
|
||||
CookieName: cfg.CookieName,
|
||||
CookieDomain: cfg.CookieDomain,
|
||||
SessionDuration: cfg.SessionDuration,
|
||||
CookieSecret: cfg.CookieSecret,
|
||||
FileManager: cfg.FileManager,
|
||||
PGClient: cfg.PGClient,
|
||||
},
|
||||
cfg.Logger,
|
||||
)
|
||||
router.Post("/register", SignUpHandler(cfg.Auth, cfg.CookieName, cfg.CookieSecret))
|
||||
router.Post("/login", SignInHandler(cfg.Auth, cfg.CookieName, cfg.CookieSecret))
|
||||
router.Delete("/logout", SignOutHandler(cfg.Auth, cfg.CookieName, cfg.CookieSecret))
|
||||
router.Post("/signup-from-invitation", SignupFromInvitationHandler(cfg.Auth, cfg.CookieName, cfg.CookieSecret))
|
||||
router.Post("/forget-password", ForgetPasswordHandler(cfg.Auth))
|
||||
router.Post("/reset-password", ResetPasswordHandler(cfg.Auth))
|
||||
router.Post("/check-sso", SAMLCheckSSOHandler(cfg.Auth, cfg.Logger))
|
||||
router.Get("/organizations", RequireAuth(cfg.Auth, cfg.Authz, cfg.CookieName, cfg.CookieSecret, ListOrganizationsHandler(cfg.Auth, cfg.Authz)))
|
||||
router.Get("/organizations/{organizationID}/logo", RequireAuth(cfg.Auth, cfg.Authz, cfg.CookieName, cfg.CookieSecret, OrganizationLogoHandler(cfg.Auth, cfg.FileManager)))
|
||||
router.Get("/invitations", RequireAuth(cfg.Auth, cfg.Authz, cfg.CookieName, cfg.CookieSecret, ListInvitationsHandler(cfg.Authz)))
|
||||
router.Post("/invitations/accept", AcceptInvitationHandler(cfg.Auth, cfg.Authz, cfg.CookieName, cfg.CookieSecret))
|
||||
|
||||
router.Get("/saml/login/{samlConfigID}", SAMLLoginHandler(cfg.SAML, cfg.Auth, cfg.Logger))
|
||||
router.Post("/saml/consume", SAMLACSHandler(cfg.SAML, cfg.Auth, cfg.Authz, cfg.CookieName, cfg.CookieSecret, cfg.SessionDuration, cfg.Logger))
|
||||
router.Get("/saml/metadata", SAMLMetadataHandler(cfg.SAML))
|
||||
|
||||
return &Server{
|
||||
router: router,
|
||||
|
||||
Reference in New Issue
Block a user