jvcalderon / token-service
A dockerized microservice who provides a REST interface with token's common functionality
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: ^7.0
- carlosbuenosvinos/ddd: ^1.6
- doctrine/orm: ^2.5
- jms/serializer: ^1.4
- silex/silex: ~2.0
- symfony/yaml: ^3.2
- willdurand/hateoas: ^2.10
Requires (Dev)
- phpunit/phpunit: 5.7.*
This package is not auto-updated.
Last update: 2025-03-24 17:37:42 UTC
README
A dockerized microservice who provides a REST interface with token's common functionality.
Installation
You need Composer to install dependencies:
$ composer install #use --no-dev option in a production environment
Now you must up Docker containers by docker-compose. This command will build a PHP container with XDEBUG configuration (recommended for develop purposes):
$ export ENV=dev; docker-compose -f docker-compose.yml -f ./config/docker/${ENV}/docker-compose.yml up --build -d
In a production environment is recommended the following command without XDEBUG config:
$ export ENV=prod; docker-compose up --build -d
Create database schema
Use doctrine binary to create DB schema:
$ php bin/doctrine orm:schema-tool:create
Debugging with XDEBUG:
You must to keep in mind that the Xdebug's default port (9000) has been replaced by 9089 to avoid collision with PHP CGI. Remote host IP is 10.254.254.254 (de facto standard host address alias) so you need to create the alias:
$ ifconfig lo0 alias 10.254.254.254
If you are using MacOS I recommend to read: Docker (Mac) De-facto Standard Host Address Alias
Basic use
Now you can use the REST API to consume the service:
Route | Method | Params | Description |
/ | POST | - | Create a new token. you can get it by 'Location' response header. This token expires in 14 days of inactivity. |
/{tokenId} | GET | - | Retrieve the token data in hal+json format and update expiration datetime. |
/{tokenId} | DELETE | - | Expires the token. |