Skip to content

Instantly share code, notes, and snippets.

@joel-bernstein
Last active June 19, 2019 16:52
Show Gist options
  • Save joel-bernstein/97e645e8a64c439c91cfd745564879c7 to your computer and use it in GitHub Desktop.
Save joel-bernstein/97e645e8a64c439c91cfd745564879c7 to your computer and use it in GitHub Desktop.
Add the admin password:
curl -X POST -H "Content-type:application/json" -d '{"password":"password123"}' "http://localhost:6764/api"
Add role with authorities:
curl -u admin:password123 -X POST -H 'Content-type: application/json' -d
'{"name":"test", "permissions":[{"methods":["GET"],"path":"/catalog/fusion/assets/**"},
{"methods":["POST"],"path":"/api/apollo/catalog/fusion/query"}]}' http://localhost:6764/api/roles
Add user with role:
curl -u admin:password123 -X POST -H 'Content-type: application/json' -d
'{"username":"guest1", "password":"password456", "passwordConfirm":"password456", "realmName": "native", "roleNames":["test"]}'
http://localhost:6764/api/users
Add user without role:
curl -u admin:password123 -X POST -H 'Content-type: application/json' -d
'{"username":"guest2", "password":"password456", "passwordConfirm":"password456", "realmName": "native"}'
http://localhost:6764/api/users
Run query through that Catalog API SQL passthrough with user with the authorized role:
curl -ilk -X POST -u guest1:password456 -H "Content-type: application/json"
http://localhost:6764/api/apollo/catalog/fusion/query -d '{"sql": "select id from testapp"}'
Run query through that Catalog API SQL passthrough with user with the authorized role:
curl -ilk -X POST -u guest2:password456 -H "Content-type: application/json"
http://localhost:6764/api/apollo/catalog/fusion/query -d '{"sql": "select id from testapp"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment