doubiao7267 2013-02-14 21:53
浏览 14

如何将apache上的某些文件限制为经过身份验证的用户?

In a site which uses a normal, cookie-based authentication where the password is stored on a cookie, is there a way to serve files only for users that are already logged in?

  • 写回答

1条回答 默认 最新

  • dtvp3625 2013-02-14 21:58
    关注

    Short answer: No.

    Long answer: You can write an authenticated application where the user has to login and then the application manages the compilation of headers and whatnot for the user to access a given file. For instance, if your users need to download a PDF or something you can send pdf headers and then send binary data; they won't be able to see what file on the server you're serving up. Downside is that this is slower than just pushing them a file from the filesystem or a CDN.

    Also, don't store the password in the cookie. Create a hash or something you can access and validate again, but password in cookie is just a bad idea; those guys are plaintext!

    评论

报告相同问题?

悬赏问题

  • ¥20 dify的代码解释器工具和代码执行节点有什么区别?代码解释器工具怎么用?
  • ¥100 springboot2.7.x 整合 sharding 的问题
  • ¥15 如何通过命令行操作统信360安全浏览器?
  • ¥15 upload-labs-master第三关
  • ¥15 关于LT3758反激式负压电源,功率三极管烧毁的问题
  • ¥20 aruba ap305 CAP转IAP
  • ¥20 rockchip rk3588 ffmedia运行异常
  • ¥30 如何用 Java 简单系统设计?(相关搜索:服务器|面向对象设计|随机数)
  • ¥15 鸿蒙开发(关键词-开发环境)
  • ¥15 错误使用 mex Embedding metadata in the MEX file failed.