简体   繁体   English

Pylons和AuthKit OpenID问题

[英]Pylons and AuthKit OpenID problem

I have troubles setting up the support for openID authentication, using authkit and pylons. 我使用authkit和pylons设置对openID身份验证的支持很麻烦。 I set up everything as described in the cookbook , but still get the following error: 我按照食谱中的描述设置了所有内容,但仍然出现以下错误:

  File "/usr/lib/python2.6/dist-packages/authkit/authenticate/open_id.py", line 480, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.6/dist-packages/authkit/authenticate/open_id.py", line 218, in __call__
    self.session_middleware
AuthKitConfigError: The session middleware 'beaker.session' is not present. Have you set up the session middleware?

(The full traceback is quite uninformative, just a chain of middleware calls) (完整的回溯是非常无意义的,只是一连串的中间件调用)

My config is the following: 我的配置如下:

authkit.setup.method = openid, cookie
# TODO authkit.openid.template.file =
authkit.cookie.params.httponly = true


authkit.openid.store.type = file
authkit.openid.store.config = %(here)s/data
authkit.openid.session.middleware = beaker.session
authkit.openid.session.key = authkit_openid
authkit.openid.baseurl = http://mysite.moc
authkit.openid.path.signedin = /main/cabinet
authkit.openid.authenticate.user.encrypt = authkit.users:md5                                                                          

The beaker middleware is definitely loaded, here is my make_app function (yes, the pylons version check is true): 烧杯中间件肯定是加载的,这是我的make_app函数(是的,pylons版本检查是真的):

|       # Configure the Pylons environment
|       load_environment(global_conf, app_conf)
|   
|       # The Pylons WSGI app
|       app = PylonsApp()
|       app = UserMiddleware(app)
|   
|       if pylons.__version__ >= "0.9.7":
|-          from beaker.middleware import SessionMiddleware
||          from routes.middleware import RoutesMiddleware
||          app = RoutesMiddleware(app, config['routes.map'])
||          app = SessionMiddleware(app, app_conf)
|   
|   
|       if asbool(full_stack):                                                                                                                               
|           # Handle Python exceptions
|   
|-          app = authkit.authenticate.middleware(app, app_conf)
||          # Display error documents for 401, 403, 404 status codes (and
||          # 500 when debug is disabled)
||          if pylons.__version__ >= "0.9.7":
||-             app = ErrorHandler(app, global_conf,
23-                            **config['pylons.errorware'])
|||             from pylons.middleware import StatusCodeRedirect
|||             if asbool(config['debug']):
23-                 app = StatusCodeRedirect(app)
|||             else:
23-                 app = StatusCodeRedirect(app, [401, 403, 404, 500])
||          else:
||-             app = ErrorHandler(app, global_conf, error_template = error_template,
23-                            **config['pylons.errorware'])
|||             app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf)
|   
|       # Establish the Registry for this application
|       app = RegistryManager(app)
|   
|       # Static files
|       javascripts_app = StaticJavascripts()
|       static_app = StaticURLParser(config['pylons.paths']['static_files'])
|       app = Cascade([static_app, javascripts_app, app])
|       return app

Does anyone have any idea, what is going on here? 有谁有任何想法,这里发生了什么?

Take this line in your middleware.py: 在middleware.py中取这行:

app = authkit.authenticate.middleware(app, app_conf)

And move it immediately below this line: 并将其移到此行下方:

app = PylonsApp()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM