Skip to content

Commit

Permalink
(BEDS-464) auth check for dashboard endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
LuccaBitfly committed Sep 18, 2024
1 parent d41db98 commit 3e3a760
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/pkg/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,6 @@ func addNotificationRoutes(hs *handlers.HandlerService, publicRouter, internalRo
endpoints := []endpoint{
{http.MethodGet, "", hs.PublicGetUserNotifications, hs.InternalGetUserNotifications},
{http.MethodGet, "/dashboards", hs.PublicGetUserNotificationDashboards, hs.InternalGetUserNotificationDashboards},
{http.MethodGet, "/validator-dashboards/{dashboard_id}/groups/{group_id}/epochs/{epoch}", hs.PublicGetUserNotificationsValidatorDashboard, hs.InternalGetUserNotificationsValidatorDashboard},
{http.MethodGet, "/account-dashboards/{dashboard_id}/groups/{group_id}/epochs/{epoch}", hs.PublicGetUserNotificationsAccountDashboard, hs.InternalGetUserNotificationsAccountDashboard},
{http.MethodGet, "/machines", hs.PublicGetUserNotificationMachines, hs.InternalGetUserNotificationMachines},
{http.MethodGet, "/clients", hs.PublicGetUserNotificationClients, hs.InternalGetUserNotificationClients},
{http.MethodGet, "/rocket-pool", hs.PublicGetUserNotificationRocketPool, hs.InternalGetUserNotificationRocketPool},
Expand All @@ -339,11 +337,14 @@ func addNotificationRoutes(hs *handlers.HandlerService, publicRouter, internalRo

publicDashboardNotificationSettingsRouter := publicNotificationRouter.NewRoute().Subrouter()
internalDashboardNotificationSettingsRouter := internalNotificationRouter.NewRoute().Subrouter()
// TODO add adb auth middleware to account dashboard endpoints once they are implemented
if !debug {
publicDashboardNotificationSettingsRouter.Use(hs.VDBAuthMiddleware)
internalDashboardNotificationSettingsRouter.Use(hs.VDBAuthMiddleware)
}
dashboardSettingsEndpoints := []endpoint{
{http.MethodGet, "/validator-dashboards/{dashboard_id}/groups/{group_id}/epochs/{epoch}", hs.PublicGetUserNotificationsValidatorDashboard, hs.InternalGetUserNotificationsValidatorDashboard},
{http.MethodGet, "/account-dashboards/{dashboard_id}/groups/{group_id}/epochs/{epoch}", hs.PublicGetUserNotificationsAccountDashboard, hs.InternalGetUserNotificationsAccountDashboard},
{http.MethodPut, "/settings/validator-dashboards/{dashboard_id}/groups/{group_id}", hs.PublicPutUserNotificationSettingsValidatorDashboard, hs.InternalPutUserNotificationSettingsValidatorDashboard},
{http.MethodPut, "/settings/account-dashboards/{dashboard_id}/groups/{group_id}", hs.PublicPutUserNotificationSettingsAccountDashboard, hs.InternalPutUserNotificationSettingsAccountDashboard},
}
Expand Down

0 comments on commit 3e3a760

Please sign in to comment.