Пример #1
0
    def make_logout_response(self,
                             idp_entity_id,
                             request_id,
                             status_code,
                             binding=BINDING_HTTP_REDIRECT):
        """ Constructs a LogoutResponse

        :param idp_entity_id: The entityid of the IdP that want to do the
            logout
        :param request_id: The Id of the request we are replying to
        :param status_code: The status code of the response
        :param binding: The type of binding that will be used for the response
        :return: A LogoutResponse instance
        """

        destination = self.config.single_logout_services(
            idp_entity_id, binding)[0]

        status = samlp.Status(status_code=samlp.StatusCode(value=status_code))

        response = samlp.LogoutResponse(
            id=sid(),
            version=VERSION,
            issue_instant=instant(),
            destination=destination,
            issuer=self._issuer(),
            in_response_to=request_id,
            status=status,
        )

        return response, destination
Пример #2
0
 def createLogoutResponse(self, logout_request_id, status_code):
     now = saml2.utils.getDateAndTime(time.time())
     self.response = samlp.LogoutResponse(id=saml2.utils.createID(),
                                          version=saml2.V2,
                                          issue_instant=now,
                                          in_response_to=logout_request_id)
     self.response.issuer = saml.Issuer(text=self.config.get('issuer_name'))
     self.response.status = samlp.Status()
     self.response.status.status_code = samlp.StatusCode(status_code)
     self.response.signature = self._get_signature()
     return self.response
Пример #3
0
def logoutresponse_factory(sign=False, encrypt=False, **kwargs):
    response = samlp.LogoutResponse(id=sid(),
                                    version=VERSION,
                                    issue_instant=instant())

    if sign:
        response.signature = pre_signature_part(kwargs["id"])
    if encrypt:
        pass

    for key, val in kwargs.items():
        setattr(response, key, val)

    return response
Пример #4
0
    def make_logout_response(self,
                             idp_entity_id,
                             request_id,
                             status_code,
                             binding=BINDING_HTTP_REDIRECT):
        """ 
        XXX There were issues with an explicit closing tag on 
        StatusCode. Check wether we still need this. XXX
        Constructs a LogoutResponse

        :param idp_entity_id: The entityid of the IdP that want to do the
            logout
        :param request_id: The Id of the request we are replying to
        :param status_code: The status code of the response
        :param binding: The type of binding that will be used for the response
        :return: A LogoutResponse instance
        """
        srvs = self.metadata.single_logout_service(idp_entity_id, binding,
                                                   "idpsso")

        destination = destinations(srvs)[0]
        logger.info("destination to provider: %s" % destination)

        status = samlp.Status(
            status_code=samlp.StatusCode(value=status_code, text='\n'),
            status_message=samlp.StatusMessage(text='logout success'))

        response = samlp.LogoutResponse(
            id=sid(),
            version=VERSION,
            issue_instant=instant(),
            destination=destination,
            issuer=saml.Issuer(text=self.config.entityid,
                               format=saml.NAMEID_FORMAT_ENTITY),
            in_response_to=request_id,
            status=status,
        )

        return response, destination
Пример #5
0
 def setup_class(self):
     self.lr = samlp.LogoutResponse()