Closed fxprunayre closed 3 years ago
# Authenticate
gn_token=$( \
curl test-client:noonewilleverguess@127.0.0.1:9900/oauth/token \
-dgrant_type=password -dscope=any \
-dusername=admin -dpassword=admin \
| jq -r '.access_token')
# Testing the token
gn_auth_header=$(echo "Authorization: Bearer $gn_token")
curl 127.0.0.1:9900/secured -H "$gn_auth_header"
> Search service called. You are authenticated as momo, ROLE_USER
# Search service (TODO: Need to be accessible to anonymous)
curl 127.0.0.1:9900/search \
-H "Accept: application/json" \
-H "Content-type: application/json" \
-H "$gn_auth_header" \
-X POST \
-d '{"from": 0, "size": 0, "query": {"query_string": {"query": "+isTemplate:n"}}}' | jq -r '.hits.total.value'