Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

A simple Node.js module you can use to build you own external ejabberd auth with

License

Notifications You must be signed in to change notification settings

derWhity/node-ejabberd-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-ejabberd-auth

A simple Node.js module you can use to build you own external ejabberd auth with

Installation

npm install ejabberd-auth

Usage

To create your own external authentication script for ejabberd, simply require ejabberd-auth and call the run() method exported by this module while passing your authentification function to it.

require('ejabberd-auth').run({
    actions: {
        auth: function(done, userName, domain, password) {
            // Some auth to be done here
            done(true); // or done(false) if the authentification has failed
        }
    }
});

run() takes a configuration object. It takes the following options:

  • log: Configuration for the Winston File transport used for logging (refer the winston documentation for more details). If no log configuration or filename is given, logging will be disabled.
  • actions: An object containing callback functions for the module to call, when ejabberd requests an action. Possible keys are:
    • auth: Called, when a user tries to log in. Call the callback with true to allow the user to enter. auth: function(callback, userName, domainName, password)
    • isuser: Called, when ejabberd needs to check, if a JID exists. isuser: function(callback, userName)
    • setpass: Called, when a user tries to change their password. Change the password and call the callback with true, to signalize, that the password was successfully changed. setpass: function(callback)

If any of the action key is not given, false will be returned to ejabberd.

About

A simple Node.js module you can use to build you own external ejabberd auth with

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages