__init__.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:penndjangosaml2 作者: wharton 项目源码 文件源码
def test_login_evil_redirect(self):
        """
        Make sure that if we give an URL other than our own host as the next
        parameter, it is replaced with the default LOGIN_REDIRECT_URL.
        """

        # monkey patch SAML configuration
        settings.SAML_CONFIG = conf.create_conf(
            sp_host='sp.example.com',
            idp_hosts=['idp.example.com'],
            metadata_file='remote_metadata_one_idp.xml',
        )
        response = self.client.get(reverse('saml2_login') + '?next=http://evil.com')
        url = urlparse(response['Location'])
        params = parse_qs(url.query)

        self.assertEquals(params['RelayState'], [settings.LOGIN_REDIRECT_URL, ])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号