You can add an application a user using the CLI tool, REST API or the PPaaS Console as shown below:
...
Localtabgroup |
---|
Localtab |
---|
| Adding a user via the CLIOverviewCLI command | add-user | Description | Add a new user. | Command format | Code Block |
---|
add-user -u <USERNAME> -p <PASSWORD> -r <ROLE_NAME> -f <FIRST_NAME> -l <LAST_NAME> -e <EMAIL> -pr <PROFILE_NAME> |
|
Parameter definitionShort option | Long option | Description | Required | Example value |
---|
-u | --username
| Username given to the user. | Yes | kim | -p | --password
| User's password. | Yes | admin123 | -r | --role-name | Role assigned to the user. When adding a user in Stratos, only the following values are allowed for the property "role": | Yes | admin | -f | --first-name
| User's first name. | Yes | Kim | -l | --last-name
| User's last name. | Yes | Myers | -e | --email
| User's email address. | Yes | foo@bar.com | -pr | --profile-name | User's profile name. | Yes | dev |
ExampleAdd a user with the username: admin2 kim, name: Frank Kim Myers, password: admin123, email: foo@bar.com, role: admin and profile: dev. Code Block |
---|
add-user -u kim -p admin123 -r admin -f Kim -l Myers -e foo@bar.com -pr dev |
Sample output Code Block |
---|
User added successfully: [user] kim |
|
Localtab |
---|
| Adding a user via the REST APIOverviewDescription | Add a user. | Resource Path | | HTTP Method | POST | Request/Response Format | application/json | Command format | Code Block |
---|
curl -X POST -H "Content-Type: application/json" -d @'<JSON_PAYLOAD>' -k -v -u <USERNAME>:<PASSWORD> https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/users |
Info |
---|
- The path to the JSON file that defines the application user needs to be defined as the
<JSON_PAYLOAD> value. - By default,
<USERNAME>:<PASSWORD> is admin:admin. - By default,
<PRIVATE_PAAS_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified. - By default,
<PRIVATE_PAAS_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n , the default port value needs to be incremented by n .
|
|
ExampleAdd the user defined in the user.json file. Code Block |
---|
curl -X POST -H "Content-Type: application/json" -d @'user.json' -k -v -u <USERNAME>admin:<PASSWORD>admin https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>localhost:9443/api/users |
Sample output Code Block |
---|
> POST /api/users HTTP/1.1
> Host: localhost:9443
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 136
>
< HTTP/1.1 201 Created
< Date: Tue, 13 Oct 2015 17:33:27 GMT
< Location: https://localhost:9443/api/users/kim
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
<
{"status":"success","message":"User added successfully: [user] kim"} |
You will come across the following HTTP status codes while adding a user: HTTP status code | 201, 400, 409, 500 See the descriptions of the HTTP status codes here. | Location header URL | https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/users/<USERNAME>
|
|
|
...
Sample user
...
JSON
Panel |
---|
The following are sample configurations that can be used in a JSON to define an application:
Excerpt |
---|
Code Block |
---|
{
"userName": "kim",
"credential": "kim12345",
"role": "admin",
"firstName": "Frank",
"lastName": "Myers",
"email": "foo@bar.com"
} |
|