Viglet Vecchio allows to create authentication and authorization layers to access API.
If you'd like to contribute to Viglet Vecchio, be sure to review the contribution guidelines.
We use GitHub issues for tracking requests and bugs.
-
Install Docker. https://docs.docker.com/engine/installation
-
Pull Viglet Vecchio Docker and run it.
$ docker pull viglet/vecchio
$ docker run -d -p 2702:2702 --name vecchio viglet/vecchio
$ git clone --recurse-submodules https://github.com/openvecchio/vecchio.git
$ cd vecchio
Use Gradle to execute Vecchio API, without generate jar file.
$ ./gradlew bootrun
Use Gradle to generate Vecchio API executable JAR file.
$ ./gradlew build
To run Vecchio API executable JAR file, just execute the following line:
$ java -jar build/libs/viglet-vecchio.jar
For example, in Mapping Console (http://localhost:2702/console/#!/mapping) add the following URL:
GitHub - openviglet - URL: /github/openviglet - Proxy: https://api.github.com/users/openviglet
Create a new App (http://localhost:2702/console/#!/app/new) and copy the values of "Keys and Access Tokens" tab.
Will generate the following keys an tokens for your App, for instance:
Token | Value |
---|---|
Consumer Key (API Key) | 8d0304f37e2c0bbf1d9ab602e916ef34 |
Consumer Secret (API Secret) | c640f16520015c5a599f666107e4ce25 |
Access Token | fb803d96bb541ba658d514b3f4d88363 |
Access Token Secret | 43c713bcbdb7a54962a1b4abcfb8af58 |
You can access the API Resources using your Access Token, ou generate new Access Token using the followings Grant Types:
Use the Consumer Key (API Key) to generate the Authorization Code:
curl -I -X GET 'http://localhost:2702/oauth/authorize?response_type=code&client_id=8d0304f37e2c0bbf1d9ab602e916ef34&redirect_uri=http://localhost:2702/console/oauth2/receive_authcode'
Will return the Location, so get the Authorization Code:
Location: http://localhost:2702/console/oauth2/receive_authcode?code=e31d6626d203aaea0811305e33136d59`
Use the Authorization Code to generate the Access Token, for instance: b516216e45610d4be3716c8dfab70985
:
curl -X GET 'http://localhost:2702/oauth/token' -d 'grant_type=authorization_code&code=e31d6626d203aaea0811305e33136d59'
Use the Consumer Key (API Key) to generate the Authorization Code:
curl -I -X GET 'http://localhost:2702/oauth/authorize?response_type=token&client_id=8d0304f37e2c0bbf1d9ab602e916ef34&redirect_uri=http://localhost:2702/console/oauth2/receive_implicit_token'
Will return the Location, so get the Access Token, for instance: b516216e45610d4be3716c8dfab70985
:
Location: http://localhost:2702/console/oauth2/receive_implicit_token?access_token=b516216e45610d4be3716c8dfab70985&state=xyz&token_type=bearer&expires_in=3600
Ready! You can access the following API Resources using the Access Token from Authorization Code or Implicit Grant Types or App Settings (Your Access Token), for instance fb803d96bb541ba658d514b3f4d88363
, if you use an invalid Access Token, it will return empty response.
- GitHub - openviglet:
curl -X GET "localhost:2702/github/openviglet" -H "accept: application/json" -H "content-type: application/json" -H "authorization: Bearer fb803d96bb541ba658d514b3f4d88363"
Dashboard Console (http://localhost:2702/console/#!/dashboard) shows response time report.