Class: SSOlo::Templates::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/ssolo/templates/metadata.rb

Overview

Renders the XML details of the Identity Provider

Class Method Summary collapse

Class Method Details

.call(request, certificate) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ssolo/templates/metadata.rb', line 7

def self.call(request, certificate)
  <<~XML
    <?xml version="1.0" encoding="utf-8"?>
    <EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" entityID="#{request.base_url}/saml">
      <IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
        <KeyDescriptor>
          <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <ds:X509Data>
              <ds:X509Certificate>
                #{certificate.to_pem.lines.grep_v(/BEGIN CERTIFICATE|END CERTIFICATE/).join.strip}
              </ds:X509Certificate>
            </ds:X509Data>
          </ds:KeyInfo>
        </KeyDescriptor>
        <SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="#{request.base_url}/saml" />
      </IDPSSODescriptor>
    </EntityDescriptor>
  XML
end