I lost access to my crowd server awhile ago and things more or less stopped here.
Check out a new version that is Promise-based written in ES6 available here at https://github.com/wehkamp/atlassian-crowd-client or NPM at https://www.npmjs.com/package/atlassian-crowd-client
A node.js module for interacting with the Atlassian Crowd.
Provides the ability to Add, Remove, and Manage Users and Groups as well as SSO functionality.
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 an Application) for assistance.
var AtlassianCrowd = require('atlassian-crowd');
var options = {
"crowd": {
"base": "http://localhost:8059/crowd/"
},
"application": {
"name": "my application",
"password": "pass123"
}
}
var crowd = new AtlassianCrowd(options);
If you do not know these please ask your systems administrator.
crowd.base
Atlassian Crowd Base URL
application.name
Application name as configured in Atlassian Crowd
application.password
Application name as configured in Atlassian Crowd
A simple function to check connectivity to Atlassian Crowd.
ping(callback)
- callback Function (err, res)
crowd.ping(function (err, res) {
if(err) {
throw err;
}
else {
console.log(res)
}
});
Uses the Crowd Query Language
See Crowd Query Language Documenation for more details
search(entityType, query, callback)
- entityType String 'user' or 'group'
- query String Crowd Query
crowd.search('user', 'firstName="test*"', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
crowd.search('group', 'name="*test*"', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
Here you can find utilities for Managing, Creating, Removing, Users as well as Changing Passwords, and Basic Authentication (NON SSO).
user.find(userrname, callback)
- username String
- callback Function (err, res)
crowd.user.find('user', function(err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
user.active(username, callback)
- username String
- callback Function (err, res)
crowd.user.active('user', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res.toString());
}
});
user.create(firstname, lastname, displayname, email, username, password, callback)
- firstname String
- lastname String
- displayname String
- email String
- username String
- password String
- callback Function (err)
crowd.user.create('Test', 'User', 'Test User', '[email protected]', 'testuser', 'abc123', function(err) {
if(err) {
throw err;
}
else {
console.log('Success')
}
});
user.remove(username, callback)
- username String
- callback Function (err)
crowd.user.remove('testuser', function(err) {
if(err) {
throw err;
}
else {
console.log('Success')
}
});
user.groups(username, callback)
- username String
- callback Function (err, res)
crowd.user.groups('testuser', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
user.attributes(username, callback)
- username String
- callback Function (err, res)
crowd.user.attributes('testuser', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
user.setAttributes(username, name, values, callback)
- username String
- name String
- values String or Array
- callback Function (err, res)
crowd.user.setAttributes('testuser', 'attributeName', 'attributeValue', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
user.removeAttribute(username, name, values, callback)
- username String
- name String
- callback Function (err, res)
crowd.user.removeAttribute('testuser', 'attributeName', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
user.authenticate(username, password, callback)
- username String
- password String
- callback Function (err, res)
crowd.user.authenticate('testuser', 'abc123', function(err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
user.changepassword(username, newpassword)
- username String
- newpassword String
- callback Function (err)
crowd.user.changepassword('testuser', 'newpass', function (err) {
if(err) {
throw err;
}
else {
console.log('Success');
}
});
Here you can find utilities for Managing, Creating, and Removing Groups.
groups.find(groupname, callback)
- groupname String
- callback Function (err, res)
crowd.groups.find('crowd-administrators', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
groups.create(name, description, callback)
- name String
- description String
- callback Function (err)
crowd.groups.create('test-group', 'Test Description', function(err) {
if(err) {
throw err;
}
else {
console.log('Success');
}
});
groups.remove(name, callback)
- name String
- callback Function (err)
crowd.groups.remove('test-group', function (err) {
if(err) {
throw err;
}
else {
console.log('Success');
}
groups.addmember(username, group, callback)
- username String
- group String
- callback Function (err)
crowd.groups.addmember('testuser', 'test-group', function (err) {
if(err) {
throw err;
}
else {
console.log('Success');
}
});
groups.removemember(username, group, callback)
- username String
- group String
- callback Function (err)
crowd.groups.removemember('testuser', 'test-group', function (err) {
if(err) {
throw err;
}
else {
console.log('Success');
}
});
groups.directmembers(groupname, callback)
- groupname String
- callback Function (err, res)
crowd.groups.find('test-group', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
groups.nestedmembers(groupname, callback)
- groupname String
- callback Function (err, res)
crowd.groups.nestedmembers('test-group', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
Provides SSO Functionality
session.create(username, password, callback)
- username String
- password String
- remote_addr String (optional)
- callback Function (err, res)
crowd.session.create('testuser', 'secret', function (err, token) {
if(err) {
throw err;
}
else {
console.log(token);
}
});
session.authenticate(token, remote_addr, callback)
- token String
- remote_addr String (optional)
- callback Function (err, res)
crowd.session.authenticate('xAbCd345', '192.168.1.100', function (err, res) {
if(err) {
throw err;
}
else {
console.log(res);
}
});
session.destroy(token, callback)
- token String
- callback Function (err)
crowd.session.destroy('xAbCd345', function (err) {
if(err) {
throw err;
}
else {
console.log('Successfully Destroyed Session');
}
});
- Update User Profile