• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python validate.validate_before函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中saml2.validate.validate_before函数的典型用法代码示例。如果您正苦于以下问题:Python validate_before函数的具体用法?Python validate_before怎么用?Python validate_before使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了validate_before函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _bearer_confirmed

    def _bearer_confirmed(self, data):
        if not data:
            return False

        if data.address:
            if not valid_address(data.address):
                return False
                # verify that I got it from the correct sender

        # These two will raise exception if untrue
        validate_on_or_after(data.not_on_or_after, self.timeslack)
        validate_before(data.not_before, self.timeslack)

        # not_before must be < not_on_or_after
        if not later_than(data.not_on_or_after, data.not_before):
            return False

        if self.asynchop and self.came_from is None:
            if data.in_response_to:
                if data.in_response_to in self.outstanding_queries:
                    self.came_from = self.outstanding_queries[data.in_response_to]
                    # del self.outstanding_queries[data.in_response_to]
                elif self.allow_unsolicited:
                    pass
                else:
                    # This is where I don't allow unsolicited reponses
                    # Either in_response_to == None or has a value I don't
                    # recognize
                    logger.debug("in response to: '%s'", data.in_response_to)
                    logger.info("outstanding queries: %s", self.outstanding_queries.keys())
                    raise Exception("Combination of session id and requestURI I don't " "recall")
        return True
开发者ID:blenderbox,项目名称:pysaml2,代码行数:32,代码来源:response.py


示例2: condition_ok

    def condition_ok(self, lax=False):
        # The Identity Provider MUST include a <saml:Conditions> element
        #print "Conditions",assertion.conditions
        if self.test:
            lax = True
        assert self.assertion.conditions
        condition = self.assertion.conditions

        logger.debug("condition: %s" % condition)

        # if no sub-elements or elements are supplied, then the
        # assertion is considered to be valid.
        if not condition.keyswv():
            return True

        # if both are present NotBefore must be earlier than NotOnOrAfter
        if condition.not_before and condition.not_on_or_after:
            if not later_than(condition.not_on_or_after, condition.not_before):
                return False

        try:
            if condition.not_on_or_after:
                self.not_on_or_after = validate_on_or_after(
                    condition.not_on_or_after, self.timeslack)
            if condition.not_before:
                validate_before(condition.not_before, self.timeslack)
        except Exception, excp:
            logger.error("Exception on condition: %s" % (excp,))
            if not lax:
                raise
            else:
                self.not_on_or_after = 0
开发者ID:taizo,项目名称:pysaml2,代码行数:32,代码来源:response.py


示例3: get_subject

 def get_subject(self):
     """ The assertion must contain a Subject
     """
     assert self.assertion.subject
     subject = self.assertion.subject
     subjconf = []
     for subject_confirmation in subject.subject_confirmation:
         data = subject_confirmation.subject_confirmation_data
         if not data:
             # I don't know where this belongs so I ignore it
             continue
             
         if data.address:
             if not valid_address(data.address):
                 # ignore this subject_confirmation
                 continue
                 
         # These two will raise exception if untrue
         validate_on_or_after(data.not_on_or_after, self.timeslack)
         validate_before(data.not_before, self.timeslack)
         
         # not_before must be < not_on_or_after
         if not time_util.later_than(data.not_on_or_after, data.not_before):
             continue
         
         if self.asynchop and not self.came_from:
             if data.in_response_to in self.outstanding_queries:
                 self.came_from = self.outstanding_queries[
                                                     data.in_response_to]
                 del self.outstanding_queries[data.in_response_to]
             elif self.allow_unsolicited:
                 pass
             else:
                 # This is where I don't allow unsolicited reponses
                 # Either in_response_to == None or has a value I don't
                 # recognize
                 if self.debug and self.log:
                     self.log.info(
                             "in response to: '%s'" % data.in_response_to)
                     self.log.info("outstanding queries: %s" % \
                                         self.outstanding_queries.keys())
                 raise Exception(
                 "Combination of session id and requestURI I don't recall")
                     
         subjconf.append(subject_confirmation)
         
     if not subjconf:
         raise Exception("No valid subject confirmation")
         
     subject.subject_confirmation = subjconf
     
     # The subject must contain a name_id
     assert subject.name_id
     self.name_id = subject.name_id.text.strip()
     return self.name_id
开发者ID:FluidReview,项目名称:saml2,代码行数:55,代码来源:response.py


示例4: condition_ok

    def condition_ok(self, lax=False):
        if not self.assertion.conditions:
            # Conditions is Optional for Assertion, so, if it's absent, then we
            # assume that its valid
            return True

        if self.test:
            lax = True

        conditions = self.assertion.conditions

        logger.debug("conditions: %s", conditions)

        # if no sub-elements or elements are supplied, then the
        # assertion is considered to be valid.
        if not conditions.keyswv():
            return True

        # if both are present NotBefore must be earlier than NotOnOrAfter
        if conditions.not_before and conditions.not_on_or_after:
            if not later_than(conditions.not_on_or_after,
                              conditions.not_before):
                return False

        try:
            if conditions.not_on_or_after:
                self.not_on_or_after = validate_on_or_after(
                    conditions.not_on_or_after, self.timeslack)
            if conditions.not_before:
                validate_before(conditions.not_before, self.timeslack)
        except Exception as excp:
            logger.error("Exception on conditions: %s", excp)
            if not lax:
                raise
            else:
                self.not_on_or_after = 0

        if not self.allow_unsolicited:
            if not for_me(conditions, self.entity_id):
                if not lax:
                    raise Exception("Not for me!!!")

        if conditions.condition:  # extra conditions
            for cond in conditions.condition:
                try:
                    if cond.extension_attributes[
                        XSI_TYPE] in self.extension_schema:
                        pass
                    else:
                        raise Exception("Unknown condition")
                except KeyError:
                    raise Exception("Missing xsi:type specification")

        return True
开发者ID:SUNET,项目名称:pysaml2,代码行数:54,代码来源:response.py


示例5: condition_ok

    def condition_ok(self, lax=False):
        if self.test:
            lax = True

        # The Identity Provider MUST include a <saml:Conditions> element
        assert self.assertion.conditions
        conditions = self.assertion.conditions

        logger.debug("conditions: %s" % conditions)

        # if no sub-elements or elements are supplied, then the
        # assertion is considered to be valid.
        if not conditions.keyswv():
            return True

        # if both are present NotBefore must be earlier than NotOnOrAfter
        if conditions.not_before and conditions.not_on_or_after:
            if not later_than(conditions.not_on_or_after, conditions.not_before):
                return False

        try:
            if conditions.not_on_or_after:
                self.not_on_or_after = validate_on_or_after(conditions.not_on_or_after, self.timeslack)
            if conditions.not_before:
                validate_before(conditions.not_before, self.timeslack)
        except Exception as excp:
            logger.error("Exception on conditions: %s" % (excp,))
            if not lax:
                raise
            else:
                self.not_on_or_after = 0

        if not for_me(conditions, self.entity_id):
            if not lax:
                raise Exception("Not for me!!!")

        if conditions.condition:  # extra conditions
            for cond in conditions.condition:
                try:
                    if cond.extension_attributes[XSI_TYPE] in self.extension_schema:
                        pass
                    else:
                        raise Exception("Unknown condition")
                except KeyError:
                    raise Exception("Missing xsi:type specification")

        return True
开发者ID:rohe,项目名称:pysaml2-3,代码行数:47,代码来源:response.py


示例6: condition_ok

 def condition_ok(self, lax=False):
     # The Identity Provider MUST include a <saml:Conditions> element
     #print "Conditions",assertion.conditions
     if self.test:
         lax = True
     assert self.assertion.conditions
     condition = self.assertion.conditions
     logger.debug("condition: %s" % condition)
     
     try:
         self.not_on_or_after = validate_on_or_after(
                                                 condition.not_on_or_after,
                                                 self.timeslack)
         validate_before(condition.not_before, self.timeslack)
     except Exception, excp:
         logger.error("Exception on condition: %s" % (excp,))
         if not lax:
             raise
         else:
             self.not_on_or_after = 0
开发者ID:GSA,项目名称:pysaml2,代码行数:20,代码来源:response.py



注:本文中的saml2.validate.validate_before函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python validate.validate_on_or_after函数代码示例发布时间:2022-05-27
下一篇:
Python validate.valid_instance函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap