Exemple #1
0
    def getChild(self, path, request):
        if isinstance(self.session, UnauthorizedLogin):
            factories = [
                BasicCredentialFactory('fluidinfo.com'),
                OAuthCredentialFactory('fluidinfo.com'),
                OAuth2CredentialFactory('fluidinfo.com')
            ]
            return WSFEUnauthorizedResource(factories)

        # Add a unique id to the request so we can more easily trace its
        # progress in our log files. Note that we need to put an id on the
        # request even in the case that we're going to return NoResource,
        # as it's all logged.
        request._fluidDB_reqid = self.session.id
        self.session.http.trace(request)
        if path == 'oauthecho':
            return OAuthEchoResource(self.session)
        elif path == 'renew-oauth-token':
            return RenewOAuthTokenResource(self.session)
        try:
            resource = self._resources[path]
        except KeyError:
            return NoResource()
        else:
            return resource(self.facadeClient, self.session)
Exemple #2
0
	def render_JSON(self, request):
		try:
			username = request.args['username'][0]
			password = request.args['password'][0]
		except (KeyError, IndexError):
			return response('invalid_parameters', 'Invalid username and or password')
		return resource('success')
Exemple #3
0
 def direct(config):
     mode = "serve"
     if config.endpoints:
         endpoint = choice(config.endpoints) 
         if endpoint == "redirect":
             mode = "redirect"
         elif config.get == "proxy":
             mode = "proxy"
     else:
         endpoint = None
     d = None
     if hasattr(self, mode):
         resource = getattr(self, mode)
         resource(request, endpoint, config)
     else:
         d = defer.fail(NotImplementedError("No Controller for mode %s" % mode))
     return d
Exemple #4
0
 def render_JSON(self, request):
     try:
         username = request.args['username'][0]
         password = request.args['password'][0]
     except (KeyError, IndexError):
         return response('invalid_parameters',
                         'Invalid username and or password')
     return resource('success')
Exemple #5
0
    def getChild(self, path, request):
        if isinstance(self.session, UnauthorizedLogin):
            factories = [BasicCredentialFactory('fluidinfo.com'),
                         OAuthCredentialFactory('fluidinfo.com'),
                         OAuth2CredentialFactory('fluidinfo.com')]
            return WSFEUnauthorizedResource(factories)

        # Add a unique id to the request so we can more easily trace its
        # progress in our log files. Note that we need to put an id on the
        # request even in the case that we're going to return NoResource,
        # as it's all logged.
        request._fluidDB_reqid = self.session.id
        self.session.http.trace(request)
        if path == 'oauthecho':
            return OAuthEchoResource(self.session)
        elif path == 'renew-oauth-token':
            return RenewOAuthTokenResource(self.session)
        try:
            resource = self._resources[path]
        except KeyError:
            return NoResource()
        else:
            return resource(self.facadeClient, self.session)