4dn-dcic / utils

various util modules shared amongst several projects in our organization
MIT License
4 stars 1 forks source link

RAS Authentication Updates #291

Closed utku-ozturk closed 9 months ago

utku-ozturk commented 10 months ago

This PR extends the value that is stored as Redis (key, value) pair:

Old format: jwtToken New format: jwtToken:email (since jwtToken is base64 encoded, :(colon as the separator makes sense.

ToDo

From Researcher Auth Service (RAS) Project Partner Developer Guide: To comply with GA4GH, only the following signing algorithm is supported: RS256.

While the data portals' Auth0 implementation works with HS256, RAS only uses RS256. Current JWT encoding/decoding functions throw the exception below since RS256 requires public/private keys to sign tokens. We bypassed the decoding's verify_signature by setting False for now, which should be True in production.

ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [_OpenSSLErrorWithText(code=75497580, lib=9, reason=108, reason_text=b'error:0480006C:PEM routines::no start line')])

Related PRs:

  1. https://github.com/4dn-dcic/snovault/pull/273
  2. https://github.com/4dn-dcic/fourfront/pull/1864
  3. https://github.com/4dn-dcic/shared-portal-components/pull/238
coveralls commented 10 months ago

Pull Request Test Coverage Report for Build 6908964577


Changes Missing Coverage Covered Lines Changed/Added Lines %
dcicutils/redis_tools.py 12 13 92.31%
<!-- Total: 13 14 92.86% -->
Totals Coverage Status
Change from base Build 6736812910: 0.004%
Covered Lines: 9346
Relevant Lines: 11891

💛 - Coveralls