How to use the NotAuthorizedError function from restify
Find comprehensive JavaScript restify.NotAuthorizedError code examples handpicked from public code repositorys.
46 47 48 49 50 51 52 53 54 55
return next(); } else { res.status(401); res.setHeader('Connection', 'close'); res.end(); return next(new Restify.NotAuthorizedError()); } } else { return next(); }
9
12
48
+ 3 other calls in file
34 35 36 37 38 39 40 41 42 43
var i = methods.length; while(i--) { if(methods[i] == req.method) return next(); } return next(new restify.NotAuthorizedError("Methods not defined for this user and this schema")); }); }); server.post('/user', UserREST.createUser);
0
2
13
35 36 37 38 39 40 41 42 43 44
review: require('../models/review'), badgeInstance: require('../models/badge-instance'), milestone: require('../models/milestone'), } const http403 = restify.NotAuthorizedError const http404 = restify.ResourceNotFoundError const http500 = restify.InternalError function createFinder(modelName, gOpts) {
46
0
2
90 91 92 93 94 95 96 97 98 99
params: req.params, limits: req.limits }, 'capi_limits: dataset limits'); if (req.limit < 0) { return next(new restify.NotAuthorizedError( util.format('%s: %s', CODE, MESSAGE))); } if (req.limit === 0) {
24
0
5
+ 3 other calls in file
GitHub: FabMo/FabMo-Engine
22 23 24 25 26 27 28 29 30 31 32 33 34
const GCODE_EXTENSIONS = [".nc", ".g", ".gc", ".gcode"]; const OPENSBP_EXTENSIONS = [".sbp", ".sbc"]; var MethodNotAllowedError = errors.MethodNotAllowedError; var NotAuthorizedError = errors.NotAuthorizedError; var ResourceNotFoundError = errors.ResourceNotFoundError; function listify(x) { if (x instanceof Array) {
22
52
0
4 5 6 7 8 9 10 11 12
var bcrypt = require('bcrypt-nodejs'); module.exports.handler = function(req, res, next) { if (!req.params.auth) return next(new restify.NotAuthorizedError('Auth token required.')); if (!req.params.user_id) return next(new restify.InvalidArgumentError('User ID required.'));
1
1
5
+ 5 other calls in file
GitHub: pglah/openSenseMap-API
158 159 160 161 162 163 164 165 166 167
request.log.info({req: request}, 'REQUEST'); if (process.env.ENV === 'prod' && (!request.headers['x-forwarded-proto'] || request.headers['x-forwarded-proto'] !== 'https')) { if (request.method !== 'POST' || !validUnsecuredPathRegex.test(request.url)) { return next(new restify.NotAuthorizedError('Access through http is not allowed')); } } return next(); });
36
0
0
+ 5 other calls in file
GitHub: chudley/sdc-cn-agent
110 111 112 113 114 115 116 117 118 119
self.server.use(function validateIpAddresses(req, res, next) { // Should we periodically refresh the CNAPI IP address we have? if (req.method === 'POST' && [self.cnapiAddr, self.bindip].indexOf( req.connection.remoteAddress) === -1) { next(new restify.NotAuthorizedError( 'requests must originate from CNAPI address')); return; } next();
17
0
1
28 29 30 31 32 33 34 35 36 37
} return error; } function NotAuthorizedError(){ var error = new restify.NotAuthorizedError(); error.body.outMsg = sysMsg.SYS_AUTH_TOKEN_ERROR; return error; }
0
0
0
+ 3 other calls in file
restify.createServer is the most popular function in restify (1059 examples)