'Create an object that represents a SAML AuthnStatement.
<ns0:AuthnStatement xmlns:ns0="urn:oasis:names:tc:SAML:2.0:assertion"
AuthnInstant="2014-07-30T03:04:25Z" SessionIndex="47335964efb"
SessionNotOnOrAfter="2014-07-30T03:04:26Z">
<ns0:AuthnContext>
<ns0:AuthnContextClassRef>
urn:oasis:names:tc:SAML:2.0:ac:classes:Password
</ns0:AuthnContextClassRef>
<ns0:AuthenticatingAuthority>
https://acme.com/FIM/sps/openstack/saml20
</ns0:AuthenticatingAuthority>
</ns0:AuthnContext>
</ns0:AuthnStatement>
:returns: XML <AuthnStatement> object'

def _create_authn_statement(self, issuer, expiration_time):

    authn_statement = saml.AuthnStatement()
    authn_statement.authn_instant = utils.isotime()
    authn_statement.session_index = uuid.uuid4().hex
    authn_statement.session_not_on_or_after = expiration_time
    authn_context = saml.AuthnContext()
    authn_context_class = saml.AuthnContextClassRef()
    authn_context_class.set_text(saml.AUTHN_PASSWORD)
    authn_authority = saml.AuthenticatingAuthority()
    authn_authority.set_text(issuer)
    authn_context.authn_context_class_ref = authn_context_class
    authn_context.authenticating_authority = authn_authority
    authn_statement.authn_context = authn_context
    return authn_statement
