iitm-network-auth
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 = ;
Create an instance
- Initialise with username, password and mode of login
Modes that are availabe:nfw
: For the new firewall login (throughhttps://nfw.iitm.ac.in
)- TODO:
netaccess
: For the existing netaccess login (throughhttps://netaccess.iitm.ac.in
)
var auth = '<username>' '<password>' '<mode>';
Login
auth;
Logout
auth;
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;
Stop refreshing the session
auth;
Refresh the session manually
auth
Get login status
var logged_in = auth;
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 happensemitter; // do something when a login happensemitter; // do something when a logout happensemitter; // do something when a session is refreshedemitter; // do something when a refresh timer is started/stoppedemitter;
Set new credentials
auth;
TODO:
- Implement
netaccess
mode - Improve documentation
Contributing
Pull requests are welcome