-
Notifications
You must be signed in to change notification settings - Fork 75
CURL Jans Config Api
Mohammad Abudayyeh edited this page Aug 23, 2022
·
3 revisions
Jans Config Api is a REST application that is developed using Weld 4.x (JSR-365) and JAX-RS. Its endpoint can be used to manage configuration and other properties of Jans Auth Server.
Jans Config Api endpoints are oAuth protected. It supports basic token as well as JWT token.
Jans Config API has REST endpoints and can be invoked via curl.
You will need:
- jans endpoint URL: https://<server.url>/jans-config-api/....
- Token: The endpoints are oAuth protected and hence will require token with appropriate scopes.
-
Refer to jans-config-api documentation to check the endpoint path and required oAuth scopes. Example: Attribute Endpoint
-
You will need client with required scopes. Jans Config Api internal client that starts with
1800
has the required scopes. -
Use auth token to generate basic token.
Syntax:
curl -k https://<my.jans.server.domian>/jans-auth/restv1/token -H "Accept: application/json" -u "<clientId>:<decryptedClientSecret>" -d "grant_type=client_credentials" -d "scope= <apce separated oAuth Scope List>"
Example: generate token for attribute:
curl -k https://jans.server1/jans-auth/restv1/token -H "Accept: application/json" -u "1800.3687abff-770f-48fb-8130-97678d918adc:TUDvmnVINbKC" -d "grant_type=client_credentials" -d "scope=https://jans.io/oauth/config/attributes.readonly"
- Invoke endpoint
Syntax:
curl -k -i -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization:Bearer <accessToken>" -X GET https://< my.jans.server.domian >/jans-config-api/api/v1/attributes
Example: Invoke attribute GET endpoint:
curl -k -i -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization:Bearer 45e73488-da3f-4429-9072-e0833c703a0d" -X GET https://jans.server1/jans-config-api/api/v1/attributes