-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclient_validator_test.sh
More file actions
executable file
·92 lines (75 loc) · 2.61 KB
/
client_validator_test.sh
File metadata and controls
executable file
·92 lines (75 loc) · 2.61 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
ADMIN_NAME=admin
ADMIN_PASSWORD=admin_password_1234
CLIENT_ID=client_id1
TOKEN_ENDPOINT=http://localhost:3000/v1.0
CLIENT_DB_PATH=/tmp/users_test.db
ID_TOKEN_ENV=/tmp/id_token.env
cargo build --package rust-token-server
pgrep -f rust-token-server | xargs kill -9
######################
echo "ES256"
ADMIN_PASSWORD=${ADMIN_PASSWORD}\
./target/debug/rust-token-server run \
--token-issuer=${TOKEN_ENDPOINT} \
--client-ids=${CLIENT_ID} \
--signing-key-path=./server/sample-keys/p256.private_key.pem \
--db-file-path=${CLIENT_DB_PATH} &
sleep 5
######################
echo "lib-client"
RUST_LOG=debug \
ADMIN_NAME=${ADMIN_NAME}\
ADMIN_PASSWORD=${ADMIN_PASSWORD}\
CLIENT_ID=${CLIENT_ID}\
TOKEN_ENDPOINT=${TOKEN_ENDPOINT}\
cargo test --package rust-token-server-client -- --nocapture
######################
echo "lib-validator"
curl -X POST -H "Content-Type: application/json" \
-d "{ \"auth\": {\"username\": \"${ADMIN_NAME}\", \"password\": \"${ADMIN_PASSWORD}\" }, \"client_id\": \"${CLIENT_ID}\" }" \
${TOKEN_ENDPOINT}/tokens | jq '.token.id' | xargs echo > ${ID_TOKEN_ENV}
RUST_LOG=debug \
ID_TOKEN_ENV=${ID_TOKEN_ENV} \
ADMIN_NAME=${ADMIN_NAME}\
ADMIN_PASSWORD=${ADMIN_PASSWORD}\
CLIENT_ID=${CLIENT_ID}\
TOKEN_ENDPOINT=${TOKEN_ENDPOINT}\
TOKEN_ISSUER=${TOKEN_ENDPOINT}\
cargo test --package rust-token-server-validator -- --nocapture
pgrep -f rust-token-server | xargs kill -9
rm ${CLIENT_DB_PATH}
rm ${ID_TOKEN_ENV}
sleep 5
######################
echo "Ed25519"
ADMIN_PASSWORD=${ADMIN_PASSWORD}\
./target/debug/rust-token-server run \
--token-issuer=${TOKEN_ENDPOINT} \
--client-ids=${CLIENT_ID} \
--signing-key-path=./server/sample-keys/ed25519.private_key.pem \
--db-file-path=${CLIENT_DB_PATH} &
sleep 5
######################
echo "lib-client"
ADMIN_NAME=${ADMIN_NAME}\
ADMIN_PASSWORD=${ADMIN_PASSWORD}\
CLIENT_ID=${CLIENT_ID}\
TOKEN_ENDPOINT=${TOKEN_ENDPOINT}\
cargo test --package rust-token-server-client -- --nocapture
######################
echo "lib-validator"
curl -X POST -H "Content-Type: application/json" \
-d "{ \"auth\": {\"username\": \"${ADMIN_NAME}\", \"password\": \"${ADMIN_PASSWORD}\" }, \"client_id\": \"${CLIENT_ID}\" }" \
${TOKEN_ENDPOINT}/tokens | jq '.token.id' | xargs echo > ${ID_TOKEN_ENV}
RUST_LOG=debug \
ID_TOKEN_ENV=${ID_TOKEN_ENV} \
ADMIN_NAME=${ADMIN_NAME}\
ADMIN_PASSWORD=${ADMIN_PASSWORD}\
CLIENT_ID=${CLIENT_ID}\
TOKEN_ENDPOINT=${TOKEN_ENDPOINT}\
TOKEN_ISSUER=${TOKEN_ENDPOINT}\
cargo test --package rust-token-server-validator -- --nocapture
pgrep -f rust-token-server | xargs kill -9
rm ${CLIENT_DB_PATH}
rm ${ID_TOKEN_ENV}