populateRolesFromRelationship.js revision 738dcf53cdbddc9f941ca40c8db8dcf3e472eca5
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync/*global security, properties, openidm */
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * This context population script is called when the managed user auth module was used
fe4ab4755267c794c02d7693b5cd2c748a024053vboxsync * to successfully authenticate a user
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * global properties - auth module-specific properties from authentication.json for the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * managed user auth module
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * "propertyMapping": {
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * "userRoles": "roles",
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync * "userCredential": "password",
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync * "userId": "_id"
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync * "authnPopulateContextScript": "auth/managedPopulateContext.js",
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync * "defaultUserRoles": [ ]
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync * global security - map of security context details as have been determined thus far
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync * "authorization": {
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync * "id": "jsmith",
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync * "component": "managed/user",
bd22ae3b86e9b0ed466109e988d302674ecf4aeevboxsync * "roles": [ "openidm-authorized" ]
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync * "authenticationId": "jsmith",
bd22ae3b86e9b0ed466109e988d302674ecf4aeevboxsync(function () {
4604ab7d38c2bd2dfc255aa1facffdf81c1c9153vboxsync user = openidm.read(security.authorization.component + "/" + security.authorization.id);
.filter(function (r) {
.map(function (r) {
.value()
return security;