70 lines
2.0 KiB
Ruby
70 lines
2.0 KiB
Ruby
Rails.application.routes.draw do
|
|
# Registration only allowed when no users exist
|
|
resource :registration, only: [:new, :create]
|
|
resource :session
|
|
resource :password
|
|
|
|
# OIDC authentication routes
|
|
get "/auth/failure", to: "omniauth_callbacks#failure"
|
|
get "/auth/:provider/callback", to: "omniauth_callbacks#oidc"
|
|
|
|
# Admin user management (admin only)
|
|
resources :users, only: [:index, :show, :edit, :update]
|
|
|
|
# DSN management (admin only)
|
|
resources :dsns do
|
|
member do
|
|
post :disable
|
|
post :enable
|
|
end
|
|
end
|
|
|
|
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
|
|
|
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
|
# Can be used by load balancers and uptime monitors to verify that the app is live.
|
|
get "up" => "rails/health#show", as: :rails_health_check
|
|
|
|
# WAF API
|
|
namespace :api, defaults: { format: :json } do
|
|
# Event ingestion (PRIMARY method - includes rule updates in response)
|
|
post "events", to: "events#create"
|
|
|
|
# Rule synchronization (SECONDARY - for admin/debugging only)
|
|
# Note: Agents should use event responses for rule synchronization
|
|
get "rules/version", to: "rules#version"
|
|
get "rules", to: "rules#index"
|
|
end
|
|
|
|
# Analytics dashboard
|
|
get "analytics", to: "analytics#index"
|
|
|
|
# Root path - analytics dashboard
|
|
root "analytics#index"
|
|
|
|
# Event management
|
|
resources :events, only: [:index]
|
|
|
|
# Network range management
|
|
resources :network_ranges, only: [:index, :show, :new, :create, :edit, :update, :destroy] do
|
|
member do
|
|
post :enrich
|
|
end
|
|
collection do
|
|
get :lookup
|
|
get :search
|
|
end
|
|
end
|
|
|
|
# Support CIDR patterns with dots in network range routes
|
|
get '/network_ranges/:id', to: 'network_ranges#show', constraints: { id: /[\d\.:\/_]+/ }
|
|
|
|
# Rule management
|
|
resources :rules, only: [:index, :new, :create, :show, :edit, :update] do
|
|
member do
|
|
post :disable
|
|
post :enable
|
|
end
|
|
end
|
|
end
|