OmniAuth 选项哈希
我正在编写自己的 CAS 策略,我希望用户将我的策略传递给他们的专有名称(来自他们的证书)。根据我的理解,我的策略的用户可以传递这样的选项,
use OmniAuth::Strategies::CAS::MyStrategy :setup => true
我假设在我的策略的初始化方法中的选项标签中,我将有一个关键设置 =>真实的价值。这会传递给 CAS 类(通过 super 方法)等等。用户是否可以传递这样的选项:dn => retrieve_dn_method 来执行我上面所说的操作吗?如果是这样,父类会如何处理他们不期望的选项?
或者是否有另一种方式将选项传递到我需要验证的策略中?
I am writing my own CAS strategy and I would like the user to pass my strategy their distinguished name (from their cert). From my understanding, a user of my strategy can pass options like this
use OmniAuth::Strategies::CAS::MyStrategy :setup => true
I'm assuming in the options tag within my strategy's initialize method, I will have a key setup => value of true. This gets passed along to the CAS class (via the super method) and so forth. Could the user pass an option like this :dn => retrieve_dn_method to do what I've stated above? If so, what would the parent classes do with an option they're not expecting?
Or is there another way of passing options into my strategy that I need to authenticate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 :setup 选项不会出现在传递到策略初始化方法中的选项哈希中。将 :setup 设置为 true 仅允许策略用户在其代码中创建设置方法以在身份验证之前完成任务。但基于此:
https://github.com/intridea/omniauth/wiki/Dynamic-Providers您的策略的用户应该能够通过以下方式设置此人的可分辨名称:
I don't think the :setup option will be present in the options hash which is passed into your strategy's initialize method. Setting :setup to true only allows the user of the strategy to create a setup method in their code to accomplish a task before authenticating. But based off of this:
https://github.com/intridea/omniauth/wiki/Dynamic-Providers users of your strategy should be able to set the person's distinguished name in this way: