Redis Rails 身份验证如何工作?
我在这里尝试学习 Redis,它本身相当容易理解。我不太了解 Session 如何与 Redis-store 这样的键值数据存储一起工作。我想使用 Authlogic 或 Devise。后者似乎是可能的,虽然它可以使用 Rack::Session 进行配置,但此时我有点迷失了。
我很想看到基本身份验证或其他的示例。
I'm spinning my wheels a little bit here trying to learn Redis which itself is fairly easy to understand. I don't know much about how Sessions work with a key-value data store like Redis-store. I'd like to use either Authlogic or Devise. The later seems possible while it's configurable with Rack::Session, but at this point I'm a little lost.
I'd love to see an example of basic authentication or other.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
redis-store
提供了一个接口供Rack::Session
在创建会话时使用。如果您安装了redis-store
,那么这只需要像这样更改您的缓存存储:然后您的会话将存储在Redis实例中。我有点困惑为什么你要询问身份验证,因为这实际上与用户身份验证无关,而是涉及更改 Rails 存储会话数据的方式,身份验证层使用会话数据来验证客户端登录后的情况。
redis-store
provides an interface forRack::Session
to use when creating sessions. If you installredis-store
then this should only require changing your cache store like this:Then your sessions will be stored inside the Redis instance. I am a bit confused on why you are asking about authentication considering that this really has nothing to do with user authentication alone, but involves changing how Rails stores session data which is used by your authentication layer to validate the client once they are logged in.