I'm not sure the title is very clear, but here's what I'm aiming to do:
I'm using passport
with a BasicStrategy
. Then I'm calling the authentication method like this:
router.route('/users').get(passport.authenticate('basic', {session: false}),
function(req, res) { ... });
I want to know if inside my BasicStrategy
implementation I can get which route is being called and under which HTTP Method.
I need to do this because I need to implement permissions for the routes. I have in my database a table with roles and one table with permissions. Inside the permissions table, I have one boolean column for each CRUD (permission_post,get,put,delete) operation, the role id and the route name.
That's why I need to know the route name and the HTTP Method, so I can use the user's role id and fetch if the user is or is not allowed to access the route.