How can I use devise's “warden” to authenticate a rack app in the same stack as the rails app that uses devise?

StackOverflow https://stackoverflow.com/questions/3998359

سؤال

By the way, I'm using rails 3.

How can I use devise's "warden" to authenticate a rack app in the same stack as the rails app that uses devise ?

My problem is that when I call this:

request.env['warden'] # nil :(

from the other application on the rack stack I get nil !

I integrated dav4rack (webdav) in my rails app via config.ru. I use devise for authentication in my rails app.

When I try to access the "warden" from my custom dav4rack Resource, request.env['warden'] I get nil. How can I use warden to authenticate in my dav4rack resource?

Example of config.ru I use:

http://pastie.org/1240732

هل كانت مفيدة؟

المحلول

In your config.ru, Your stack doesn't use warden.

If you check a request to your '/' path, you use immediatly your Rack Application in your config.ru. The warden middlkeware is add on Rails application. So like your rack application call any other rack middleware you can't to have the warden information

You need define your Rack application after the middleware warden. Because without Warden Middleware, there are no warden capability available.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top