lib/onelogin/ruby-saml/metadata.rb
# Return SP metadata based on the settings.
# @param settings [OneLogin::RubySaml::Settings|nil] Toolkit settings
# @param pretty_print [Boolean] Pretty print or not the response
#                               (No pretty print if you gonna validate the signature)
# @param valid_until [DateTime] Metadata's valid time
# @param cache_duration [Integer] Duration of the cache in seconds
# @return [String] XML Metadata of the Service Provider
#
Return SP metadata based on the settings.
Return SP metadata based on the settings .
def add_root_element(meta_doc, settings, valid_until, cache_duration)
        namespaces = {
            "xmlns:md" => "urn:oasis:names:tc:SAML:2.0:metadata",
            "xmlns:mdui" => "urn:oasis:names:tc:SAML:2.0:metadata:ui"
        }
        if settings.attribute_consuming_service.configured?
          namespaces["xmlns:saml"] = "urn:oasis:names:tc:SAML:2.0:assertion"
        end
        root = meta_doc.add_element("md:EntityDescriptor", namespaces)
        root.attributes["ID"] = OneLogin::RubySaml::Utils.uuid
        root.attributes["entityID"] = settings.sp_entity_id if settings.sp_entity_id
        root.attributes["validUntil"] = valid_until.strftime('%Y-%m-%dT%H:%M:%S%z') if valid_until
        root.attributes["cacheDuration"] = "PT" + cache_duration.to_s + "S" if cache_duration
        root
      end
def add_root_element ( meta_doc , settings , valid_until , cache_duration ) namespaces = { "xmlns:md" => "urn:oasis:names:tc:SAML:2.0:metadata" , "xmlns:mdui" => "urn:oasis:names:tc:SAML:2.0:metadata:ui" } if settings . attribute_consuming_service . configured? namespaces [ "xmlns:saml" ] = "urn:oasis:names:tc:SAML:2.0:assertion" end root = meta_doc . add_element ( "md:EntityDescriptor" , namespaces ) root . attributes [ "ID" ] = OneLogin :: RubySaml :: Utils . uuid root . attributes [ "entityID" ] = settings . sp_entity_id if settings . sp_entity_id root . attributes [ "validUntil" ] = valid_until . strftime ( '%Y-%m-%dT%H:%M:%S%z' ) if valid_until root . attributes [ "cacheDuration" ] = "PT" + cache_duration . to_s + "S" if cache_duration root end
Return SP metadata based on the settings.
Return SP metadata based on the settings .
XML Metadata of the Service Provider
XML Metadata of the Service Provider
String
meta_doc
settings
None
valid_until
Metadata's valid time
Metadata ' s valid time
cache_duration
Duration of the cache in seconds
Duration of the cache in seconds
pretty_print
Pretty print or not the response (No pretty print if you gonna validate the signature)
Pretty print or not the response ( No pretty print if you gonna validate the signature )