allow sso settings to be configured without constraint
canvas auth counts as a provider, and even with just canvas auth a school may want to send to their website first Change-Id: Icfd833b0c0786334d98e21011a66af8146280c0b Reviewed-on: https://gerrit.instructure.com/57543 Tested-by: Jenkins Reviewed-by: Rob Orton <rob@instructure.com> QA-Review: August Thornton <august@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
48490dce8c
commit
ab2f304a7e
|
@ -649,11 +649,7 @@ class AccountAuthorizationConfigsController < ApplicationController
|
|||
|
||||
@account.reload
|
||||
|
||||
if @account.authentication_providers.active.count > 1 && params[:discovery_url] && params[:discovery_url] != ''
|
||||
@account.auth_discovery_url = params[:discovery_url]
|
||||
else
|
||||
@account.auth_discovery_url = nil
|
||||
end
|
||||
@account.auth_discovery_url = params[:discovery_url].presence
|
||||
@account.save!
|
||||
|
||||
render :json => aacs_json(@account.authentication_providers.active)
|
||||
|
@ -692,11 +688,7 @@ class AccountAuthorizationConfigsController < ApplicationController
|
|||
#
|
||||
# @returns DiscoveryUrl
|
||||
def update_discovery_url
|
||||
if params[:discovery_url] && params[:discovery_url] != ''
|
||||
@account.auth_discovery_url = params[:discovery_url]
|
||||
else
|
||||
@account.auth_discovery_url = nil
|
||||
end
|
||||
@account.auth_discovery_url = params[:discovery_url].presence
|
||||
|
||||
if @account.save
|
||||
render :json => {:discovery_url => @account.auth_discovery_url}
|
||||
|
|
|
@ -18,11 +18,6 @@ class AccountAuthorizationConfigsPresenter
|
|||
end.compact
|
||||
end
|
||||
|
||||
def needs_discovery_url?
|
||||
configs.count >= 2 &&
|
||||
configs.any?{|c| !c.is_a?(AccountAuthorizationConfig::LDAP) }
|
||||
end
|
||||
|
||||
def needs_unknown_user_url?
|
||||
configs.any? { |c| c.is_a?(AccountAuthorizationConfig::Delegated) }
|
||||
end
|
||||
|
|
|
@ -27,21 +27,19 @@
|
|||
"Leave blank for default Canvas behavior") %>
|
||||
</div>
|
||||
</div>
|
||||
<% if presenter.needs_discovery_url? %>
|
||||
<div class="ic-Form-control">
|
||||
<%= f.label :auth_discovery_url, t("Discovery URL"),
|
||||
class: 'ic-Label' %>
|
||||
<%= f.text_field :auth_discovery_url, class: 'ic-Input' %>
|
||||
<div class="help-box">
|
||||
<%= t('discovery_url_description', <<-TEXT)
|
||||
<div class="ic-Form-control">
|
||||
<%= f.label :auth_discovery_url, t("Discovery URL"),
|
||||
class: 'ic-Label' %>
|
||||
<%= f.text_field :auth_discovery_url, class: 'ic-Input' %>
|
||||
<div class="help-box">
|
||||
<%= t('discovery_url_description', <<-TEXT)
|
||||
If a discovery URL is set, Canvas will forward all users to that URL when they need to be authenticated.
|
||||
That page will need to then help the user figure out where they need to go to log in.
|
||||
If no discovery URL is configured, the first configuration will be used to attempt to authenticate the user.
|
||||
TEXT
|
||||
%>
|
||||
</div>
|
||||
TEXT
|
||||
%>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if presenter.needs_unknown_user_url? %>
|
||||
<div class="ic-Form-control">
|
||||
<%= f.label :unknown_user_url, t("Unknown User URL"),
|
||||
|
|
|
@ -64,10 +64,8 @@
|
|||
</p>
|
||||
<% end %>
|
||||
|
||||
<% if @presenter.configs.size >= 1 %>
|
||||
<%= render partial: 'sso_settings_form',
|
||||
locals: { presenter: @presenter, account: @account }%>
|
||||
<% end %>
|
||||
<%= render partial: 'sso_settings_form',
|
||||
locals: { presenter: @presenter, account: @account }%>
|
||||
|
||||
<h2><%= t("Current Provider") %></h2>
|
||||
|
||||
|
|
|
@ -188,12 +188,6 @@ describe "AccountAuthorizationConfigs API", type: :request do
|
|||
update_saml({:account_authorization_config => {"0" => @saml1, "1" => @saml2}, :discovery_url => ''})
|
||||
@account.reload
|
||||
expect(@account.auth_discovery_url).to eq nil
|
||||
|
||||
@account.auth_discovery_url = 'http://example.com/auth_discovery'
|
||||
@account.save!
|
||||
update_saml({:account_authorization_config => {"0" => @saml1}, :discovery_url => 'http://example.com/wutwut'})
|
||||
@account.reload
|
||||
expect(@account.auth_discovery_url).to eq nil
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue