Question

I have created an app using the Cramp.in(http://cramp.in) framework. I need to now setup authentication for the application. In Rails i have used Device for this purpose. Can Device be used in a Cramp application or should i use something else ?

Thank You

Was it helpful?

Solution

The problem is that Devise is built for Rails thus making it deeply coupled to it. So you just can't use it.

Devise being built on top of a Rack middleware named Warden (https://github.com/hassox/warden/wiki) it may sounds as a solution, but Cramp by being asynchronous can't use these directly (see http://cramp.in/documentation#rack-middlewares).

All middleware shipped with Rack are available in an asynchronous flavour (https://github.com/rkh/async-rack) but Warden isn't one of these. You may want to spend some time modifying it so it runs in an async environment (I guess you'd make yourself a lot of friends doing that :)

Conclusion : You may want to roll your own authentication solution.

Since sinatra is supported through an async module, you might want to look at the Sinatra authentication solutions that are available but I doubt they would run without any modification.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top