def get_nameid_data(self):
nameid = None<EOL>nameid_data = {}<EOL>encrypted_id_data_nodes = self.__query_assertion('<STR_LIT>')<EOL>if encrypted_id_data_nodes:<EOL><INDENT>encrypted_data = encrypted_id_data_nodes[<NUM_LIT:0>]<EOL>key = self.__settings.get_sp_key()<EOL>nameid = OneLogin_Saml2_Utils.decrypt_element(encrypted_data, key)<EOL><DEDENT>else:<EOL><INDENT>nameid_nodes = self.__query_assertion('<STR_LIT>')<EOL>if nameid_nodes:<EOL><INDENT>nameid = nameid_nodes[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>is_strict = self.__settings.is_strict()<EOL>want_nameid = self.__settings.get_security_data().get('<STR_LIT>', True)<EOL>if nameid is None:<EOL><INDENT>if is_strict and want_nameid:<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>',<EOL>OneLogin_Saml2_ValidationError.NO_NAMEID<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if is_strict and want_nameid and not OneLogin_Saml2_XML.element_text(nameid):<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>',<EOL>OneLogin_Saml2_ValidationError.EMPTY_NAMEID<EOL>)<EOL><DEDENT>nameid_data = {'<STR_LIT>': OneLogin_Saml2_XML.element_text(nameid)}<EOL>for attr in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>value = nameid.get(attr, None)<EOL>if value:<EOL><INDENT>if is_strict and attr == '<STR_LIT>':<EOL><INDENT>sp_data = self.__settings.get_sp_data()<EOL>sp_entity_id = sp_data.get('<STR_LIT>', '<STR_LIT>')<EOL>if sp_entity_id != value:<EOL><INDENT>raise OneLogin_Saml2_ValidationError(<EOL>'<STR_LIT>',<EOL>OneLogin_Saml2_ValidationError.SP_NAME_QUALIFIER_NAME_MISMATCH<EOL>)<EOL><DEDENT><DEDENT>nameid_data[attr] = value<EOL><DEDENT><DEDENT><DEDENT>return nameid_data<EOL>
Gets the NameID Data provided by the SAML Response from the IdP

:returns: Name ID Data (Value, Format, NameQualifier, SPNameQualifier)
:rtype: dict