add route for /saml2 to get metadata

it's a SAML convention that metadata be returned from the URI of
then entity ID. also publicize this URL in authentication settings

Change-Id: If18eca61d2259cdac77c398cc957f7b77f5217d7
Reviewed-on: https://gerrit.instructure.com/76436
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2016-04-06 12:20:06 -06:00
parent 6b4df89662
commit 40e1681f6d
4 changed files with 11 additions and 1 deletions

View File

@ -55,6 +55,10 @@ class AccountAuthorizationConfig::SAML < AccountAuthorizationConfig::Delegated
[nil, self]
end
def entity_id
super || saml_default_entity_id
end
def set_saml_defaults
self.entity_id ||= saml_default_entity_id
self.requested_authn_context = nil if self.requested_authn_context.blank?

View File

@ -1,3 +1,8 @@
<p><%= mt(<<-TEXT, metadata_url: link_to(aac.entity_id, aac.entity_id))
The Canvas SAML Entity ID is %{metadata_url}, and the Service Provider metadata
is available at that URL.
TEXT
%></p>
<% css_bundle :saml_fields %>
<div class="ic-Form-control">
<%= f.label :idp_entity_id, t('IdP Entity ID'), class: 'ic-Label' %>

View File

@ -816,6 +816,7 @@ CanvasRails::Application.routes.draw do
get 'browserconfig.xml', to: 'info#browserconfig', defaults: { format: 'xml' }
post 'object_snippet' => 'context#object_snippet'
get 'saml2' => 'accounts#saml_meta_data'
get 'saml_meta_data' => 'accounts#saml_meta_data'
# Routes for course exports

View File

@ -12,7 +12,7 @@ class SetSamlEntityId < ActiveRecord::Migration
end
AccountAuthorizationConfig.where(auth_type: "saml").each do |aac|
if aac.entity_id.blank?
if aac['entity_id'].blank?
aac.entity_id = old_default_domain || aac.saml_default_entity_id
aac.save!
end