<?xml version="1.0" encoding="UTF-8"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no" ?>
<?rfc linkmailto="no" ?>
<?rfc editing="no" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext include-index="no" ?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<rfc ipr="trust200902" docName="draft-young-md-query-saml-02" submissionType="independent" category="info">
    <front>
        <title>SAML Profile for the Metadata Query Protocol</title>

        <author initials="I.A." fullname="Ian A. Young" surname="Young" role="editor">
            <organization>Independent</organization>
            <address>
                <email>ian@iay.org.uk</email>
            </address>
        </author>

        <date/>

        <keyword>metadata</keyword>
        <keyword>SAML</keyword>

        <abstract>
            <t>
                This document profiles the <xref target="I-D.young-md-query">Metadata Query Protocol</xref> for use
                with <xref target="SAML2Meta">SAML metadata</xref>.
            </t>
            <t>
                This document is a product of the Research and Education Federations (REFEDS) Working Group process.
            </t>
        </abstract>
    </front>

    <middle>
        <section title="Introduction">

            <t>
                This document profiles the <xref target="I-D.young-md-query">Metadata Query Protocol</xref> for use
                with <xref target="SAML2Meta">SAML metadata</xref>.
            </t>
            <t>
                The Research and Education Federations group (<xref target="REFEDS"/>)
                is the voice that articulates the mutual needs of research and education
                identity federations worldwide. It aims to represent the requirements of
                research and education in the ever-growing space of access and identity
                management.
            </t>
            <t>
                From time to time REFEDS
                will wish to publish a document in the Internet RFC series.  Such
                documents will be published as part of the RFC Independent Submission
                Stream <xref target="RFC4844"/>; however the REFEDS working group sign-off process will
                have been followed for these documents, as described in
                the <xref target="REFEDS.agreement">REFEDS Participant's Agreement</xref>.
            </t>
            <t>
                This document is a product of the REFEDS Working Group process.
            </t>

            <section title="Notation and Conventions">
                <t>
                    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT",
                    "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in
                    <xref target="BCP14">RFC 2119</xref>.
                </t>
                <t>
                    This document makes use of the Augmented BNF metalanguage defined in <xref target="STD68"/>.
                </t>
            </section>

        </section>

        <section title="Request Profile">

            <section title="Content Type">
                <t>
                    Requests compliant with this profile MUST include the following HTTP header to indicate that
                    the metadata returned should be SAML metadata (see Appendix A of <xref target="SAML2Meta"/>):
                </t>
                <figure>
                    <artwork>Accept: application/samlmetadata+xml</artwork>
                </figure>
            </section>

            <section title="Identifiers" anchor="request.identifiers">

                <section title="Unique Identifier">
                    <t>
                        Each entity known to the responder MUST be associated with the unique identifier
                        of the entity, corresponding to the <spanx style="verb">entityID</spanx> attribute
                        of the entity's <spanx style="verb">EntityDescriptor</spanx> element in SAML metadata.
                    </t>
                </section>

                <section title="Transformed Identifier">
                    <t>
                        <xref target="SAML2Core">SAML 2.0</xref> includes profiles based on the transfer
                        of an "artifact" containing the unique identifier of a SAML entity transformed by
                        means of the
                        <xref target="RFC3174">SHA-1</xref> hash algorithm (see <xref target="SAML2Bind"/>
                        sections 3.6 and 3.6.4).
                    </t>
                    <t>
                        In order to support use cases in which clients may be in possession of only such a transformed
                        representation of a SAML entity's unique identifier without any way to establish the original
                        entity identifier, a responder compliant with this profile MUST associate each entity
                        with an identifier matching the
                        <spanx style="verb">sha1id</spanx> production in the following ABNF grammar, and treat
                        such an identifier as equivalent to
                        the corresponding untransformed identifier:
                    </t>
                    <figure>
                        <artwork type="abnf"><![CDATA[
SHA1     = %x73 %x68 %x61 %x31 ; lower case "sha1"
DIGIT    = %x30-39
HEXDIGIT = DIGIT | %x61-66 ; lower case a-f
sha1id   = "{" SHA1 "}" sha1hex
sha1hex  = 40*HEXDIGIT
]]></artwork>
                    </figure>
                    <t>
                        In the above, the <spanx style="verb">sha1hex</spanx> component encodes the 20-octet
                        (160-bit) binary SHA-1 hash value as a sequence of 40 lower case hexadecimal digits.
                    </t>
                    <t>
                        For example, the identifier
                    </t>
                    <figure>
                        <artwork>http://example.org/service</artwork>
                    </figure>
                    <t>
                        transformed by means of SHA-1 hashing would become
                    </t>
                    <figure>
                        <artwork>{sha1}11d72e8cf351eb6c75c721e838f469677ab41bdb</artwork>
                    </figure>
                    <t>
                        Responder implementations MAY detect malformed SHA-1 transformed identifiers
                        (for example where the string of characters
                        following the "}" contains characters other than hexadecimal digits, or is other than
                        exactly 40 characters in length) and return an HTTP status code of 400
                        ("bad request"). Alternatively, implementations MAY process these as normal
                        identifiers and return an HTTP status code of 404 ("not found") if appropriate.
                    </t>
                </section>

                <section title="Additional Identifiers">
                    <t>
                        Entities MAY also be associated with any number of additional responder-defined
                        identifiers naming arbitrary groups of entities.
                    </t>
                </section>

            </section>

        </section>

        <section title="Response Profile">

            <section title="Response Cardinality">
                <t>
                    A request may return information for any number of entities, including none. Responses compliant with
                    this profile MUST use the appropriate representation described below depending on the number of
                    <spanx style="verb">EntityDescriptor</spanx> elements returned.
                </t>
                <section title="No Entity Descriptors Returned">
                    <t>
                        A response which returns no <spanx style="verb">EntityDescriptor</spanx> elements
                        MUST be represented by an HTTP status code of 404 ("not found").
                    </t>
                </section>
                <section title="One Entity Descriptor Returned">
                    <t>
                        A response which returns a single <spanx style="verb">EntityDescriptor</spanx> element
                        MUST use that element as its document element.
                        The responder MUST NOT make use of a <spanx style="verb">EntitiesDescriptor</spanx>
                        element in this situation (see <xref target="SAML2Meta"/> section 2.3).
                    </t>
                    <t>
                        Such a response MUST include the following HTTP header to indicate that
                        the metadata returned is SAML metadata:
                    </t>
                    <figure>
                        <artwork>Content-Type: application/samlmetadata+xml</artwork>
                    </figure>
                </section>
                <section title="More Than One Entity Descriptor Returned">
                    <t>
                        A response which returns more than one <spanx style="verb">EntityDescriptor</spanx> element
                        MUST consist of a document element which is an <spanx style="verb">EntitiesDescriptor</spanx>
                        element, containing the returned <spanx style="verb">EntityDescriptor</spanx> elements
                        as children. Responses MUST NOT contain nested <spanx style="verb">EntitiesDescriptor</spanx>
                        elements.
                    </t>
                    <t>
                        Such a response MUST include the following HTTP header to indicate that
                        the metadata returned is SAML metadata:
                    </t>
                    <figure>
                        <artwork>Content-Type: application/samlmetadata+xml</artwork>
                    </figure>
                </section>
            </section>

        </section>

        <section title="Security Considerations" anchor="sec_cons">

            <section title="Integrity">
                <t>
                    As SAML metadata contains information necessary for the secure operation of interacting services it is
                    strongly RECOMMENDED that a mechanism for integrity checking is provided to clients.
                </t>
                <t>
                    It is RECOMMENDED that the integrity checking mechanism provided by a responder is a digital
                    signature embedded in the returned metadata document, as defined by
                    <xref target="SAML2Meta"/> section 3.
                </t>
                <t>
                    Such digital signatures:
                    <list style="symbols">
                        <t>SHOULD use an RSA keypair whose modulus is no less than 2048 bits in length.</t>
                        <t>SHOULD NOT use the SHA-1 cryptographic hash algorithm as a digest algorithm.</t>
                        <t>MUST NOT use the MD5 cryptographic hash algorithm as a digest algorithm.</t>
                        <t>SHOULD otherwise follow current cryptographic best practices in algorithm selection.</t>
                    </list>
                </t>
            </section>

            <section title="Use of SHA-1 in Transformed Identifiers">
                <t>
                    This profile mandates the availability of a identifier synonym mechanism based on
                    the SHA-1 cryptographic hash algorithm. Although SHA-1 is now regarded as weak enough
                    to exclude it from use in new cryptographic systems, its use in this profile is
                    necessary for full support of the SAML 2.0 standard.
                </t>
                <t>
                    Because the SHA-1 cryptographic hash is not being used within this profile in the context of a
                    digital signature, it is not believed to introduce a security concern over and above that
                    which already exists in SAML due to the possibility of a post-hash collision between entities whose
                    <spanx style="verb">entityID</spanx> attributes hash to the same value.
                </t>
                <t>
                    Implementations may guard against this possibility by treating two entities whose
                    <spanx style="verb">entityID</spanx> values have the same SHA-1 equivalent as an
                    indicator of malicious intent on the part of the owner of one of the entities.
                </t>
            </section>

        </section>

        <section title="IANA Considerations">
            <t>
                This document has no actions for IANA.
            </t>
        </section>

        <section title="Acknowledgements">
            <t>The editor would like to acknowledge the following individuals for their contributions to this document:
                <list>
                    <t>Scott Cantor (The Ohio State University)</t>
                    <t>Leif Johansson (SUNET)</t>
                    <t>Joe St Sauver (University of Oregon)</t>
                    <t>Tom Scavo (Internet2)</t>
                </list>
            </t>
        </section>

    </middle>

    <back>

        <references title="Normative References">

            <reference anchor="BCP14">
                <front>
                    <title>
                        Key words for use in RFCs to Indicate Requirement Levels
                    </title>
                    <author initials="S." surname="Bradner" fullname="Scott Bradner">
                        <organization>Harvard University</organization>
                        <address><email>sob@harvard.edu</email></address>
                    </author>
                    <date month="March" year="1997"/>
                </front>
                <seriesInfo name="BCP" value="14"/>
                <seriesInfo name="RFC" value="2119"/>
            </reference>

            <reference anchor='RFC3174'>
                <front>
                    <title>US Secure Hash Algorithm 1 (SHA1)</title>
                    <author initials='D.' surname='Eastlake' fullname='D. Eastlake'/>
                    <author initials='P.' surname='Jones' fullname='P. Jones'/>
                    <date year='2001' month='September'/>
                </front>
                <seriesInfo name='RFC' value='3174'/>
            </reference>

            <reference anchor="I-D.young-md-query">
                <front>
                    <title>Metadata Query Protocol</title>
                    <author initials="I.A." fullname="Ian A. Young" surname="Young" role="editor"/>
                    <date year='2014' month='October'/>
                </front>
                <seriesInfo name="Internet-Draft" value="draft-young-md-query-03"/>
            </reference>

            <reference anchor="SAML2Bind">
                <front>
                    <title>
                        Bindings for the Security Assertion Markup Language
                        (SAML) V2.0
                    </title>
                    <author fullname="Scott Cantor" initials="S." surname="Cantor"/>
                    <author fullname="Frederick Hirsch" initials="F." surname="Hirsch"/>
                    <author fullname="John Kemp" initials="J." surname="Kemp"/>
                    <author fullname="Rob Philpott" initials="R." surname="Philpott"/>
                    <author fullname="Eve Maler" initials="E." surname="Maler"/>
                    <date year="2005" month="March"/>
                </front>
                <seriesInfo name="OASIS Standard" value="saml-bindings-2.0-os"/>
            </reference>

            <reference anchor="SAML2Meta">
                <front>
                    <title>Metadata for the Security Assertion Markup Language
                        (SAML) V2.0</title>
                    <author fullname="Scott Cantor" initials="S." surname="Cantor">
                        <organization>Internet2</organization>
                        <address>
                            <email>cantor.2@osu.edu</email>
                        </address>
                    </author>
                    <author fullname="Jahan Moreh" initials="J." surname="Moreh">
                        <organization>Sigaba</organization>
                        <address>
                            <email>jmoreh@sigaba.com</email>
                        </address>
                    </author>
                    <author fullname="Rob Philpott" initials="R." surname="Philpott">
                        <organization>RSA Security</organization>
                        <address>
                            <email>rphilpott@rsasecurity.com</email>
                        </address>
                    </author>
                    <author fullname="Eve Maler" initials="E." surname="Maler">
                        <organization>Sun Microsystems</organization>
                        <address>
                            <email>eve.maler@sun.com</email>
                        </address>
                    </author>
                    <date year="2005" month="March"/>
                </front>
                <seriesInfo name="OASIS Standard" value="saml-metadata-2.0-os"/>
                <format type="PDF" target="http://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf"/>
            </reference>

            <reference anchor="STD68">
                <front>
                    <title>Augmented BNF for Syntax Specifications: ABNF</title>
                    <author initials="D." surname="Crocker" fullname="D. Crocker"/>
                    <author initials="P." surname="Overell" fullname="P. Overell"/>
                    <date year="2008" month="January"/>
                </front>
                <seriesInfo name="STD" value="68"/>
                <seriesInfo name="RFC" value="5234"/>
            </reference>

        </references>

        <references title="Informative References">

            <reference anchor='RFC4844'>
                <front>
                    <title>The RFC Series and RFC Editor</title>
                    <author initials='L.' surname='Daigle' fullname='L. Daigle'>
                        <organization />
                    </author>
                    <author>
                        <organization>Internet Architecture Board</organization>
                    </author>
                    <date year='2007' month='July' />
                </front>
                <seriesInfo name='RFC' value='4844' />
                <format type='TXT' octets='38752' target='http://www.rfc-editor.org/rfc/rfc4844.txt' />
            </reference>

            <reference anchor="REFEDS" target="http://www.refeds.org/">
                <front>
                    <title>REFEDS Home Page</title>
                    <author>
                        <organization>Research and Education Federations</organization>
                    </author>
                    <date/>
                </front>
            </reference>

            <reference anchor="REFEDS.agreement" target="https://refeds.org/about/about_agreement.html">
                <front>
                    <title>REFEDS Participant's Agreement</title>
                    <author>
                        <organization>Research and Education Federations</organization>
                    </author>
                    <date/>
                </front>
            </reference>

            <reference anchor="SAML2Core"
                    target="http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf">
                <front>
                    <title>Assertions and Protocol for the OASIS Security Assertion Markup Language
                        (SAML) V2.0</title>
                    <author fullname="Scott Cantor" initials="S." surname="Cantor">
                        <organization>Internet2</organization>
                        <address>
                            <email>cantor.2@osu.edu</email>
                        </address>
                    </author>
                    <author fullname="John Kemp" initials="J." surname="Kemp">
                        <organization>Nokia</organization>
                        <address>
                            <email>John.Kemp@nokia.com</email>
                        </address>
                    </author>
                    <author fullname="Rob Philpott" initials="R." surname="Philpott">
                        <organization>RSA Security</organization>
                        <address>
                            <email>rphilpott@rsasecurity.com</email>
                        </address>
                    </author>
                     <author fullname="Eve Maler" initials="E." surname="Maler">
                        <organization>Sun Microsystems</organization>
                        <address>
                            <email>eve.maler@sun.com</email>
                        </address>
                    </author>
                    <date year="2005" month="March"/>
                </front>
                <seriesInfo name="OASIS Standard" value="saml-core-2.0-os"/>
            </reference>

        </references>

        <section title="Change Log (to be removed by RFC Editor before publication)" anchor="change.log">

            <section title="Since draft-young-md-query-saml-01" anchor="changes.since.draft-young-md-query-saml-01">
                <t>
                    Bump reference to the <xref target="I-D.young-md-query">Metadata Query Protocol</xref>.
                </t>
                <t>
                    Rework <xref target="request.identifiers"/> to make the role of transformed identifiers
                    clearer. This changes the semantics slightly (malformed transformed identifiers
                    may now result in a 404 return rather than 400) but this gives implementers more
                    latitude in the way that they handle the feature.
                </t>
            </section>

            <section title="Since draft-young-md-query-saml-00" anchor="changes.since.draft-young-md-query-saml-00">
                <t>
                    Added REFEDS RFC stream boilerplate.
                </t>
            </section>

            <section title="draft-young-md-query-saml-00">
                <t>
                    Initial version.
                </t>
            </section>

        </section>

    </back>
</rfc>
