4570: Rename 'auth_method' parameter to 'auth_provider' to get the terminology right.
authorPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 21 Nov 2014 15:49:52 +0000 (10:49 -0500)
committerPeter Amstutz <peter.amstutz@curoverse.com>
Fri, 21 Nov 2014 15:49:52 +0000 (10:49 -0500)
apps/workbench/app/views/users/welcome.html.erb
services/api/app/controllers/user_sessions_controller.rb
services/api/lib/josh_id.rb

index 53b2ab8bb2354be5db1dd631f8527a985aac7cd8..4541d5be29d939b736c3a7dfe313ac2317bab4cd 100644 (file)
         <%= form_tag(arvados_api_client.arvados_login_url(), :method => :get, :authenticity_token => false) do %>
           <%= hidden_field_tag 'return_to', request.url %>
           <div class="row pull-right">
-          <%= select_tag "auth_method", "<option value='google'>Google OpenID</option><option value='google_oauth2'>Google OAuth2</option>".html_safe, class: "form-control", style: "width: 15em; display: inline" %>
-         <%= button_tag class: "btn btn-primary" do %>
+
+            <%# Todo: add list of external authentications providers to
+            discovery document, then generate the option list on the fly. Right
+            now, don't provide 'auth_provider' and hope that the default one is
+            the one we want. %>
+
+            <%#= select_tag "auth_provider", "<option value='google'>Google OpenID</option><option value='google_oauth2'>Google OAuth2</option>".html_safe, class: "form-control", style: "width: 15em; display: inline" %>
+           <%= button_tag type: 'submit', name: nil, class: "btn btn-primary" do %>
             Log in to <%= Rails.configuration.site_name %> <i class="fa fa-fw fa-arrow-circle-right"></i>
           <% end %>
         </div>
index 3a5be1c7e177f20678d20395e542c6a09d5687fb..30ef63fd8f6e64815dce0c4b89d8c1f2153b6e26 100644 (file)
@@ -99,7 +99,8 @@ class UserSessionsController < ApplicationController
   # to save the return_to parameter (if it exists; see the application
   # controller). /auth/joshid bypasses the application controller.
   def login
-    auth_method = params[:auth_method] || "google"
+    auth_provider = if params[:auth_provider] then "auth_provider=#{CGI.escape(params[:auth_provider])}" else "" end
+
     if current_user and params[:return_to]
       # Already logged in; just need to send a token to the requesting
       # API client.
@@ -109,9 +110,9 @@ class UserSessionsController < ApplicationController
 
       send_api_token_to(params[:return_to], current_user)
     elsif params[:return_to]
-      redirect_to "/auth/joshid?return_to=#{CGI.escape(params[:return_to])}&auth_method=#{CGI.escape(auth_method)}"
+      redirect_to "/auth/joshid?return_to=#{CGI.escape(params[:return_to])}&#{auth_provider}"
     else
-      redirect_to "/auth/joshid?auth_method=#{CGI.escape(auth_method)}"
+      redirect_to "/auth/joshid?#{auth_provider}"
     end
   end
 
index c0efb512b469f1431c8937d681c9c374a692f5b1..a63b25104cc5b2415324a4d71fc89e75baa2ff73 100644 (file)
@@ -27,7 +27,7 @@ module OmniAuth
       end
 
       def authorize_params
-        options.authorize_params[:auth_method] = request.params['auth_method']
+        options.authorize_params[:auth_provider] = request.params['auth_provider']
         super
       end