From 8aca24502cc36ffe3d3caa8c73abd00900c6b142 Mon Sep 17 00:00:00 2001 From: Jonathan Liuti Date: Thu, 17 Jan 2019 19:16:53 +0100 Subject: [PATCH 1/3] Fix #148 Make CHANGELOG.md the source of truth --- CHANGELOG.md | 168 ++++++++++++++++------------------------------ docs/changelog.md | 1 + docs/changes.md | 111 ------------------------------ mkdocs.yml | 2 +- 4 files changed, 60 insertions(+), 222 deletions(-) create mode 120000 docs/changelog.md delete mode 100644 docs/changes.md diff --git a/CHANGELOG.md b/CHANGELOG.md index ee1693e4..76b953a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,7 @@ -4.0.0 -===== +## 4.0.0 **BREAKING** This is a major release version because it breaks the existing API. - Changes have been made to the `create()` method on the `AuthToken` model. It now returns the model instance and the raw `token` instead of just the `token` to allow the `expiry` field to be included in the @@ -19,156 +17,106 @@ to fit these new changes. - `AuthToken` model field has been changed from `expires` to `expiry` - Successful login now always returns a `expiry` field for when the token expires -3.6.0 -===== +## 3.6.0 - The user serializer for each `LoginView`is now dynamic - -3.5.0 -===== +## 3.5.0 - The context, token TTL and tokens per user settings in `LoginView` are now dynamic - -3.4.0 -===== - +## 3.4.0 Our release cycle was broken since 3.1.5, hence you can not find the previous releases on pypi. We now fixed the problem. - Adds optional token limit -- #129, #128 fixed +- \#129, \#128 fixed - Changelog and Readme converted to markdown - Auth header prefix is now configurable - We ensure not to have flake8 errors in our code during our build - MIN_REFRESH_INTERVAL is now a configurable setting +## 3.3.1 +- Ensure compatibility with Django 2.1 up to Python 3.7 -3.3.1 -===== - -- Ensure compatibility with Django 2.1 up to Python 3.7 - -3.3.0 -===== +## 3.3.0 - **Breaking changes**: Successful authentication **ONLY** returns `Token` object by default now.`USER_SERIALIZER` must be overridden to return more data. - + - Introduce new setting `MIN_REFRESH_INTERVAL` to configure the time interval (in seconds) to wait before a token is automatically refreshed. -3.2.1 -===== - -- Fix !111: Avoid knox failing if settings are not overwritten - -3.2.0 -===== - -- Introduce new setting AUTO_REFRESH for controlling if token expiry - time should be extended automatically - -3.1.5 -===== - -- Make AuthTokenAdmin more compatible with big user tables -- Extend docs regarding usage of Token Authentication as single - authentication method. - -3.1.4 -===== +## 3.2.1 +- Fix !111: Avoid knox failing if settings are not overwritten -- Fix compability with django-rest-swagger (bad inheritance) +## 3.2.0 +- Introduce new setting AUTO_REFRESH for controlling if token expiry time should be extended automatically -3.1.3 -===== +## 3.1.5 +- Make AuthTokenAdmin more compatible with big user tables +- Extend docs regarding usage of Token Authentication as single authentication method. -- Avoid 500 error response for invalid-length token requests +## 3.1.4 +- Fix compability with django-rest-swagger (bad inheritance) -3.1.2 -===== +## 3.1.3 +- Avoid 500 error response for invalid-length token requests -- restore compability with Python <2.7.7 +## 3.1.2 +- restore compability with Python <2.7.7 -3.1.1 -===== +## 3.1.1 +- use hmac.compare_digest instead of == for comparing hashes for more security -- use hmac.compare_digest instead of == for comparing hashes for more - security +## 3.1.0 +- drop Django 1.8 support as djangorestframework did so too in v.3.7.0 +- build rest-knox on Django 1.11 and 2.0 -3.1.0 -===== +## 3.0.3 +- drop using OpenSSL in favor of urandom -- drop Django 1.8 support as djangorestframework did so too in v.3.7.0 -- build rest-knox on Django 1.11 and 2.0 +## 3.0.2 +- Add context to UserSerializer +- improve docs -3.0.3 -===== +## 3.0.1 +- improved docs and readme +- login response better supporting hyperlinked fields -- drop using OpenSSL in favor of urandom +## 3.0.0 +**Please be aware: updating to this version requires applying a database migration. All clients will need to reauthenticate.** -3.0.2 -===== +- Big performance fix: Introduction of token_key field to avoid having to compare a login request's token against each and every token in the database (issue #21) +- increased test coverage -- Add context to UserSerializer -- improve docs +## 2.2.2 +- Bugfix: invalid token length does no longer trigger a server error +- Extending documentation -3.0.1 -===== +## 2.2.1 +**Please be aware: updating to his version requires applying a database migration** -- improved docs and readme -- login response better supporting hyperlinked fields - -3.0.3 -===== - -- drop using OpenSSL in favor of urandom - -3.0.2 -===== - -- Add context to UserSerializer -- improve docs - -3.0.1 -===== - -- improved docs and readme -- login response better supporting hyperlinked fields - -3.0.0 -===== - -**Please be aware: updating to this version requires applying a database -migration. All clients will need to reauthenticate.** - -- Big performance fix: Introduction of token_key field to avoid - having to compare a login request's token against each and every - token in the database (issue #21) -- increased test coverage - -2.2.2 -===== +- Introducing token_key to avoid loop over all tokens on login-requests +- Signals are sent on login/logout +- Test for invalid token length +- Cleanup in code and documentation - Bugfix: invalid token length does no longer trigger a server error - Extending documentation -2.2.1 -===== +## 2.2.0 -**Please be aware: updating to this version requires applying a database -migration** +- Change to support python 2.7 -- Introducing token_key to avoid loop over all tokens on - login-requests -- Signals are sent on login/logout -- Test for invalid token length -- Cleanup in code and documentation +## 2.0.0 +- Hashing of tokens on the server introduced. +- Updating to this version will clean the AuthToken table. In real terms, this + means all users will be forced to log in again. -2.2.0 -===== +## 1.1.0 +- `LoginView` changed to respect `DEFAULT_AUTHENTICATION_CLASSES` -- Change to support python 2.7 +## 1.0.0 +- Initial release diff --git a/docs/changelog.md b/docs/changelog.md new file mode 120000 index 00000000..04c99a55 --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file diff --git a/docs/changes.md b/docs/changes.md deleted file mode 100644 index aaf5f2af..00000000 --- a/docs/changes.md +++ /dev/null @@ -1,111 +0,0 @@ -# Changelog - -## 4.0.0 - -**BREAKING** This is a major release version because it -breaks the existing API. -Changes have been made to the `create()` method on the `AuthToken` model. -It now returns the model instance and the raw `token` instead -of just the `token` to allow the `expiry` field to be included in the -success response. - -Model field of `AuthToken` has been renamed from `expires` to `expiry` -to remain consistent across the code base. This patch requires you -to run a migration. - -Depending on your usage you might have to adjust your code -to fit these new changes. - -- `AuthToken` model field has been changed from `expires` to `expiry` -- Successful login now always returns a `expiry` field for when the token expires - -## 3.6.0 - -- The user serializer for each `LoginView`is now dynamic - -## 3.5.0 - -- The context, token TTL and tokens per user settings in `LoginView` are now dynamic - -## 3.4.0 -Our release cycle was broken since 3.1.5, hence you can not find the previous releases on pypi. We now fixed the problem. - -- Adds optional token limit -- #129, #128 fixed -- Changelog and Readme converted to markdown -- Auth header prefix is now configurable -- We ensure not to have flake8 errors in our code during our build -- MIN_REFRESH_INTERVAL is now a configurable setting - -## 3.3.1 -- Ensure compatibility with Django 2.1 up to Python 3.7 - -## 3.3.0 -- **Breaking changes**: Successful authentication **ONLY** returns `Token` object by default now. -`USER_SERIALIZER` must be overridden to return more data. - -## 3.2.1 -- Fix !111: Avoid knox failing if settings are not overwritten - -## 3.2.0 -- Introduce new setting AUTO_REFRESH for controlling if token expiry time should be extended automatically - -## 3.1.5 -- Make AuthTokenAdmin more compatible with big user tables -- Extend docs regarding usage of Token Authentication as single authentication method. - -## 3.1.4 -- Fix compability with django-rest-swagger (bad inheritance) - -## 3.1.3 -- Avoid 500 error response for invalid-length token requests - -## 3.1.2 -- restore compability with Python <2.7.7 - -## 3.1.1 -- use hmac.compare_digest instead of == for comparing hashes for more security - -## 3.1.0 -- drop Django 1.8 support as djangorestframework did so too in v.3.7.0 -- build rest-knox on Django 1.11 and 2.0 - -## 3.0.3 -- drop using OpenSSL in favor of urandom - -## 3.0.2 -- Add context to UserSerializer -- improve docs - -## 3.0.1 -- improved docs and readme -- login response better supporting hyperlinked fields - -## 3.0.0 -**Please be aware: updating to this version requires applying a database migration. All clients will need to reauthenticate.** - -- Big performance fix: Introduction of token_key field to avoid having to compare a login request's token against each and every token in the database (issue #21) -- increased test coverage - -## 2.2.2 -- Bugfix: invalid token length does no longer trigger a server error -- Extending documentation - -## 2.2.1 -**Please be aware: updating to his version requires applying a database migration** - -- Introducing token_key to avoid loop over all tokens on login-requests -- Signals are sent on login/logout -- Test for invalid token length -- Cleanup in code and documentation - -## 2.0.0 -- Hashing of tokens on the server introduced. -- Updating to this version will clean the AuthToken table. In real terms, this - means all users will be forced to log in again. - -## 1.1.0 -- `LoginView` changed to respect `DEFAULT_AUTHENTICATION_CLASSES` - -## 1.0.0 -- Initial release diff --git a/mkdocs.yml b/mkdocs.yml index 435e628e..00a9e378 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -9,4 +9,4 @@ pages: - URLs: 'urls.md' - Authentication: 'auth.md' - Settings: 'settings.md' - - Changes: 'changes.md' + - Changelog: 'changelog.md' From 1a8f19b25e728178170af9aed68f27d1660c5026 Mon Sep 17 00:00:00 2001 From: Jonathan Liuti Date: Thu, 17 Jan 2019 19:29:45 +0100 Subject: [PATCH 2/3] Add mkdocs.sh utility --- README.md | 27 +++++++++++++++++++++++++++ mkdocs.sh | 12 ++++++++++++ mkdocs.yml | 2 ++ 3 files changed, 41 insertions(+) create mode 100755 mkdocs.sh diff --git a/README.md b/README.md index aaa7facd..3f957c42 100644 --- a/README.md +++ b/README.md @@ -50,3 +50,30 @@ Django versions. You could also simply run regular ``tox`` in the root folder as well, but that would make testing the matrix of Python / Django versions a bit more tricky. + +# Work on the documentation + +Our documentation is generated by [Mkdocs](https://www.mkdocs.org). + +You can refer to their documentation on how to install it or use `mkdocs.sh` in +this folder. + +It will run mkdocs in a [docker](https://www.docker.com/) container. + +Running the script without any params the `serve` command. +The server is exposed on localhost on port 8000. +If you want to configure port serve is exposed on you can use the +following env var: + +``` +MKDOCS_DEV_PORT="8080" +``` + +You can also pass any `mkdocs` command like this: + +``` +./mkdocs build +./mkdocs --help +``` + +Check the [Mkdocs documentation](https://www.mkdocs.org/) for more. diff --git a/mkdocs.sh b/mkdocs.sh new file mode 100755 index 00000000..ac64849e --- /dev/null +++ b/mkdocs.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -e +MOUNT_FOLDER=/app +MKDOCS_DEV_ADDR=${MKDOCS_DEV_ADDR-"0.0.0.0"} +MKDOCS_DEV_PORT=${MKDOCS_DEV_PORT-"8000"} + +docker run --rm -it \ + -v $(pwd):$MOUNT_FOLDER \ + -w $MOUNT_FOLDER \ + -p $MKDOCS_DEV_PORT:$MKDOCS_DEV_PORT \ + -e MKDOCS_DEV_ADDR="$MKDOCS_DEV_ADDR:$MKDOCS_DEV_PORT" \ + squidfunk/mkdocs-material:3.2.0 $* diff --git a/mkdocs.yml b/mkdocs.yml index 00a9e378..b40c6200 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -10,3 +10,5 @@ pages: - Authentication: 'auth.md' - Settings: 'settings.md' - Changelog: 'changelog.md' + +dev_addr: !!python/object/apply:os.getenv ["MKDOCS_DEV_ADDR"] From 80190ef895d60c8c20a254414fc0842b021f1cea Mon Sep 17 00:00:00 2001 From: Jonathan Liuti Date: Thu, 17 Jan 2019 19:30:00 +0100 Subject: [PATCH 3/3] Fix a mkdoc deprecation warning --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index b40c6200..571ed993 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,7 +1,7 @@ site_name: Django-Rest-Knox repo_url: https://github.com/James1345/django-rest-knox theme: readthedocs -pages: +nav: - Home: 'index.md' - Installation: 'installation.md' - API Guide: