Permalink
Browse files

Update documentation to reflect the current state

  • Loading branch information...
wallner committed Dec 11, 2016
1 parent 2e4c0ec commit 648ebf02e1249d9e4bc512ba56af8ab570c730ea
Showing with 16 additions and 11 deletions.
  1. +16 −11 docs/detailed-reference-installation.md
@@ -344,38 +344,43 @@ you get one:
You will get an answer like:
- {"access_token":“<YOUR_ACCESS_TOKEN>","token_type":"bearer","expires_in":716,"scope":"ADMIN", ...}
+ {"access_token":“<ACCESS_TOKEN>","token_type":"bearer","expires_in":716,"scope":"ADMIN", ...}
Take the value from the field `access_token` (shown in the example as
-`<YOUR_ACCESS_TOKEN>`) and store it in an environment variable.
+`<ACCESS_TOKEN>`) and store it in an environment variable.
- $ YOUR_ACCESS_TOKEN=<YOUR_ACCESS_TOKEN>
+ $ ACCESS_TOKEN=<ACCESS_TOKEN>
+
+If you have [jq](https://stedolan.github.io/jq/) installed an easy way to do that is the following command:
+
+ ACCESS_TOKEN=$(curl -H "Authorization: Basic $(echo -n 'example-client:secret' | base64)" -X POST -d "grant_type=client_credentials&scope=ADMIN" http://localhost:8080/oauth/token | jq -r ".access_token")
Get the initial admin user's ID
- curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -X GET "localhost:8080/Users?filter=userName%20eq%20\"admin\""
+ curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" -X GET "localhost:8080/Users?filter=userName%20eq%20\"admin\""
Extract the ID of the user and use it in the following request to update the
user with your preferred credentials:
curl -i -H "Accept: application/json" -H "Content-type:
- application/json" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -X PUT
+ application/json" -H "Authorization: Bearer $ACCESS_TOKEN" -X PUT
localhost:8080/Users/<DEFAULT_USERS_ID> -d
- '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"], "externalId":"","userName":"<YOUR_USERNAME>","password":"<YOUR_USERS_PASSWORD>"}'
+ '{"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"], "externalId":"","userName":"<USERNAME>","password":"<USER_PASSWORD>"}'
Add your client (see also [Parameters for clients]
(api_documentation.md#client-configuration)):
- curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -X POST localhost:8080/Client -d '{"id": "<YOUR_CLIENT_ID>", "accessTokenValiditySeconds": "9999", "refreshTokenValiditySeconds": "9999", "redirectUri": "<YOUR_REDIRECT_URI>", "scope": ["ADMIN", "ME"], "validityInSeconds": "9999", "implicit": "false", "grants": ["authorization_code", "client_credentials", "refreshtoken"]}'
+ curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" -X POST localhost:8080/Client -d '{"id": "<CLIENT_ID>", "client_secret":"<CLIENT_SECRET>", "accessTokenValiditySeconds": "9999", "refreshTokenValiditySeconds": "9999", "redirectUri": "<REDIRECT_URI>", "scope": ["ADMIN", "ME"], "validityInSeconds": "9999", "implicit": "false", "grants": ["authorization_code", "client_credentials", "refreshtoken"]}'
+
-The client's secret will be autogenerated and can only be read from the database
-directly at the moment:
+If you don't provide a `client_secret` one will be autogenerated.
+The response to the put request does not contain the secret, it can be retrieved via `GET`, however:
- select id, client_secret from osiam_client;
+ curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" localhost:8080/Client/<CLIENT_ID>
Delete the default client:
- curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -X DELETE localhost:8080/Client/example-client
+ curl -i -H "Accept: application/json" -H "Content-type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" -X DELETE localhost:8080/Client/example-client
## Using OSIAM

0 comments on commit 648ebf0

Please sign in to comment.