npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-freeipa

v2.4.0

Published

A module to consume Freeipa Server API using promises.

Downloads

853

Readme

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: '[email protected]'}).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+.

| ERROR | DESC |---|---| | FREEIPA.NOARGS | No options was passed to Request Builder | | FREEIPA.NO_DATA | No data returned | | FREEIPA.AUTH_ERROR | Invalid authentication or json parse | | FREEIPA.REQUEST_ERROR | Error during the request | | FREEIPA.UNHANDLED_ERROR | Unhandled 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