Commit Graph

48 Commits

Author SHA1 Message Date
Kshitij Sobti
9e787a09bc chore: remove dependency on rest_condition (#28663)
rest-condition has not been updated for a while, and with DRF 3.9 it is no longer needed since the ability to combine Permission classes using boolean operators is now provided by DRF directly.
2021-10-04 15:38:17 -04:00
Usama Sadiq
484cd536e2 fix: Fixed new pylint warnings (#28724) 2021-09-23 17:54:04 +05:00
Awais Qureshi
a2f5a46a68 refactor: Pyupgrade in common/djangoapps/third-party-auth/tests. 2021-03-19 12:40:15 +05:00
Jawayria
98edaf887a Merge pull request #26500 from edx/jawayria/bom-2351-3
BOM-2351: Removed unused imports from common/djangoapps/third_party_auth
2021-02-23 16:08:57 +05:00
usamasadiq
96f0915b0f Fixed new pylint warnings.
use generator in any/all()
disable not-callable warnings
disable no-member warnings
Suppressed smaller pylint warnings
Pin edx-proctoring==3.5.0
2021-02-22 16:36:53 +05:00
Jawayria
310da0d6a7 BOM-2351: Removed unused imports from common/djangoapps/third_party_auth 2021-02-22 14:05:40 +05:00
Aarif
e6a0d35009 replaced unittest assertions pytest assertions (#26240) 2021-02-12 12:31:37 +05:00
Jawayria
7be5a683aa Applied pylint-amnesty to third_party_auth 2021-02-03 13:37:05 +05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Tim McCormack
f29e418264 Revert "Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)" (#25055)
This reverts commit 986a448d9e.
2020-09-28 13:53:57 +00:00
Ahtisham Shahid
986a448d9e Revert "ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)" (#25025)
This reverts commit ba9ee4e151.

Fixed Style lint issue
2020-09-21 13:48:00 +05:00
Tim McCormack
ba9ee4e151 ARCHBOM-1494: Refer to custom attributes, not metrics, especially with edx-django-utils (#25010)
This uses the new names introduced in edx-django-utils
3.8.0 (edx/edx-django-utils#59), which we're already using, as
well as updating a few other locations where we incorrectly refer
to New Relic custom metrics instead of custom attributes.

Includes a couple of unrelated lint fixes in a file I modified.
2020-09-18 13:33:50 +00:00
Ned Batchelder
cca33732ba Correct markup mistakes in api docs 2020-05-12 13:36:14 -04:00
Zia Fazal
9a9683fc21 Merge pull request #23659 from edx/ziafazal/ENT-2759
Added global staff permission to third party auth users API
2020-04-09 09:56:16 +05:00
Aarif
6ee2089077 fixed warnings for wrong-import-order 2020-04-08 23:43:06 +05:00
zia.fazal@arbisoft.com
b37a986656 Added global staff permission to third party auth users API 2020-04-08 14:53:32 +05:00
Matt Hughes
acce8baca4 Add management command for retroactively adding sso IdV for IdP
We sometimes update preexisting SAML SSO providers to configure them
to automatically create SSO identity verification (IdV) records when a
learner links an account via that provider. Turning that configuration
from off to on does make it such that when learners log back in via
their linked account, a new IdV record will be created for them. But
it's possible we'd want this process to happen more automatically and
seamlessly, for which this management command will be helpful.

Note that this does not help with removing SSO verification records
for a provider for which this configuration has been turned off.

JIRA:EDUCATOR-4947
2020-03-17 16:04:24 -04:00
Manjinder Singh
9725303c4a Removing patch from test (#23250)
the patched toggle was removed from edx-drf-extensions recently
2020-03-02 11:02:25 -05:00
Feanil Patel
5ec487452d Merge pull request #23188 from edx/robrap/BOM-1324-add-constraint
BOM-1324: remove oauth2.enforce_jwt_scopes toggle
2020-03-02 09:55:35 -05:00
Manjinder Singh
953b0e728b Remove ThirdPartyAuthProviderApiPermission (#23195)
* Remove ThirdPartyAuthProviderApiPermission

Also removed ProviderApiPermissions and ApiPermissionsAdminForm and removal of DOP for third_party_auth

* Removing model

* Replaced long_token with default_token_generator

* Adding skip to test_migrations_are_in_sync
2020-02-27 15:42:09 -05:00
Robert Raposa
a4716c75cb fix tests 2020-02-27 08:58:45 -05:00
Robert Raposa
84686e81c3 BOM-1324: remove oauth2.enforce_jwt_scopes toggle
The oauth2.enforce_jwt_scopes waffle switch was added temporarily for
the rollout of jwt scopes. This removes the toggle and replacing code
with the equivalent of `oauth2.enforce_jwt_scopes` as True.
2020-02-27 08:58:45 -05:00
Robert Raposa
372d2e927c BOM-1264: add third-party-auth scope and usage (#23135)
* WIP: add third-party-auth scope and usage

BOM-1264


* Fix tests now that we do permissions in a more standard way.

Rather than manually setting the permission class we previously
explicitly raised a PermissionDenied exception.  The way DRF
permissoning logic works, if we use the WWW-Authenticate header in the
highest priority auth class, it will return a 401 instead of a 403.


* Added test to make sure having permissions gives access to user mapping api

* Test new filters logic.

Ensure that the filters we add to the application access model make it
into the JWT correctly.

* quality fix

* quality fix

* disable pylint warning

* quality fix

* fix indent prob

Co-authored-by: Feanil Patel <feanil@edx.org>
Co-authored-by: Manjinder Singh <49171515+jinder1s@users.noreply.github.com>
2020-02-21 11:25:28 -05:00
Manjinder Singh
d7bd80a100 Renamed OAuth2Authentication to BearerAuthentication (#23128)
* Renamed OAuth2Authentication to BearerAuthentication
* Added back OAuth2Authentication name
-there are libraries such as edx-enterprise that still import OAuth2Authentication.  The OAuth2Authentication class should be fully removed when everything is importing BearerAuthentication correctly
2020-02-18 13:29:29 -05:00
Manjinder Singh
cce8cdd661 Replacing OAuth2Auth (#23067)
- Removing deprecated auth classes
- Replacing OAuth2AuthenticationAllowInactiveUserDeprecated with OAuth2AuthenticationAllowInactiveUser
- the old class was a child class of a deprecated class that we are removing and replacing.
2020-02-11 10:38:13 -05:00
Manjinder Singh
cea795b02e Added new auth class (#23018)
* Added new auth class

- Created new class called OAuth2AuthenticationAllowInactiveUser, which replaces old class with same name
- Renames previous  OAuth2AuthenticationAllowInactiveUser to  OAuth2AuthenticationAllowInactiveUserDeprecated
- Replaced all imports of  OAuth2AuthenticationAllowInactiveUser to call deprecated class instead
- testing new class in discussion(added flag based on django setting)
2020-02-06 10:37:27 -05:00
Robert Raposa
28206e4c45 add jwt auth to third-party auth endpoint
BOM-897
2020-02-04 10:02:04 -05:00
Manjinder Singh
eb694528e7 Adding metrics to oauth2authentication class (#22970)
Currently, we are working on removing the rest_framework_auth library from edx-platform. For this push, we need to remove the oauth2Authentication class. This PR creates a new class oauth2AuthenticationDeprecated that adds additional new relic metrics. The metrics would allow us to see how often this class is used and its success rate. The hope is that this information will help us with transitioning to a different authentication class.
2020-01-30 09:13:51 -05:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Ayub khan
8a95a8e520 BOM-95
assertItemsEqual with six.assertCountEqual
2019-08-21 17:01:40 +05:00
arbisoft
e87dc6cc77 Fixing python-modernize issues. 2019-07-11 14:24:38 +05:00
Douglas Hall
7128059921 Add API view for retrieving third party auth user status. 2019-04-02 12:58:13 -04:00
Matthew Piatetsky
9681ca36b8 fix unicode strings in common/ 2019-02-05 10:57:00 -05:00
J. Cliff Dyer
b3521e0f88 Add endpoint to get SAML providers for a user.
View is combined with user SSO views.

Includes a new version of the view that takes explicit "username" or "email".

OC-4285
2018-10-18 14:02:12 -04:00
Robert Raposa
fbc59231fc Update edx-drf-extensions to 2.0.0.
Note: this version update is backward incompatible.

ARCH-255
2018-10-17 01:00:34 -04:00
Ahsan Ulhaq
ee7555e85f update usage of SessionAuthenticationAllowInactiveUser
LEARNER-6469
2018-10-01 17:52:52 +05:00
Jeremy Bowman
3ff3eee2f2 TE-2689 Remove useless pylint suppressions part 4 2018-08-20 12:54:22 -04:00
Eric Fischer
247bb50ed2 s/django.core.urlresolvers/django.urls/g
Django 1.10 deprecation fix for Hackathon XIX
Addresses PLAT-1397
2018-06-05 13:59:09 -04:00
Brittney Exline
682ec886ed ENT-943 Refactoring third_party_auth models 2018-04-05 15:19:58 -04:00
bmedx
ffc2a0eb7c common urls cleanup for Django 1.11
- Remove usage of django.urls.patterns
- Change urls tuples to lists
- Make all string view names callables
2017-11-07 11:27:20 -05:00
Omar Al-Ithawi
1b46c3e646 Add optional support for Unicode usernames
Refactoring: Use format with named variables
2017-06-27 14:18:49 +03:00
Uman Shahzad
8b65ca17c5 Migrate to latest, split python-social-auth.
PSA was monolothic, now split, with new features, like
a DB-backed partial pipeline. FB OAuth2 version also upped.

Partial pipelines don't get cleared except when necessary.
They persist for special cases like change of browser while
still mid-pipeline (i.e. email validation step).

Refactor, cleanup, and update of a lot of small things as well.

PLEASE NOTE the new `social_auth_partial` table.
2017-06-20 22:05:36 +05:00
Andy Armstrong
93235d118d Reorder imports using isort (except lms and cms) 2017-05-30 16:04:54 -04:00
Jesse Shapiro
ce2ab5b15c Adding 'visible' field for SSO providers 2016-09-08 11:27:09 -04:00
Usman Khalid
6cb62f2697 Rebase upgrade Django to v1.8.5
Please note that this is a squshed commit and the work of:
Symbolist, macdiesel, nedbat, doctoryes, muzaffaryousaf and muhammad-ammar
2015-11-10 15:00:19 -05:00
Pan Luo
f69304373c Implement user mapping API
This mapping API enables the mapping between the edX user ID and the ID
provided by identity provider (IdP). For details, please see
https://github.com/edx/edx-platform/pull/9842
2015-10-27 15:19:42 -07:00
Braden MacDonald
4be8aa5d5d Initial implementation of API for listing a user's third party auth providers 2015-09-10 16:44:50 -07:00