Guest User

Untitled

a guest
May 20th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. function (user, context, callback) {
  2. // We check users only authenticated with 'github'
  3. if(context.connection === 'github'){
  4.  
  5. var whitelist = [
  6. 'bcoe',
  7. 'batman'
  8. ]; //authorized github accounts.
  9. var userHasAccess = whitelist.some((name) => {
  10. return name === user.nickname;
  11. });
  12.  
  13. if (!userHasAccess) {
  14. return callback(new UnauthorizedError('Access denied.'));
  15. }
  16. }
  17.  
  18. callback(null, user, context);
  19. }
Add Comment
Please, Sign In to add comment