Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cicorias committed Mar 2, 2016
1 parent 54e308a commit ffb2f60
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 195 deletions.
190 changes: 0 additions & 190 deletions .vscode/tasks.json

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Shawn Cicoria
Copyright (c) 2016 Microsoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 9 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ function mapIt(subject, key, target) {
return fast.indexOf(subject, target, key, 0);
}


/**
* Implements an Express middleware Authentication Filter
* that validates an identity provided as a property on the request.connection object
* agasint ACL represented as a json object.
* @param {Object} acl - the acl represented as an array of ACL's - generally they
* are represented as path.role.verb.
* @returns {Function} returns a handler of (req, res, next) to the middleware pipeline
*/
module.exports = function (acl) {
//path.role.verb
let msg401 = { success: false, message: 'Unauthorized' };
Expand Down Expand Up @@ -65,5 +74,3 @@ module.exports = function (acl) {
next();
};
};


16 changes: 15 additions & 1 deletion lib/indexOf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* istanbul ignore next */
'use strict';

//taken from: https://github.com/codemix/fast.js/tree/master

// # The MIT License (MIT)
Expand All @@ -23,7 +25,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

'use strict';

/**
* Custom indexOf implementation from fast.js.
* @module indesOf
*/

var secureCompare = require('secure-compare');

Expand All @@ -43,6 +49,14 @@ function compareIt(source, target, secure) {
}
}

/**
* Does an indexOf from a array/object against a target and optional key
* @param {Object} subject - the source array or object.
* @param {string} target - the value to lookup.
* @param {string} key - an optional property value to use if using an object as subject
* @param {Number} fromIndex - where to start in the subject (offset)
* @returns {Number} the index value where found or -1 if not found
*/
module.exports.indexOf = function fastIndexOf(subject, target, key, fromIndex) {
var length = subject.length,
i = 0;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "salti",
"version": "0.1.2",
"version": "0.1.3",
"description": "Simple Authentication and Authorization for Thali IoT",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit ffb2f60

Please sign in to comment.