{"_id":"@creative-realities/role-provider-client","_rev":"3-aa15c1c8a0fecd8446371cf6a120211c","name":"@creative-realities/role-provider-client","dist-tags":{"latest":"2.0.0"},"versions":{"1.7.0":{"name":"@creative-realities/role-provider-client","version":"1.7.0","keywords":["role","provider","client"],"author":{"url":"http://ec2-54-145-234-173.compute-1.amazonaws.com/u/alockhart","name":"Adam Lockhart","email":"alockhart@reflectsystems.com"},"license":"MIT","_id":"@creative-realities/role-provider-client@1.7.0","maintainers":[{"name":"adamlockhart","email":"adam.lockhart@cri.com"},{"name":"darkvalence","email":"david.kopaniky@cri.com"}],"dist":{"shasum":"9ca5686c05a0c2032860e7fc9985bca91fe959d7","tarball":"https://registry.npmjs.org/@creative-realities/role-provider-client/-/role-provider-client-1.7.0.tgz","fileCount":3,"integrity":"sha512-Bj7cCCWtU4ZzbrfdfHrWdZCjvdfoHIFGPf2k2zzWFn4hlgHSbRRyNknjRvzREssOt+5qxXm+3jOtuTfW1NhUgQ==","signatures":[{"sig":"MEUCIQC2/MKAfFWX2Ikc11LdvYtJfDYa4JX3rbxdP1A+g+5cKAIgRkEz+c5jM//1v6fdmgLEg86ZoK4LAE8fsX4B2i8Hn1U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10620},"main":"index.js","gitHead":"0c1f81216da80b96fe8f08d3aa091b31bc3e426b","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"adamlockhart","email":"adam.lockhart@cri.com"},"repository":{"url":"git@gitlab.reflect.systems:Reflect/role-provider-client.git","type":"git"},"_npmVersion":"6.14.5","description":"A node package for signing Role Prover requests.","directories":{},"_nodeVersion":"12.18.2","dependencies":{"request":"2.x"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/role-provider-client_1.7.0_1767819521729_0.5882038095952087","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@creative-realities/role-provider-client","version":"2.0.0","keywords":["role","provider","client"],"author":{"url":"http://ec2-54-145-234-173.compute-1.amazonaws.com/u/alockhart","name":"Adam Lockhart","email":"alockhart@reflectsystems.com"},"license":"MIT","_id":"@creative-realities/role-provider-client@2.0.0","maintainers":[{"name":"adamlockhart","email":"adam.lockhart@cri.com"},{"name":"darkvalence","email":"david.kopaniky@cri.com"}],"dist":{"shasum":"d7c5c8c64e4a9b5e32ae4a9391ca3b0ef973edcc","tarball":"https://registry.npmjs.org/@creative-realities/role-provider-client/-/role-provider-client-2.0.0.tgz","fileCount":3,"integrity":"sha512-1Gy5U6W5FRuJ7rg03UKl5mZMv+iJc5xLvWVOz2mnxuf8rHCNwclT4Y9HlhlHTqn7LJrtaw+Us3R5is+6l7ewfQ==","signatures":[{"sig":"MEUCICEuggMt8eQnxs1EJ89hnqcSA2tg8EAJFV4CPHTaaYUHAiEAiNNvSZWRJa0w9Yxb5D9A5hfG8mN/FRu09aGSjacOcCI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11124},"main":"index.js","gitHead":"f795b217a0d24d4c2aadb59d961e341d5b613404","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"adamlockhart","email":"adam.lockhart@cri.com"},"repository":{"url":"git@gitlab.reflect.systems:Reflect/role-provider-client.git","type":"git"},"_npmVersion":"10.9.4","description":"A node package for signing Role Prover requests.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"request":"2.x"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/role-provider-client_2.0.0_1768500187597_0.43075904099628004","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-01-07T20:58:41.647Z","modified":"2026-08-06T18:25:32.123Z","1.7.0":"2026-01-07T20:58:41.877Z","2.0.0":"2026-01-15T18:03:07.732Z"},"author":{"url":"http://ec2-54-145-234-173.compute-1.amazonaws.com/u/alockhart","name":"Adam Lockhart","email":"alockhart@reflectsystems.com"},"license":"MIT","keywords":["role","provider","client"],"repository":{"url":"git@gitlab.reflect.systems:Reflect/role-provider-client.git","type":"git"},"description":"A node package for signing Role Prover requests.","maintainers":[{"email":"adamlockhart12@gmail.com","name":"adamlockhart"},{"email":"david.kopaniky@cri.com","name":"darkvalence"},{"email":"shem.peters@cri.com","name":"shem.peters"}],"readme":"## Role Provider Client\n\nA node package for signing Role Prover requests.\n\n### Example setup\nIt would be better to pull configuration data from a config file.  But for example:\n```\nvar roleProviderConfig = {\n\tservice_name: \"My Service\",\n\tservice_id: \"507f1f77bcf86cd799439011\",\n\tsecret_key: \"188bc580-8e50-11e5-8994-feff819cdc9f\",\n\trole_provider_host: \"roles.dev.reflect.systems\" // Optional. Defaults to \"roles.reflect.systems\"\n};\nvar roleProviderClient = require(\"role-provider-client\")(roleProviderConfig);\n```\n\n### Example usage\n```\nvar method = \"POST\";\nvar uri = \"/api/users\";\nvar authHeader = roleProviderClient.getAuthHeader(method, uri, req.session.token);\n```\n\n### Optional app\nLoading api with express app.\n- The app is assumed to have session middleware.\n- The app is assumed to have a body parser.\n```\nroleProviderClient.loadAPI(app);\n```\n\nOther config options:\n```\nvar roleProviderConfig = {\n\t// ...\n\troleProviderApiRoute: \"/api/stuff\", // defaults to \"/api/roles\"\n\tloginRoute: \"/login-stuff\" // defaults to \"/login\"\n};\n```\nIt is up to you to implement the login page at the loginRoute, which should load an iframe from the role provider server. Example is in the ad-server-front repository.\nIt is also up to you to implement the client side portion of the API that this package provides.\n\n### Auth middleware\n`app.use(roleProviderClient.authMiddleware);`\n\nThe authMiddleware whitelist is an optional object whose keys are routes, and values maybe be arrays of actions or simply `\"*\"` to whitelist all actions or to whitelist a route that doesn't use actions. The loginRoute will default to `\"*\"`.\nThe whitelisted routes and actions will pass through the authMiddleware without requiring an authenticated session user. \n```\nroleProviderConfig.middlewareWhitelist = {\n\t\"/api/public\": \"*\",\n\t\"/api/semi-public\": [\"getPublic\", \"doFunStuff\"]\n};\nvar roleProviderClient = require(\"role-provider-client\")(app, roleProviderConfig);\n```\n\n### Callbacks\n```\nvar route = \"/account\";\nvar action = \"getAccount\";\nroleProviderClient.on(route, action, function(data, next) {\n\t// If response body was JSON, data will be an object.  Otherwise it is a String.\n\t...\n\t// In case of an error\n\tif (error)\n\t\treturn next({status: 404, message: \"Error message\"});\n\t...\n\t// success\n\tnext();\n});\n```","readmeFilename":"README.md"}