コード例 #1
0
    def test_check_request_allowed_describeprocess(self):
        security = OWSSecurity(tokenstore=self.empty_tokenstore,
                               servicestore=self.servicestore)

        params = dict(request="DescribeProcess",
                      service="WPS",
                      version="1.0.0")
        request = DummyRequest(params=params, path='/ows/proxy/emu')
        request.registry = Registry()
        request.registry.settings = {
            'twitcher.ows_prox_protected_path': '/ows'
        }
        security.check_request(request)
コード例 #2
0
    def test_check_request_invalid(self):
        security = OWSSecurity(tokenstore=self.empty_tokenstore,
                               servicestore=self.servicestore)

        params = dict(request="Execute",
                      service="WPS",
                      version="1.0.0",
                      token="xyz")
        request = DummyRequest(params=params, path='/ows/proxy/emu')
        request.registry = Registry()
        request.registry.settings = {
            'twitcher.ows_prox_protected_path': '/ows'
        }
        with pytest.raises(OWSAccessForbidden):
            security.check_request(request)
コード例 #3
0
    def setUp(self):
        self.access_token = AccessToken(token="cdefg",
                                        expires_at=expires_at(hours=1))

        self.tokenstore = MemoryTokenStore()
        self.tokenstore.save_token(self.access_token)
        self.empty_tokenstore = MemoryTokenStore()

        self.service = Service(url='http://nowhere/wps',
                               name='test_wps',
                               public=False)
        self.servicestore = MemoryServiceStore()
        self.servicestore.save_service(self.service)

        self.security = OWSSecurity(tokenstore=self.tokenstore,
                                    servicestore=self.servicestore)
コード例 #4
0
    def test_check_request_public_access(self):
        servicestore = MemoryServiceStore()
        servicestore.save_service(
            Service(url='http://nowhere/wps', name='test_wps', public=True))
        security = OWSSecurity(tokenstore=self.tokenstore,
                               servicestore=servicestore)

        params = dict(request="Execute",
                      service="WPS",
                      version="1.0.0",
                      token="cdefg")
        request = DummyRequest(params=params, path='/ows/proxy/emu')
        request.registry = Registry()
        request.registry.settings = {
            'twitcher.ows_prox_protected_path': '/ows'
        }
        security.check_request(request)
コード例 #5
0
ファイル: default.py プロジェクト: todokku/twitcher
 def owssecurity_factory(self):
     return OWSSecurity()