Merge branch 'master' into 10231-keep-cache-runtime-constraints
[arvados.git] / services / api / config / routes.rb
index bcfe9b863638798cac34c38e9ee15a4b53a1bce2..f28390489dca3f42e14b7274407881009cc80b2f 100644 (file)
@@ -3,10 +3,19 @@ Server::Application.routes.draw do
 
   # See http://guides.rubyonrails.org/routing.html
 
+  # 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
       resources :api_client_authorizations do
         post 'create_system_auth', on: :collection
+        get 'current', on: :collection
       end
       resources :api_clients
       resources :authorized_keys
@@ -20,10 +29,18 @@ Server::Application.routes.draw do
       end
       resources :humans
       resources :job_tasks
+      resources :containers do
+        get 'auth', on: :member
+        post 'lock', on: :member
+        post 'unlock', on: :member
+        get 'current', on: :collection
+      end
+      resources :container_requests
       resources :jobs do
         get 'queue', on: :collection
         get 'queue_size', on: :collection
         post 'cancel', on: :member
+        post 'lock', on: :member
       end
       resources :keep_disks do
         post 'ping', on: :collection
@@ -38,6 +55,7 @@ Server::Application.routes.draw do
       end
       resources :pipeline_instances
       resources :pipeline_templates
+      resources :workflows
       resources :repositories do
         get 'get_all_permissions', on: :collection
       end
@@ -62,9 +80,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'