forked from techsavvyash/oidc-lite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuser.sh
executable file
·50 lines (44 loc) · 1.09 KB
/
user.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Base URL
BASE_URL="http://localhost:3001/user/registration/combined/"
# Function to generate a random string
generate_random_string() {
local length=$1
tr -dc A-Za-z0-9 </dev/urandom | head -c $length
}
# Loop to create 100 users
for i in {1..100}; do
# Generate random username, password, and email
USERNAME="user$(generate_random_string 6)"
PASSWORD=$(generate_random_string 12)
EMAIL="${USERNAME}@example.com"
# Create JSON payload
JSON_PAYLOAD=$(cat <<EOF
{
"data": {
"userInfo": {
"active": true,
"applicationId": "myminioadmin",
"membership": [],
"userData": {
"username": "$USERNAME",
"password": "$PASSWORD"
},
"email": "$EMAIL"
},
"registrationInfo": {
"generateAuthenticationToken": true,
"applicationId": "myminioadmin"
}
}
}
EOF
)
# Send curl request
curl -X POST "$BASE_URL" \
-H "Content-Type: application/json" \
-H "x-stencil-tenantid: minio-tenant" \
-H "authorization: master" \
-d "$JSON_PAYLOAD"
echo "Created user $i: $USERNAME with email $EMAIL"
done