node-freeipa-customheaders
v2.4.0
Published
A module to consume FreeIPA Server API using promises. (Customized to support additional headers)
Readme
node-freeipa-customheaders
A customized version of node-freeipa that supports injecting custom HTTP headers (e.g., service tokens or reverse proxy headers) into all FreeIPA JSON-RPC API calls.
Install
npm install --save node-freeipa-customheadersUsage
const ipa = require('node-freeipa-customheaders');
const opts = {
server: "ipaserver.yourdomain",
auth: {
user: "admin",
pass: "adminpassword"
},
headers: {
// Example headers used to authenticate with an external access service
'Authorization': 'Bearer YOUR_SERVICE_TOKEN',
'X-Custom-Header': 'some-value',
'Referer': 'https://ipaserver.yourdomain/ipa'
},
expires: 1440
};
ipa.configure(opts);
// Example API call
ipa.user_find(["username"], { all: true }).then(console.log);All methods return Promises.
Browse FreeIPA API methods at:https://your-ipa-server/ipa/ui/#/p/apibrowser/type=command
API
configure(options)
ipa.configure({
server: "ipa.example.org",
auth: {
user: "admin",
pass: "adminpass"
},
headers: {
"Authorization": "Bearer YOUR_SERVICE_TOKEN",
"X-Custom-Header": "some-value",
"Referer": "https://ipa.example.org/ipa"
}
});ipa.<method>(args[], options{})
ipa.user_show(["username"], { all: true }).then(console.log);
ipa.user_find([""], { givenname: "John" }).then(console.log);Common Errors
| Code | Description |
|-----------------------|---------------------------------------|
| FREEIPA.NOARGS | No arguments provided |
| FREEIPA.NO_DATA | No data returned |
| FREEIPA.AUTH_ERROR | Authentication or session issue |
| FREEIPA.REQUEST_ERROR | HTTP/connection error |
| FREEIPA.UNHANDLED_ERROR | Uncaught error/invalid response |
| <IPA.ERROR> | Returned from FreeIPA server |
References
License
MIT © Lucas Diedrich
Customized by Somesh Nistala
