<%= 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>
# 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.
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