def __init__(self, settings, request=None, name_id=None, session_index=None, nq=None, name_id_format=None):
        """
        Constructs the Logout Request object.

        :param settings: Setting data
        :type settings: OneLogin_Saml2_Settings

        :param request: Optional. A LogoutRequest to be loaded instead build one.
        :type request: string

        :param name_id: The NameID that will be set in the LogoutRequest.
        :type name_id: string

        :param session_index: SessionIndex that identifies the session of the user.
        :type session_index: string

        :param nq: IDP Name Qualifier
        :type: string

        :param name_id_format: The NameID Format that will be set in the LogoutRequest.
        :type: string
        """
        self.__settings = settings
        self.__error = None
        self.id = None

        if request is None:
            sp_data = self.__settings.get_sp_data()
            idp_data = self.__settings.get_idp_data()
            security = self.__settings.get_security_data()

            uid = OneLogin_Saml2_Utils.generate_unique_id()
            self.id = uid

            issue_instant = OneLogin_Saml2_Utils.parse_time_to_SAML(OneLogin_Saml2_Utils.now())

            cert = None
            if security['nameIdEncrypted']:
                exists_multix509enc = 'x509certMulti' in idp_data and \
                    'encryption' in idp_data['x509certMulti'] and \
                    idp_data['x509certMulti']['encryption']
                if exists_multix509enc:
                    cert = idp_data['x509certMulti']['encryption'][0]
                else:
                    cert = idp_data['x509cert']

            if name_id is not None:
                if not name_id_format and sp_data['NameIDFormat'] != OneLogin_Saml2_Constants.NAMEID_UNSPECIFIED:
                    name_id_format = sp_data['NameIDFormat']
            else:
                name_id_format = OneLogin_Saml2_Constants.NAMEID_ENTITY

            sp_name_qualifier = None
            if name_id_format == OneLogin_Saml2_Constants.NAMEID_ENTITY:
                name_id = idp_data['entityId']
                nq = None
            elif nq is not None:
                # We only gonna include SPNameQualifier if NameQualifier is provided
                sp_name_qualifier = sp_data['entityId']

            name_id_obj = OneLogin_Saml2_Utils.generate_name_id(
                name_id,
                sp_name_qualifier,
                name_id_format,
                cert,
                False,
                nq
            )

            if session_index:
                session_index_str = '<samlp:SessionIndex>%s</samlp:SessionIndex>' % session_index
            else:
                session_index_str = ''

            logout_request = OneLogin_Saml2_Templates.LOGOUT_REQUEST % \
                {
                    'id': uid,
                    'issue_instant': issue_instant,
                    'single_logout_url': idp_data['singleLogoutService']['url'],
                    'entity_id': sp_data['entityId'],
                    'name_id': name_id_obj,
                    'session_index': session_index_str,
                }
        else:
            logout_request = OneLogin_Saml2_Utils.decode_base64_and_inflate(request, ignore_zip=True)
            self.id = self.get_id(logout_request)

        self.__logout_request = compat.to_string(logout_request)
def __init__ ( self , settings , request = None , name_id = None , session_index = None , nq = None , name_id_format = None ) : self . __settings = settings self . __error = None self . id = None if request is None : sp_data = self . __settings . get_sp_data ( ) idp_data = self . __settings . get_idp_data ( ) security = self . __settings . get_security_data ( ) uid = OneLogin_Saml2_Utils . generate_unique_id ( ) self . id = uid issue_instant = OneLogin_Saml2_Utils . parse_time_to_SAML ( OneLogin_Saml2_Utils . now ( ) ) cert = None if security [ 'nameIdEncrypted' ] : exists_multix509enc = 'x509certMulti' in idp_data and 'encryption' in idp_data [ 'x509certMulti' ] and idp_data [ 'x509certMulti' ] [ 'encryption' ] if exists_multix509enc : cert = idp_data [ 'x509certMulti' ] [ 'encryption' ] [ 0 ] else : cert = idp_data [ 'x509cert' ] if name_id is not None : if not name_id_format and sp_data [ 'NameIDFormat' ] != OneLogin_Saml2_Constants . NAMEID_UNSPECIFIED : name_id_format = sp_data [ 'NameIDFormat' ] else : name_id_format = OneLogin_Saml2_Constants . NAMEID_ENTITY sp_name_qualifier = None if name_id_format == OneLogin_Saml2_Constants . NAMEID_ENTITY : name_id = idp_data [ 'entityId' ] nq = None elif nq is not None : sp_name_qualifier = sp_data [ 'entityId' ] name_id_obj = OneLogin_Saml2_Utils . generate_name_id ( name_id , sp_name_qualifier , name_id_format , cert , False , nq ) if session_index : session_index_str = '<samlp:SessionIndex>%s</samlp:SessionIndex>' % session_index else : session_index_str = '' logout_request = OneLogin_Saml2_Templates . LOGOUT_REQUEST % { 'id' : uid , 'issue_instant' : issue_instant , 'single_logout_url' : idp_data [ 'singleLogoutService' ] [ 'url' ] , 'entity_id' : sp_data [ 'entityId' ] , 'name_id' : name_id_obj , 'session_index' : session_index_str , } else : logout_request = OneLogin_Saml2_Utils . decode_base64_and_inflate ( request , ignore_zip = True ) self . id = self . get_id ( logout_request ) self . __logout_request = compat . to_string ( logout_request )
Constructs the Logout Request object.

        :param settings: Setting data
        :type settings: OneLogin_Saml2_Settings

        :param request: Optional. A LogoutRequest to be loaded instead build one.
        :type request: string

        :param name_id: The NameID that will be set in the LogoutRequest.
        :type name_id: string

        :param session_index: SessionIndex that identifies the session of the user.
        :type session_index: string

        :param nq: IDP Name Qualifier
        :type: string

        :param name_id_format: The NameID Format that will be set in the LogoutRequest.
        :type: string