无需 DBIx 的 Catalyst 身份验证

发布于 2024-12-27 11:53:35 字数 1252 浏览 3 评论 0原文

我正在向 Catalyst 应用程序添加身份验证。该应用程序是来自另一个系统的端口,因此我必须使用当前的后台来处理某些事情。

其中之一是用户数据库。它不是 SQL,我必须通过 Web 服务访问它。

遵循 docs 现在我可以使用用户/密码的哈希值来工作,如示例所示。我还使用 DBIx 测试了 Catalyst 教程。

但现在我需要插入自己的模型来从真实的后台检查和检索用户。

在哪里?

我从控制器调用 auth 插件

$c->authenticate({ username => $username, password => $password  }

在我的配置中(来自教程)

 __PACKAGE__->config('Plugin::Authentication' => {
    default_realm => 'members',
    realms => {
        members => {
            credential => {
                class => 'Password',
                password_field => 'password',
                password_type => 'clear'
            },
            store => {
                class => 'DBIx::Class',
                user_model => 'MyApp::User',
                role_relation => 'roles',
                role_field => 'rolename',
            }
        }
    }
});

那么我在哪里可以调用我的 Web 服务模型呢?

先感谢您。

更新: 为了度过这一周,我做了自己的网络服务查询。如果结果正常,我会将获得的数据传递到这个硬编码领域。非常非常难看,但我提供了功能。现在我又认真起来了。

I am adding authentication to my Catalyst application. The app is a port from another system, so I must use the current backoffice for some things.

One of those things is the users database. Its not SQL and I must access it trough web services.

Following docs now I have it working using hashes for user/password, as in the example. I also tested the Catalyst tutorial using DBIx.

But now I need to plug my own model to check and retrieve the user from the real backoffice.

Where?

From the controller I call the auth plugin

$c->authenticate({ username => $username, password => $password  }

And in the config I have (from the tutorial)

 __PACKAGE__->config('Plugin::Authentication' => {
    default_realm => 'members',
    realms => {
        members => {
            credential => {
                class => 'Password',
                password_field => 'password',
                password_type => 'clear'
            },
            store => {
                class => 'DBIx::Class',
                user_model => 'MyApp::User',
                role_relation => 'roles',
                role_field => 'rolename',
            }
        }
    }
});

So where can I call my web services model?

Thank you in advance.

UPDATE:
To survive the week I maed my own webservices query. If the result is OK I pass the obtained data to this hardcoded realm. Very, very, very ugly, but I delivered the functionality. Now I am serious again.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别靠近我心 2025-01-03 11:53:35

看来您必须创建自己的 auth store

store => {
  class => '+MyApp::Authentication::Store::NetAuth',
  authserver => '192.168.10.17'
}

另请参阅Catalyst::Authentication::Store::Minimal

It looks like you have to create your own auth store:

store => {
  class => '+MyApp::Authentication::Store::NetAuth',
  authserver => '192.168.10.17'
}

Also look at Catalyst::Authentication::Store::Minimal

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文