Is there any way to create a user in crowd using CLI or using some command?

962 Views Asked by At

Is there any way to create a user in crowd using CLI or using some command?

I get 403 prohibited error when ever I try accessing the crowd using curl command i.e curl -X GET http://<crowd link>:8095/crowd/rest/usermanagement/1/user?usernamedeepak

2

There are 2 best solutions below

4
Ranadip Dutta On

Crowd has a lot of features in the cmdline itself.

crowd [--help] (-a|--action) <action> [(-f|--file) <file>] [--encoding <encoding>] [--debug] [-v|--verbose] [--quiet] [--outputFormat <outputFormat>] [--sql <sql>] [--driver <driver>] [--url <url>] [--host <host>] [--port <port>] [--database <database>] [--continue] [--simulate] (-s|--server) <server> (-u|--user) <user> (-p|--password) <password> [--login <login>] [--service <service>] [-l|--loginFromStandardInput] [--api <api>] [--directory <directory>] [--group <group>] [--userId <userId>] [--userFullName <userFullName>] [--userEmail <userEmail>] [--userPassword <userPassword>]

For user creation, you can use

addUser - Add a new user.
         Required parameters: userId
         Optional parameters: userFullName, userEmail, userPassword
addUserWithFile - Add users from comma separated file.
         Required parameters: file

Refer the USAGE link for reference.

You can further use REST APIs to create the user. Refer the REST API LINK

Hope it helps.

1
miszobi On

You should be able to use the REST api to create users, as you've been trying to.

Note that the /usermanagement resources require you to authenticate (using basic auth) with an application's credentials (as they're meant to be used by connected applications), and will affect the directories associated with that application in the Crowd configuration screen.

You'll also need to make sure the 'Remote addresses' section of the application configuration, lists your IP address as allowed to connect (or you can add 0.0.0.0/0 there, to allow all connections for that application.

So to recap, what you probably want to do is:

  1. Create a new application in Crowd connected to the directory you want to manipulate
  2. Set the credentials for the application
  3. Set the remote addresses for the application, to allow connections from the host you're trying to connect from
  4. Use the usermanagement/1/user REST resource with curl or other http client, using basic auth to authenticate as the configured application

Disclosure: I'm one of the developers working on Crowd.