populateRolesFromRelationship.js revision 48a99a679220c6522d8b11dc1305f7780ae02a8e
/*global security, properties, openidm */
/**
* This context population script is called when the managed user auth module was used
* to successfully authenticate a user
*
* global properties - auth module-specific properties from authentication.json for the
* managed user auth module
*
* {
* "propertyMapping": {
* "userRoles": "roles",
* "userCredential": "password",
* "userId": "_id"
* },
* "authnPopulateContextScript": "auth/managedPopulateContext.js",
* "defaultUserRoles": [ ]
* }
*
* global security - map of security context details as have been determined thus far
*
* {
* "authorizationId": {
* "id": "jsmith",
* "roles": [ "openidm-authorized" ]
* },
* "authenticationId": "jsmith",
* }
*/
(function () {
throw {
"code" : 500,
"message" : "Authentication not properly configured; missing internalRolesRelationship propertyMapping entry"
};
}
throw {
"code" : 401,
"message" : "Unable to find property " + properties.propertyMapping.internalRolesRelationship + " for user"
};
}
.filter(function (r) {
})
.map(function (r) {
// appending empty string gets the value from java into a format more familiar to JS
})
.value()
};
return security;
}());