jvcalderon/token-service

A dockerized microservice who provides a REST interface with token's common functionality

1.0 2017-01-22 21:56 UTC

This package is not auto-updated.

Last update: 2024-04-22 13:01:12 UTC


README

SensioLabsInsight

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.