diff --git a/CHANGELOG.md b/CHANGELOG.md index b71e38c..72011dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention. +## [0.5.5] - 2022-10-26 + +### Fixed + +- Return `id_token` on login since it can be useful in OIDC logout flow PR [#139](https://github.com/datajoint/pharus/pull/139) + ## [0.5.4] - 2022-10-20 ### Fixed @@ -188,6 +194,8 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and - Support for DataJoint attribute types: `varchar`, `int`, `float`, `datetime`, `date`, `time`, `decimal`, `uuid`. - Check dependency utility to determine child table references. +[0.5.5]: https://github.com/datajoint/pharus/compare/0.5.4...0.5.5 +[0.5.4]: https://github.com/datajoint/pharus/compare/0.5.3...0.5.4 [0.5.3]: https://github.com/datajoint/pharus/compare/0.5.2...0.5.3 [0.5.2]: https://github.com/datajoint/pharus/compare/0.5.1...0.5.2 [0.5.1]: https://github.com/datajoint/pharus/compare/0.5.0...0.5.1 diff --git a/README.rst b/README.rst index 2ecaecf..16ed346 100644 --- a/README.rst +++ b/README.rst @@ -29,13 +29,13 @@ To start the API server, use the command: .. code-block:: bash - PHARUS_VERSION=0.5.3 docker-compose -f docker-compose-deploy.yaml up -d + PHARUS_VERSION=0.5.5 docker-compose -f docker-compose-deploy.yaml up -d To stop the API server, use the command: .. code-block:: bash - PHARUS_VERSION=0.5.3 docker-compose -f docker-compose-deploy.yaml down + PHARUS_VERSION=0.5.5 docker-compose -f docker-compose-deploy.yaml down References ---------- diff --git a/docker-compose-deploy.yaml b/docker-compose-deploy.yaml index 84eb466..3bc3192 100644 --- a/docker-compose-deploy.yaml +++ b/docker-compose-deploy.yaml @@ -1,5 +1,5 @@ -# PHARUS_VERSION=0.5.3 docker-compose -f docker-compose-deploy.yaml pull -# PHARUS_VERSION=0.5.3 docker-compose -f docker-compose-deploy.yaml up -d +# PHARUS_VERSION=0.5.5 docker-compose -f docker-compose-deploy.yaml pull +# PHARUS_VERSION=0.5.5 docker-compose -f docker-compose-deploy.yaml up -d # # Intended for production deployment. # Note: You must run both commands above for minimal outage diff --git a/pharus/server.py b/pharus/server.py index 53d9cd5..8f2d45d 100644 --- a/pharus/server.py +++ b/pharus/server.py @@ -117,7 +117,7 @@ def api_version() -> str: Content-Type: application/json { - "version": "0.5.3" + "version": "0.5.5" } :statuscode 200: No error. @@ -223,29 +223,33 @@ def login() -> dict: headers=headers, auth=auth, ) - encoded_jwt = result.json()["access_token"] + auth_info = dict( + jwt=result.json()["access_token"], id=result.json()["id_token"] + ) connect_creds = { "databaseAddress": request.args["database_host"], "username": jwt.decode( - encoded_jwt, + auth_info["jwt"], crypto_serialization.load_der_public_key( b64decode(environ.get("PHARUS_OIDC_PUBLIC_KEY").encode()) ), algorithms="RS256", options=dict(verify_aud=False), )[environ.get("PHARUS_OIDC_SUBJECT_KEY")], - "password": encoded_jwt, + "password": auth_info["jwt"], } else: # Database login # Generate JWT key and send it back - encoded_jwt = jwt.encode( - request.json, environ["PHARUS_PRIVATE_KEY"], algorithm="RS256" + auth_info = dict( + jwt=jwt.encode( + request.json, environ["PHARUS_PRIVATE_KEY"], algorithm="RS256" + ) ) connect_creds = request.json if connect_creds.keys() < {"databaseAddress", "username", "password"}: return dict(error="Invalid Request, check headers and/or json body") _DJConnector._attempt_login(**connect_creds) - return dict(jwt=encoded_jwt) + return dict(**auth_info) except Exception as e: return str(e), 500 diff --git a/pharus/version.py b/pharus/version.py index 6b53d6a..9d201af 100644 --- a/pharus/version.py +++ b/pharus/version.py @@ -1,2 +1,2 @@ """Package metadata.""" -__version__ = "0.5.4" +__version__ = "0.5.5"