aboutsummaryrefslogtreecommitdiffstats
path: root/api/router.go
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-08-15 19:20:48 +0100
committerLeonardo Bishop <me@leonardobishop.com>2025-08-15 19:20:48 +0100
commit8f7dec8ba6b2f9bde01afd0a110596ebbd43e0ed (patch)
tree7b4f203d92f4b99b1e98fac314415e293984196b /api/router.go
parent4697556cac819c47d068819b9fc9c3b4ea84e279 (diff)
Implement OIDC
Diffstat (limited to 'api/router.go')
-rw-r--r--api/router.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/api/router.go b/api/router.go
index 423529f..38e67e6 100644
--- a/api/router.go
+++ b/api/router.go
@@ -5,6 +5,7 @@ import (
"github.com/LMBishop/confplanner/api/handlers"
"github.com/LMBishop/confplanner/api/middleware"
+ "github.com/LMBishop/confplanner/pkg/auth"
"github.com/LMBishop/confplanner/pkg/calendar"
"github.com/LMBishop/confplanner/pkg/favourites"
"github.com/LMBishop/confplanner/pkg/ical"
@@ -20,6 +21,7 @@ type ApiServices struct {
CalendarService calendar.Service
IcalService ical.Service
SessionService session.Service
+ AuthService auth.Service
}
func NewServer(apiServices ApiServices, baseURL string) *http.ServeMux {
@@ -27,9 +29,10 @@ func NewServer(apiServices ApiServices, baseURL string) *http.ServeMux {
mux := http.NewServeMux()
- mux.HandleFunc("POST /register", handlers.Register(apiServices.UserService))
- mux.HandleFunc("POST /login", handlers.Login(apiServices.UserService, apiServices.SessionService))
- mux.HandleFunc("POST /logout", mustAuthenticate(handlers.Register(apiServices.UserService)))
+ mux.HandleFunc("POST /register", handlers.Register(apiServices.UserService, apiServices.AuthService))
+ mux.HandleFunc("GET /login", handlers.GetLoginOptions(apiServices.AuthService))
+ mux.HandleFunc("POST /login/{provider}", handlers.Login(apiServices.AuthService, apiServices.SessionService))
+ mux.HandleFunc("POST /logout", mustAuthenticate(handlers.Logout(apiServices.SessionService)))
mux.HandleFunc("GET /favourites", mustAuthenticate(handlers.GetFavourites(apiServices.FavouritesService)))
mux.HandleFunc("POST /favourites", mustAuthenticate(handlers.CreateFavourite(apiServices.FavouritesService)))