summaryrefslogtreecommitdiff
path: root/app/controllers/metadata_controller.rb
blob: a0e7bd098713ffadac28d51dcc361cb81c9d9d0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class MetadataController < ApplicationController
  force_ssl if: :ssl_configured?

  def show
    render xml: to_xml, content_type: "application/samlmetadata+xml"
  end

  private

  def to_xml
    Rails.cache.fetch(metadata_url, expires_in: 1.hour) do
      Sp.default(request).to_xml
    end
  end

  def ssl_configured?
    !Rails.env.development?
  end
end