Skip to content

Commit 69ef260

Browse files
authored
Merge pull request #139 from guzman-raphael/id_token
Return id_token on login
2 parents d2253a4 + ea2928f commit 69ef260

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
44

5+
## [0.5.5] - 2022-10-26
6+
7+
### Fixed
8+
9+
- Return `id_token` on login since it can be useful in OIDC logout flow PR [#139](https://github.com/datajoint/pharus/pull/139)
10+
511
## [0.5.4] - 2022-10-20
612

713
### Fixed
@@ -188,6 +194,8 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
188194
- Support for DataJoint attribute types: `varchar`, `int`, `float`, `datetime`, `date`, `time`, `decimal`, `uuid`.
189195
- Check dependency utility to determine child table references.
190196

197+
[0.5.5]: https://github.com/datajoint/pharus/compare/0.5.4...0.5.5
198+
[0.5.4]: https://github.com/datajoint/pharus/compare/0.5.3...0.5.4
191199
[0.5.3]: https://github.com/datajoint/pharus/compare/0.5.2...0.5.3
192200
[0.5.2]: https://github.com/datajoint/pharus/compare/0.5.1...0.5.2
193201
[0.5.1]: https://github.com/datajoint/pharus/compare/0.5.0...0.5.1

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ To start the API server, use the command:
2929

3030
.. code-block:: bash
3131
32-
PHARUS_VERSION=0.5.3 docker-compose -f docker-compose-deploy.yaml up -d
32+
PHARUS_VERSION=0.5.5 docker-compose -f docker-compose-deploy.yaml up -d
3333
3434
To stop the API server, use the command:
3535

3636
.. code-block:: bash
3737
38-
PHARUS_VERSION=0.5.3 docker-compose -f docker-compose-deploy.yaml down
38+
PHARUS_VERSION=0.5.5 docker-compose -f docker-compose-deploy.yaml down
3939
4040
References
4141
----------

docker-compose-deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# PHARUS_VERSION=0.5.3 docker-compose -f docker-compose-deploy.yaml pull
2-
# PHARUS_VERSION=0.5.3 docker-compose -f docker-compose-deploy.yaml up -d
1+
# PHARUS_VERSION=0.5.5 docker-compose -f docker-compose-deploy.yaml pull
2+
# PHARUS_VERSION=0.5.5 docker-compose -f docker-compose-deploy.yaml up -d
33
#
44
# Intended for production deployment.
55
# Note: You must run both commands above for minimal outage

pharus/server.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def api_version() -> str:
117117
Content-Type: application/json
118118
119119
{
120-
"version": "0.5.3"
120+
"version": "0.5.5"
121121
}
122122
123123
:statuscode 200: No error.
@@ -223,29 +223,33 @@ def login() -> dict:
223223
headers=headers,
224224
auth=auth,
225225
)
226-
encoded_jwt = result.json()["access_token"]
226+
auth_info = dict(
227+
jwt=result.json()["access_token"], id=result.json()["id_token"]
228+
)
227229
connect_creds = {
228230
"databaseAddress": request.args["database_host"],
229231
"username": jwt.decode(
230-
encoded_jwt,
232+
auth_info["jwt"],
231233
crypto_serialization.load_der_public_key(
232234
b64decode(environ.get("PHARUS_OIDC_PUBLIC_KEY").encode())
233235
),
234236
algorithms="RS256",
235237
options=dict(verify_aud=False),
236238
)[environ.get("PHARUS_OIDC_SUBJECT_KEY")],
237-
"password": encoded_jwt,
239+
"password": auth_info["jwt"],
238240
}
239241
else: # Database login
240242
# Generate JWT key and send it back
241-
encoded_jwt = jwt.encode(
242-
request.json, environ["PHARUS_PRIVATE_KEY"], algorithm="RS256"
243+
auth_info = dict(
244+
jwt=jwt.encode(
245+
request.json, environ["PHARUS_PRIVATE_KEY"], algorithm="RS256"
246+
)
243247
)
244248
connect_creds = request.json
245249
if connect_creds.keys() < {"databaseAddress", "username", "password"}:
246250
return dict(error="Invalid Request, check headers and/or json body")
247251
_DJConnector._attempt_login(**connect_creds)
248-
return dict(jwt=encoded_jwt)
252+
return dict(**auth_info)
249253
except Exception as e:
250254
return str(e), 500
251255

pharus/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Package metadata."""
2-
__version__ = "0.5.4"
2+
__version__ = "0.5.5"

0 commit comments

Comments
 (0)