fn add_subject<W: Write>(subjectdata: &SubjectData, writer: &mut EventWriter<W>) {
    // start subject statement
    write_event(XmlEvent::start_element(("saml", "Subject")).into(), writer);
    // start nameid statement
    // TODO: nameid can be 0 or more of NameQualifier or SPNameQualifier
    write_event(
        XmlEvent::start_element(("saml", "NameID"))
            .attr("Format", &subjectdata.nameid_format.to_string())
            .attr(
                subjectdata.qualifier.unwrap().to_string().as_str(),
                subjectdata.qualifier_value.as_ref().unwrap(),
            )
            .into(),
        writer,
    );

    write_event(XmlEvent::characters(&subjectdata.nameid_value), writer);
    // end nameid statement
    write_event(XmlEvent::end_element().into(), writer);

    //start subjectconfirmation
    write_event(
        XmlEvent::start_element(("saml", "SubjectConfirmation"))
            .attr("Method", "urn:oasis:names:tc:SAML:2.0:cm:bearer")
            .into(),
        writer,
    );

    //start subjectconfirmationdata
    write_event(
        XmlEvent::start_element(("saml", "SubjectConfirmationData"))
            .attr("InResponseTo", &subjectdata.relay_state)
            .attr(
                "NotOnOrAfter",
                &subjectdata
                    .subject_not_on_or_after
                    .to_saml_datetime_string(),
            )
            .attr("Recipient", &subjectdata.acs)
            .into(),
        writer,
    );

    //end subjectconfirmationdata
    write_event(XmlEvent::end_element().into(), writer);
    //end subjectconfirmation
    write_event(XmlEvent::end_element().into(), writer);

    write_event(XmlEvent::end_element().into(), writer);
    // end subject statement
}
/// Adds the Subject statement to an assertion
Adds the Subject statement to an assertion
Adds the Subject statement to an assertion
fn add_subject<W: Write>(subjectdata: &SubjectData, writer: &mut EventWriter<W>) {
    // start subject statement
    write_event(XmlEvent::start_element(("saml", "Subject")).into(), writer);
    // start nameid statement
    // TODO: nameid can be 0 or more of NameQualifier or SPNameQualifier
    write_event(
        XmlEvent::start_element(("saml", "NameID"))
            .attr("Format", &subjectdata.nameid_format.to_string())
            .attr(
                subjectdata.qualifier.unwrap().to_string().as_str(),
                subjectdata.qualifier_value.as_ref().unwrap(),
            )
            .into(),
        writer,
    );
    write_event(XmlEvent::characters(&subjectdata.nameid_value), writer);
    // end nameid statement
    write_event(XmlEvent::end_element().into(), writer);
    //start subjectconfirmation
    write_event(
        XmlEvent::start_element(("saml", "SubjectConfirmation"))
            .attr("Method", "urn:oasis:names:tc:SAML:2.0:cm:bearer")
            .into(),
        writer,
    );
    //start subjectconfirmationdata
    write_event(
        XmlEvent::start_element(("saml", "SubjectConfirmationData"))
            .attr("InResponseTo", &subjectdata.relay_state)
            .attr(
                "NotOnOrAfter",
                &subjectdata
                    .subject_not_on_or_after
                    .to_saml_datetime_string(),
            )
            .attr("Recipient", &subjectdata.acs)
            .into(),
        writer,
    );
    //end subjectconfirmationdata
    write_event(XmlEvent::end_element().into(), writer);
    //end subjectconfirmation
    write_event(XmlEvent::end_element().into(), writer);
    write_event(XmlEvent::end_element().into(), writer);
    // end subject statement
}
fn add_subject < W : Write > ( subjectdata : & SubjectData , writer : & mut EventWriter < W > ) { // start subject statement write_event ( XmlEvent :: start_element ( ( " " , " " ) ) . into ( ) , writer ) ; // start nameid statement // TODO: nameid can be 0 or more of NameQualifier or SPNameQualifier write_event ( XmlEvent :: start_element ( ( " " , " " ) ) . attr ( " " , & subjectdata . nameid_format . to_string ( ) ) . attr ( subjectdata . qualifier . unwrap ( ) . to_string ( ) . as_str ( ) , subjectdata . qualifier_value . as_ref ( ) . unwrap ( ) , ) . into ( ) , writer , ) ; write_event ( XmlEvent :: characters ( & subjectdata . nameid_value ) , writer ) ; // end nameid statement write_event ( XmlEvent :: end_element ( ) . into ( ) , writer ) ; //start subjectconfirmation write_event ( XmlEvent :: start_element ( ( " " , " " ) ) . attr ( " " , " " ) . into ( ) , writer , ) ; //start subjectconfirmationdata write_event ( XmlEvent :: start_element ( ( " " , " " ) ) . attr ( " " , & subjectdata . relay_state ) . attr ( " " , & subjectdata . subject_not_on_or_after . to_saml_datetime_string ( ) , ) . attr ( " " , & subjectdata . acs ) . into ( ) , writer , ) ; //end subjectconfirmationdata write_event ( XmlEvent :: end_element ( ) . into ( ) , writer ) ; //end subjectconfirmation write_event ( XmlEvent :: end_element ( ) . into ( ) , writer ) ; write_event ( XmlEvent :: end_element ( ) . into ( ) , writer ) ; // end subject statement }
Adds the Subject statement to an assertion
Adds the Subject statement to an assertion
subjectdata
&SubjectData
writer
&mut EventWriter<W>
subjectdata
&SubjectData
writer
&mut EventWriter<W>