Commit Graph

183 Commits

Author SHA1 Message Date
Emad Rad
c27d55a253 chore: typos fixed 2024-05-25 18:05:28 +03:30
MueezKhan246
86c49f7dce test: removed redundant test case 2024-04-17 09:50:31 +00:00
MueezKhan246
726392b1fa feat: removed ENABLE_USER_ID_SCOPE flag from validator 2024-04-17 03:53:07 +00:00
Ben Lu
6112f85c0b fixup! feat: add JWT KID 2024-04-03 13:22:51 -05:00
Ben Lu
ef59da6775 feat: add JWT KID
Added JWT KID when encoding and signing JWT with asymmetrical key
2024-04-03 12:13:53 -05:00
Ehmad Saeed
de6047184f fix: add toggle_target_removal_date annotation 2024-03-16 02:47:48 +05:00
Ehmad Saeed
c48fbb9b48 fix: toggle_use_cases and public ticket for its removal 2024-03-16 02:31:56 +05:00
Ehmad Saeed
fe1fcc2b7d fix: toggle annotations for ENABLE_USER_ID_SCOPE 2024-03-16 02:07:12 +05:00
Ehmad Saeed
070582aed6 docs: add ENABLE_USER_ID_SCOPE feature flag documentation 2024-03-16 01:39:28 +05:00
Ehmad Saeed
f07f8f220f fix: quality check for trailing whitespace 2024-03-16 01:05:43 +05:00
Ehmad Saeed
5be6ed6d66 fix: update ADRs and add test cases with ENABLE_USER_ID_SCOPE flag off 2024-03-16 00:54:08 +05:00
Ehmad Saeed
2694f82654 fix: copy default scopes to prevent mutating the original list 2024-03-15 03:29:15 +05:00
Ehmad Saeed
14199e5b99 chore: use feature-flag, remove mocks for tests and add ADR in decisions 2024-03-15 02:16:43 +05:00
Ehmad Saeed
51de2c6197 feat: add user_id in the default scopes 2024-03-12 22:58:11 +05:00
Ehmad Saeed
4a8cc1e77e feat: add application scopes into default 2024-02-27 16:36:08 +05:00
Robert Raposa
431b9dec15 docs: update ADR for USE-JWT-COOKIE replacement (#33680)
Since a part of this ADR details the USE-JWT-COOKIE
header which has been removed, this ADR was updated
with links to the newer ADR.

The status will remain accepted.

A change history was also added for this change,
as well as documenting some past changes.
2023-12-12 12:06:26 -05:00
Moeez Zahid
ba1f382471 feat: Add scope user_id to JWT payload (#33455) 2023-10-30 07:56:58 +05:00
Muhammad Umar Khan
92731be0dc Replace pyjwkest with pyjwt (#32270)
* chore: replace pyjwkest with pyjwt
2023-10-18 15:15:17 +05:00
Feanil Patel
64e91d4080 test: Update to an even longer password. 2023-10-12 10:31:13 -04:00
Feanil Patel
1e2ea85372 test: Update more tests that had short passwords. 2023-10-10 16:36:26 -04:00
Awais Qureshi
64abfd126c fix: upgrade oauthlib and django-oauth-toolkit to new versions. (#32631)
* chore: bump django-oauth-toolkit and oauthlib
---------

Co-authored-by: Muhammad Umar Khan <m.umarkhan999@gmail.com>
2023-08-18 14:21:25 +05:00
Rebecca Graber
66c22d2e9f feat: add grace period when deleting accesstokens (#32040) 2023-04-18 13:17:53 -04:00
Robert Raposa
6cae1fa429 feat: allow for forcing asymmetric jwts (#32045)
Add a temporary feature toggle to force the LMS to
only produce asymmetric JWTs. This is a part of
DEPR of Symmetric JWTs:
https://github.com/openedx/public-engineering/issues/83
2023-04-10 14:46:44 -04:00
Rebecca Graber
d8769e8347 feat: switch order of removal of revoked and expired tokens in dot cleanup (#32010) 2023-03-30 12:34:00 -04:00
Rebecca Graber
cc75c37f21 feat: add additional logging to edx-clear-expired-tokens (#31986) 2023-03-24 11:57:44 -04:00
Rebecca Graber
1ae9ed0144 feat: remove revoked tokens before expired ones in edx_clear_expired_tokens (#31973) 2023-03-23 08:03:03 -04:00
Matt Hughes
8fcca00489 feat: add options for each oauth table being cleared
currently our attempts to clear these tables is cronically failing due
to an unnecessarily huge join for the very first query

I have a suspicion that the performance of this join would improve if
we deleted records from any tables beyond just the first listed here
2023-03-15 14:32:28 -04:00
Matt Hughes
1acd382131 perf: while clearing expired tokens perform only 2 queries per it.
those two queries should be the SELECT of the records and the DELETE
2023-03-02 15:19:55 -05:00
Ned Batchelder
12765a7a59 refactor(test): use @skip_unless_lms uniformly 2023-02-01 13:52:26 -08:00
Mohammad Ahtasham ul Hassan
b01cf355a7 Unpin django-ratelimit (#31416)
* fix: fix ratelimit upgrade changes

Co-authored-by: Awais Qureshi <awais.qureshi@arbisoft.com>
2023-01-19 16:39:23 +05:00
Moeez Zahid
4271e24eb9 feat: Waffle switch to disable JWT for mobile (#31096)
* feat: Waffle switch to disable JWT for mobile
2022-10-17 16:57:11 +05:00
Robert Raposa
3f147335ca docs: enhance mobile JWT ADR (#30906)
As part of the implementation of this ADR, we determined that we needed
to make some of the endpoints that return JWTs able to produce
asymmetric JWTs as needed, since asymmetric JWTs are a requirement
in certain cases. This ADR update notes this additional consequence.
2022-09-19 12:23:59 -04:00
Sarina Canelake
cf5fa64bd7 fix: update repo paths that stayed in the edx org
Co-authored-by: Kyle McCormick <kdmc@pm.me>
2022-09-15 14:52:28 -04:00
Sarina Canelake
4a2f231302 fix: fix github url strings (org edx -> openedx) 2022-09-15 14:52:28 -04:00
jawad khan
dc256139f3 feat: Exchange jwt token with session cookies (#29963)
Exchange jwt token with session cookies so that it can work on mobile.
Mobile platform is migrating to jwt and for accessing  xblocks we need session cookies in exchnage of jwt token.
For additional details, see
https://github.com/openedx/edx-platform/blob/master/openedx/core/djangoapps/oauth_dispatch/docs/decisions/0013-mobile-migration-to-jwt.rst

LEARNER-8518
2022-08-31 13:29:52 +05:00
Robert Raposa
49dcb68a5e docs: fix restricted app adr status (#30677)
The decision to provide Restricted Applications expired
JWTs was superseded by another ADR. This commit simply
adds clarity around that change.

Co-authored-by: Phillip Shiu <pshiu@users.noreply.github.com>
2022-07-20 17:02:33 -04:00
jawad khan
2dc7990653 feat: Added token grant_type in JWT payload (#30519)
To exchange jwt with session cookies we need to determine JWT grant type in
AccessTokenExchangeView. JWT only having password grant type will be allowed to exchange session.
Added ADR for mobile migration to JWT authentication.

LEARNER-8886
2022-06-30 16:49:11 +05:00
jawad khan
fe6b666f5b feat: exchange third party auth token with jwt token (#30283)
Exchange third party auth token wiith jwt token
since mobile platform is moving to jwt token we
need jwt token instead of access token now.

LEARNER-8517

Co-authored-by: Robert Raposa <rraposa@edx.org>
2022-06-21 14:58:39 -04:00
Robert Raposa
432cde31a5 refactor: add create_jwt_token_dict (#30485)
Moves the functionality from views._get_jwt_dict_from_access_token_dict
to a new method jwt.create_jwt_token_dict, which create a JWT version
of the passed token_dict. Also updates create_jwt_from_token to wrap
this call and return the "access_token" from the dict.

This will hopefully make it less likely that the token
dict attributes could get out of sync with the claims
inside the JWT.
2022-05-25 17:02:19 -04:00
Robert Raposa
d321ed5ccd refactor: extract shareable jwt methods (#30451)
Extract some jwt related methods to enable reuse across views.
This is in preparation for a change to AccessTokenExchangeView.

Co-authored-by: jawad-khan <jawadkhan444@gmail.com>
2022-05-25 08:53:36 -04:00
Robert Raposa
98d990d7af fix: remove reference to ApplicationOrganization (#30446)
References to ApplicationOrganization were removed two
years ago in the following PR:
https://github.com/openedx/edx-platform/pull/23199

However, it looks like one reference was missed.

ARCHBOM-992
2022-05-20 13:42:12 -04:00
Robert Raposa
3fc852f53c feat!: change JWT access token expires (#30432)
Introduces JWT_ACCESS_TOKEN_EXPIRE_SECONDS setting. This is the number
of seconds a JWT access token remains valid. We use this custom
setting for JWT formatted access tokens, rather than the
django-oauth-toolkit setting ACCESS_TOKEN_EXPIRE_SECONDS, because the
JWT is non-revocable and we want it to be shorter lived than the
legacy Bearer (opaque) access tokens, and thus to have a smaller
default.

BREAKING CHANGE: The thing that is breaking is that JWT access tokens
will now have a 1 hour default, instead of a 10 hours default. If
third-party scripts are appropriately checking/refreshing the access
token, this should be ok. However, you can always override with a
longer duration temporarily. From a security perspective, we don't
recommend a longer duration, and you may consider a shorter duration.

ARCHBOM-2099
2022-05-19 09:46:17 -04:00
Awais Qureshi
bc45f1ee48 fix: Removed usage of djangoratelimitbackend. (#30116)
* fix: Removed usage of djangoratelimitbackend.
2022-03-25 15:27:39 +05:00
Usama Sadiq
1cebd3ed7b Remove django-ratelimit-backend (#30054)
* fix: remove the usage of django-ratelimit-backend

Co-authored-by: Awais Qureshi <awais.qureshi@arbisoft.com>
2022-03-24 17:21:56 +05:00
Mohammad Ahtasham ul Hassan
a838ab4b01 fix: fixed django4 warnings (#29643) 2022-03-04 15:03:02 +05:00
Awais Qureshi
5b8cc00964 test: Fixed test failures due to randomization. (#29822)
* test: Fixed test failures due to randomization.
2022-01-26 19:48:55 +05:00
Robert Raposa
b82144bb83 feat!: remove misleading JWT monitoring (#29142)
BREAKING CHANGE: Removed unused and misleading custom attributes
  used for monitoring:
* `jwt_expires_in`: Removed because it is constant for all requests
  and just repeating the setting value. It was also misleading.
* `jwt_is_asymmetric`: Removed because multiple JWTs might be created,
  and only the last would be reported, which is misleading. This was
  meant to help with a future project to get everyone on to asymmetric
  JWTs, but can be added when needed, and probably should ONLY monitor
  deprecated (symmetric) usage that needs to be fixed. That can be left
  for another day.
2021-10-28 10:06:13 -04:00
M. Zulqarnain
834dabb399 feat: New codemods on OpenedX 2 (#28777) 2021-10-28 16:45:53 +05:00
M. Zulqarnain
9833134fae Post Django 3.2 Cleanup (#29069)
* chore: Post Django 3.2 Cleanup
2021-10-22 13:55:16 +05:00
Soban Javed
56d12bf230 feat!: upgrade pyjwt to version 2.1.0 2021-09-17 16:08:15 +05:00