2.4.0 • Published 2 years ago

node-freeipa v2.4.0

Weekly downloads
1,226
License
MIT
Repository
github
Last release
2 years ago

node-freeipa

CodeQL Coverage Status npm npm npm

A module to consume Freeipa server JSON_RPC API.

Install

$ npm i --save node-freeipa

Usage

First of all import the module and configure it, the user and password are needed to authenticate to the API.

const ipa = require('node-freeipa')

const opts = {
	server: "ipaserver.yourdomain",
	auth: {
		user: 'someuser',
		pass: 'someuserpassword'
	}
};

ipa.configure(opts);

Than make the call to desired method, below calling the json_metadata to return all methods provided by freipa server.

// Calling the method
ipa.json_metadata.then(result => {
  console.log(result);
});

// Using async/await
let result = await ipa.json_metadata();
console.log(result);

Just remember, all methods will return a promise. A list with all methods can be seen in https://server/ipa/ui/#/p/apibrowser/type=command

DOCs

configure (options)

options

Type: json

Pass all attributes for module configuration, the ones you can use:

var options = {
	server: "domain-not-changed", //server.domain of your destination
	auth: {
		user: false,
		pass: false,
	},
	ca: false, //Your Freeipa's CA loaded with fs
	expires: 1440, // Time in minutes to expiration of cookie/auth.
	cacheFolder: '.tmp', // Location where the cookie cache will be saved. Default: inside node_modules of the app.
};

ipa.method(args,{options})

method

Type: String

The method you wan't to call, ex: user_find.

args

Type: Array

Array of arguments you wan't to use, default: [].

{options}

Type: Json object

Json object containing options for the request, default: {}.

ipa.user_find().then(result => { });
//same as
ipa.user_find([""],{}).then(result => { });
// searching by an user with login
ipa.user_find([""],{login: 'mylogin'}).then(result => { });
// searching by criteria only
ipa.user_find(['mylogin']).then(result => { });
// searching by criteria only and option
ipa.user_find(['mylogin'], {mail: 'mylogin@domain.com'}).then(result => { });

Freeipa Error codes:

These are padronized erros returning by any of the requests. Every error are returned from resolve, reject was discarded on version 2.2+.

ERRORDESC
FREEIPA.NOARGSNo options was passed to Request Builder
FREEIPA.NO_DATANo data returned
FREEIPA.AUTH_ERRORInvalid authentication or json parse
FREEIPA.REQUEST_ERRORError during the request
FREEIPA.UNHANDLED_ERRORUnhandled error
<IPA.ERROR>Returned from Freeipa Servers

Freeipa API usage:

Below are some helpers on how to use Freeipa API:

Talking to Freeipa Freeipa API_Examples

License

MIT © Lucas Diedrich

2.4.0

2 years ago

2.3.6

2 years ago

2.3.7

2 years ago

2.3.4

3 years ago

2.3.5

3 years ago

2.3.2

3 years ago

2.3.1

4 years ago

2.3.0

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.0.13

6 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago