跨 Catalyst 应用程序共享身份验证
为了便于管理,我想将三个应用程序分开。它们按照此处的建议作为 Plack 服务器运行,在 nginx 后面进行代理。
我希望有一个单独的应用程序来管理登录,并在所有其他应用程序之间共享该登录及其身份验证过程,并通过角色完成授权。
我想使用 Catalyst::Authentication::Store::DBIx::Class 进行存储。
我尝试使用 Catalyst::Authentication::Credential::Remote 在 Plack 级别管理身份验证,在 Catalyst 级别执行此操作(这将是理想的),但似乎无法使 Catalyst 应用程序看到登录。
感谢您的帮助。
I have a three applications that I would like to keep separate for manageability purposes. They run as a Plack server as suggested here, proxied behind nginx.
I would like to have a separate application to manage logins, and have that login and its authentication process shared across all other apps, with authorization done via roles.
I would like to use Catalyst::Authentication::Store::DBIx::Class for storage.
I have tried managing authentication at the Plack level with Catalyst::Authentication::Credential::Remote doing it at the Catalyst level (which would be ideal), but can't seem to make the login seen by the Catalyst apps.
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
共享存储很简单——您可以只使用 DBIC 会话存储并在所有应用程序中复制配置,也可以使用 __PACKAGE__->config 创建 DBIC 存储的子类。包含所有应用程序共有的内容的行,然后在会话配置中指定您的子类。
至于状态 - 如果应用程序共享一个共同的域,您可以使用 State::Cookie - 您只需设置
cookie_domain
和/或会话配置中的 cookie_path
选项,以便以对所有应用程序都可见的方式设置 cookie,并将所有应用程序中的cookie_name
配置选项设置为相同的内容,因为否则它们都会根据不同的应用程序类名称获得不同的 cookie 名称。Sharing the store is easy -- you can either just use the DBIC session store and duplicate the config in all of the apps, or you can create a subclass of the DBIC store with a
__PACKAGE__->config
line containing the stuff that all of the apps have in common, and then specify your subclass in the session config.As for the state -- you can use State::Cookie if the apps share a domain in common -- you just need to set the
cookie_domain
and/orcookie_path
options in your session config so that the cookie gets set in a way that it will be visible to all of the apps, and set thecookie_name
config option to the same thing in all apps, because otherwise they would all get different cookie names based on their different application class names.