4904: Moved to services/, finished first draft documentation.
[arvados.git] / services / api / config / routes.rb
index 096a0a58981db643bf1c893671e2657e163da14d..27fd67cece046268f449a8cc18ad35b30d128b44 100644 (file)
@@ -3,8 +3,13 @@ Server::Application.routes.draw do
 
   # See http://guides.rubyonrails.org/routing.html
 
-  # OPTIONS requests just get an empty response with CORS headers.
-  match '*a', :to => 'static#empty', :via => 'OPTIONS'
+  # OPTIONS requests are not allowed at routes that use cookies.
+  ['/auth/*a', '/login', '/logout'].each do |nono|
+    match nono, :to => 'user_sessions#cross_origin_forbidden', :via => 'OPTIONS'
+  end
+  # OPTIONS at discovery and API paths get an empty response with CORS headers.
+  match '/discovery/v1/*a', :to => 'static#empty', :via => 'OPTIONS'
+  match '/arvados/v1/*a', :to => 'static#empty', :via => 'OPTIONS'
 
   namespace :arvados do
     namespace :v1 do
@@ -66,9 +71,15 @@ Server::Application.routes.draw do
     end
   end
 
+  if Rails.env == 'test'
+    post '/database/reset', to: 'database#reset'
+  end
+
   # omniauth
   match '/auth/:provider/callback', :to => 'user_sessions#create'
   match '/auth/failure', :to => 'user_sessions#failure'
+  # not handled by omniauth provider -> 403 with no CORS headers.
+  get '/auth/*a', :to => 'user_sessions#cross_origin_forbidden'
 
   # Custom logout
   match '/login', :to => 'user_sessions#login'