An authentication service for Jenca Cloud.
The full documentation for this service can be seen at http://jenca-authentication.readthedocs.org/.
This comes with a Docker Compose file.
With Docker Compose available, perhaps in the Jenca Cloud Vagrant development environment, run:
docker-compose build
docker-compose up
to start the API service.
To run commands against the API, on OS X with Docker Machine for example:
$ docker-machine ip dev
$ 192.168.99.100
$ curl -X POST \
-H "Content-Type: application/json" \
-g '192.168.99.100:5000/signup' \
-d '{"email": "user@example.com","password":"secret"}'
$ curl -X POST \
-H "Content-Type: application/json" \
-g '192.168.99.100:5000/login' \
-d '{"email": "user@example.com","password":"secret"}' \
--cookie-jar ~/Desktop/my_cookie
$ curl -X GET \
-H "Content-Type: application/json" \
-g '192.168.99.100:5000/status' \
--cookie-jar ~/Desktop/my_cookie
$ curl -X POST \
-H "Content-Type: application/json" \
-g '192.168.99.100:5000/logout' \
--cookie ~/Desktop/my_cookie
This service is written using Python and Flask.
To start developing quickly, it is recommended that you create a virtualenv
and install the requirements and run the tests inside it:
(my_virtualenv)$ pip install -e .[dev]
Tests are run on Travis-CI.
To build the documentation locally, install the development requirements and then use the Makefile in the docs/
directory:
(my_virtualenv)$ make -C docs/ html
To view this built documentation, run:
$ open docs/build/html/index.html
- Some way of setting with Docker a way of describing whether the app should be in development or testing. This will likely be an environment variable. In testing only, share the code with the container as a volume with ".:code", which allows Flask to see code changes. In testing only, set debug mode to true in app.run(), which allows live changes as the code changes. In production make sure that all neccessary environment variables are set.