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

iitm-network-auth

v0.3.3

Published

Authentication library for IIT Madras network using openLDAP credentials

Downloads

38

Readme

iitm-network-auth

npm version

npm module to authenticate against the IIT Madras campus network using openLDAP credentials

Installation

npm install iitm-network-auth --save

Usage

Import the module

var IITMNetworkAuth = require('iitm-network-auth');

Create an instance

  • Initialise with username, password and mode of login
    Modes that are availabe:
    • nfw: For the new firewall login (through https://nfw.iitm.ac.in)
    • TODO: netaccess: For the existing netaccess login (through https://netaccess.iitm.ac.in)
var auth = new IITMNetworkAuth('<username>', '<password>', '<mode>');

Login

auth.login();

Logout

auth.logout();

Keep the session alive

The module can keep an authentication session alive by sending request to keepalive url.
The current inteval is set to 9 minutes as the firewall keeps a session for 10 minutes.

auth.start_refresh();

Stop refreshing the session

auth.stop_refresh();

Refresh the session manually

auth.refresh()

Get login status

var logged_in = auth.is_logged_in();

Event listeners

The module emits events to denote certain actions as they happen. Any client code can subscribe to these events and take necessary actions

  • Get the event emitter
var emitter = auth.get_emitter();
  • Add event listeners
// do something when an error happens
emitter.on('error', function (e) {
    console.log(e.data); // log error details to the console
});

// do something when a login happens
emitter.on('log_in', function (e) {
    console.log(e.data); // log details to the console
});

// do something when a logout happens
emitter.on('log_out', function (e) {
    console.log(e.data); // log details to the console
});

// do something when a session is refreshed
emitter.on('session_refresh', function (e) {
    console.log(e.data); // log details to the console
});

// do something when a refresh timer is started/stopped
emitter.on('refresh_timer', function (e) {
    console.log(e.data.running); // log status to the consle (true/false)
});

Set new credentials

auth.set_credentials('<username>', '<password>');

TODO:

  • Implement netaccess mode
  • Improve documentation

Contributing

Pull requests are welcome