2

I have set up HTTP Basic authentication for my app using Ring Basic Authentication. It works just fine and looks like this:

(:require [noir.server :as server]
...
(server/add-middleware wrap-basic-authentication authenticated?)

authenticated? is my own function implementation. Now I'd like to configure only a part of the application to be under basic authentication and other part to be public. I know this can be done with Ring (and Compojure) so it must be possible to do with Noir which is built on Ring. I'm just not quite sure how to apply the example is adapted to Noir because it uses routes and I don't see how I can get to those in Noir. Any ideas?

auramo
  • 13,167
  • 13
  • 66
  • 88
  • Hmm, apparently questions like these were the reason Noir is now deprecated: http://blog.raynes.me/blog/2012/12/13/moving-away-from-noir/ – auramo Jan 06 '13 at 21:08

1 Answers1

3

The problem with Noir is that the routes are managed under the hood and there isn't much of anything at all that you can do to change how they get tied together with middleware and such. Noir was never a good match for complex middleware scenarios, and that's even more true now that it is deprecated. It may not be the answer you want to hear, but I highly recommend you use Compojure instead. If you're looking for a batteries included sort of thing, check out the luminus leiningen template for generating a batteries included web app with Compojure, lib-noir, and all sorts of other goodies.

Rayne
  • 31,473
  • 17
  • 86
  • 101