Beispiel #1
0
    def __init__(self, app, app_conf, prefix=PARAM_PREFIX, **local_conf):
        """
        @param app: wrapped application/middleware
        @type app: WSGI application
        @param app_conf: application configuration settings - ignored - this
        method includes this arg to fit Paste middleware / app function 
        signature
        @type app_conf: dict
        @param prefix: optional prefix for parameter names included in the 
        local_conf dict - enables these parameters to be filtered from others
        which don't apply to this middleware
        @param local_conf: attribute settings to apply
        @type local_conf: dict
        """
        self._app = app
        self._set_configuration(prefix, local_conf)
        if self.access_token_type == 'bearer':
            log.debug("Setting client as Oauth2Client (Bearer token)")
            self._oauth_client_class = Oauth2Client
            self._token_retriever_class = TokenRetriever
        else:
            raise Oauth2ClientMiddlewareConfigOptError("Access token type %r "
                                                       "not recognised" %
                                                       self.access_token_type)

        self._renderingConfiguration = RenderingConfiguration(
            self.LAYOUT_PARAMETERS, prefix + self.LAYOUT_PREFIX, local_conf)
        self.renderer = callModuleObject(self.renderer_class,
                                         objectName=None,
                                         moduleFilePath=None,
                                         objectType=RendererInterface,
                                         objectArgs=None,
                                         objectProperties=None)