如何让 IHttpHandler 正确执行身份验证?
我有一些 IHttpHandler 实现,它们可以选择应用身份验证。
我最初推出了自己的基本身份验证,但现在想使用 IIS 的功能,以便部署用户可以控制他们使用的身份验证类型,并且处理程序只需查找是否允许当前用户执行他们请求的操作。
确定用户是否可以执行操作并返回 401/403 很容易,但我不知道如何让 IIS 将相关 HTTP 标头添加到请求客户端发回凭据的响应中。 我可以手动添加它们,但随后我只能实际实现基本身份验证(这就是我最初所做的),这让我回到了第一个方面。
我可以调用一些神奇的方法来告诉 HttpContext 将相关标头附加到响应中吗?
更一般地说,我正在尝试做什至可能不诉诸实现 IHttpModule 来干扰 ASP.Net 页面生命周期的身份验证事件?
I have some IHttpHandler
implementations where they may optionally have authentication applied to them.
I originally rolled my own Basic authentication but would now like to use IIS's capabilities so that the deploying user can control what type of authentication they use and the handlers just look up whether the current user is allowed to perform the actions they request.
Determining whether a user can perform an action and returning a 401/403 is easy enough but what I can't figure out is how to get IIS to add in the relevant HTTP Headers to the response that request the client to send back credentials.
I can add them manually but then I can only realistically implement Basic authentication (which is what I did originally) and this takes me back to square one.
Is there some magic method I can call that tells the HttpContext
to append the relevant headers to the response?
And more generally is what I am trying to do even possible without resorting to implementing a IHttpModule
to interfere in the authentication events of the ASP.Net page lifecycle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论