atlassian-crowd

A node.js module to communicate with Atlassian Crowd

Atlassian Crowd Library for node.js

A node.js module for interacting with the Atlassian Crowd asynchronously.

In order to use this module you will first need to configure an application in Atlassian Crowd and Configure the Remote IP Address.

See the Atlassian Crowd Documentation (Adding and Application) for assistance.

var AtlassianCrowd = require('atlassian-crowd');
var options = {
  "crowd": {
    "base": "http://localhost", 
    "port": 8080
  },
  "application": {
    "name": "my application",
    "password": "pass123"
  }
}

var crowd = new AtlassianCrowd(options);

If you do not know these please ask your systems administrator.

application.name Application name as configured in Atlassian Crowd application.password Application name as configured in Atlassian Crowd crowd.baseurl Atlassian Crowd Base URL (Example http://crowd.localhost.com or http://localhost/context/)

crowd.port If you have Crowd running on a port other than 80 or 443 specify the port number here

Functions for interacting with a user account.

user.find(userrname, callback) Callback contains two possible values. The first is an error object if the operation was not successful and the second is an Object containing details about the user.

crowd.user.find('test', function(err, res) {
  if(err) { 
    throw err;
   }
  else {
    console.log(res);
  }
});

user.create(firstname, lastname, displayname, email, username, password, callback)
Callback contains one possible value which is an error object if the operation was not successful.

crowd.user.create('test', 'user', 'Test User', 'test@foo.bar', 'testuser', 'password', function(err) {
  if(err) { 
    throw err;
  }
  else {
    console.log("Success")
  }
});

user.remove(username, callback)
Callback contains one possible value which is an error object if the operation was not successful.

crowd.user.remove('testuser', function(err) {
  if(err) { 
    throw err;
  }
  else {
    console.log("Success")
  }
});

user.active(username, callback)
Callback contains two possible values. The first is an error obiect if the operation was not successful and the second is a Boolean

crowd.user.active('user', function (err, res) {
  if(err) {
    throw err;
  }
  else {
    console.log(res.toString());
  }
});

user.groups(username, callback)
Callback contains two possible values. The first is an error obiect if the operation was not successful and the second is an Array of Group Names

crowd.user.groups(username, function (err, res) {
  if(err) {
    throw err;
  }
  else {
    console.log(res);
  }
});

user.authenticate(username, password, callback)
Callback contains two possible values. The first is an error object if the operation was not successful and the second is an Object containing details about the user

crowd.user.authenticate('user', 'password', function(err, res) {
  if(err) { 
    throw err;
   }
  else {
    console.log(res);
  }
});

group.find(groupname, callback)
Callback contains two possible values. The first is an error object if the operation was not successful and the second is an Object containing details about the group

crowd.groups.find('crowd-administrators', function (err, res) {
  if(err) {
    throw err;
  }
  else {
    console.log(res);
  }
});

group.create(name, description) Callback contains one possible value which is an error object if the operation was not successful.

crowd.groups.create("test-group", "Test Description", function(err) {
  if(err) {
    throw err;
  }
  else {
    console.log("Success");
  }
});

TODO

  • Finish Docs
  • Update User Profile