Skip to content

Commit

Permalink
Granularity access - see issue #16
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveViss committed Aug 29, 2018
1 parent cc40cf4 commit 3182f87
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion ressources/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@ var passport = require('passport');
require('./oauth.js')(passport);

module.exports = {
all: {
delete: {
auth: function(req, res, context) {
passport.authenticate('bearer', {
session: false
})(req, res, function() { // this is the function called after auth
if(req.user){
context.continue();
} else {
context.stop();
}
});
}
},
write: {
auth: function(req, res, context) {
passport.authenticate('bearer', {
session: false
Expand Down

0 comments on commit 3182f87

Please sign in to comment.