router-authz.js revision 759cbe36aeb56cbe1e788d90fbaa7f1a7e797f5d
/*
* This script is called from the router "onRequest" trigger, to enforce a central
* set of authorization rules.
*
* This default implemention simply restricts requests via HTTP to users that are assigned
* an "openidm-admin" role, and optionally to those that authenticate with TLS mutual
* authentication (assigned an "openidm-cert" role).
*/
// If true, then allows HTTP requests from "openidm-cert" role.
var allowCert = false;
function contains(a, o) {
var i;
if (typeof(a) !== 'undefined' && a !== null) {
for (i = 0; i <= a.length; i++) {
if (a[i] === o) {
return true;
}
}
}
return false;
}
function allow() {
var roles;
return true;
}
return true;
return true;
} else {
return false;
}
}
if (!allow()) {
throw "Access denied";
}