Ejemplo n.º 1
0
 def setup_plugins(self, config, settings):
     from factored.plugins import getFactoredPlugins
     from factored.views import AuthView
     for plugin in getFactoredPlugins():
         setattr(
             self, '%s_settings' % plugin.path,
             nested_settings(get_settings(settings, '%s.' % plugin.path)))
         config.add_route(
             plugin.name,
             os.path.join(self.base_auth_url, plugin.path))
         config.add_view(AuthView, route_name=plugin.name,
                         renderer='templates/layout.pt')
Ejemplo n.º 2
0
 def setup_plugins(self, config, settings):
     from factored.plugins import getFactoredPlugins
     from factored.views import AuthView
     for plugin in getFactoredPlugins():
         setattr(
             self, '%s_settings' % plugin.path,
             nested_settings(get_settings(settings, '%s.' % plugin.path)))
         config.add_route(plugin.name,
                          os.path.join(self.base_auth_url, plugin.path))
         config.add_view(AuthView,
                         route_name=plugin.name,
                         renderer='templates/layout.pt')
Ejemplo n.º 3
0
def auth_chooser(req):
    auth_types = []
    settings = req.registry['settings']
    base_path = settings['base_auth_url']
    supported_types = settings['supported_auth_schemes']
    if len(supported_types) == 1:
        plugin = getFactoredPlugin(supported_types[0])
        url = generate_url(req, base_path + '/' + plugin.path,
                           {'referrer': req.params.get('referrer', '')})
        raise HTTPFound(location=url)

    for plugin in getFactoredPlugins():
        if plugin.name in supported_types:
            auth_types.append({
                'name': plugin.name,
                'url': os.path.join(base_path, plugin.path)
            })
    return dict(auth_types=auth_types, referrer=req.params.get('referrer', ''))
Ejemplo n.º 4
0
def auth_chooser(req):
    auth_types = []
    settings = req.registry['settings']
    base_path = settings['base_auth_url']
    supported_types = settings['supported_auth_schemes']
    if len(supported_types) == 1:
        plugin = getFactoredPlugin(supported_types[0])
        referrer = urllib.urlencode(
            {'referrer': req.params.get('referrer', '')})
        raise HTTPFound(location="%s/%s?%s" % (base_path, plugin.path,
                                               referrer))
    for plugin in getFactoredPlugins():
        if plugin.name in supported_types:
            auth_types.append({
                'name': plugin.name,
                'url': os.path.join(base_path, plugin.path)
                })
    return dict(auth_types=auth_types,
                referrer=req.params.get('referrer', ''))