krakenjs / kraken-example-with-passport

An example integrating kraken with passport authentication
53 stars 33 forks source link

How to add a dynamic route to the access map? #7

Closed xShirase closed 9 years ago

xShirase commented 9 years ago

Hi, and thanks for this extremely educational tutorial!

One question, I want to protect a route that looks like "/list/:listname", how do I add that to the access maps in auth.js? Do I have to?

Thanks again, Kraken is damn awesome!

pvenkatakrishnan commented 9 years ago

hey @xShirase, just to confirm i understand the question, you want to selectively add auth middleware to routes which have /list/:listname and you have other routes you dont want to, yeah ? check out https://github.com/krakenjs/meddleware#configuration The route param in the middleware config is used for filtering routes for the middleware.

pvenkatakrishnan commented 9 years ago

And thanks for Kraken is damn awesome!

xShirase commented 9 years ago

Yes, the route I'm trying to protect is defined as: router.get('/list/:listname' ...)

pvenkatakrishnan commented 9 years ago

Also checkout this sample app. https://github.com/jasisk/middleware-patterns especially https://github.com/jasisk/middleware-patterns/blob/master/config/whitelist.json ,seems like what you are trying to do.

xShirase commented 9 years ago

Seems like it yes, I'll investigate that. I've chosen Kraken for my startup launching soon, and it's a pleasure to work with. However, the main drawback I find is the lack of documentation about all the conventions you've added on top of Express. A wannabe Kraken user has a lot of googling to do to figure out that it's really simple :) I'd be willing to help writing some docs/tutorials to help others like me as I go further with the framework, is there a centralized wiki for that or should I sort it out myself?

pvenkatakrishnan commented 9 years ago

Thank you for the feedback @xShirase We agree and we are working on that actively now. Any help is deeply appreciated. Have you checked out krakenjs.com ? We are trying to revamp the site and make documentation clearer. If you have specific feedback on areas you'd like us to improve, please help us by filing issues against the repos. We really want to help connect the dots and make it easily accessible.

xShirase commented 9 years ago

Sounds good. I'll also make sure to document my journey on a dev blog and release that as soon as we've launched. I'll probably run the articles by your team to make sure I don't spread misconceptions. Kraken is by far the best toolkit out there, leveraging Express makes it way more powerful than Hapi and the others. At the moment, with very little migration effort, our load time has dropped by 30% and we gained all the security and specialization features, I couldn't be happier!

pvenkatakrishnan commented 9 years ago

Thank you for the kind words. We'll eagerly look forward to the blog. Good luck!