Commit Graph

430 Commits

Author SHA1 Message Date
Alexander Sheehan
0e5b70a800 Adding country to list of attrs, updating help text and max length 2020-07-23 16:29:05 -04:00
Alexander Sheehan
2e2493f99d ENH adding country to SAML mapping config 2020-07-21 16:23:00 -04:00
Binod Pant
19f82258aa ENT-3160 Automate association to customer on SAMLProviderConfig creation (#24519)
* create links ProviderConfig to EnterpriseCustomer

* lint

* remove extraneous print

* don't create samlprovider unless enterprise found, update a test to use valid uuid and fail request

* fix test for correct status code as was intended
2020-07-20 12:35:04 -04:00
Binod Pant
167d8f278f ENT-3007 : round 2 API endpoints for samlproviderconfig and samlproviderdata (#24456)
* ENT-3007 auth/saml/v0/saml/providerdata and auth/saml/v0/saml/providerconfig endpoints

Move code to subfolder for samlproviderconfig

extra comma

undo accidental remove of import

GET works for a single config now

Use ModelViewSet to get all CRUD method. Test still fails

Add auth/saml/v0/providerdata endpoints

fixup reverse and test issue, remove leading caret

just triggering run, why is it failing in CI?

pycodelint fixes

Skip auth tests unless feature is on

Tests for post/put for samlproviderdata

move urls to their own folders

api tests for post samlprovierconfig

create 1 providerconfig test case

lint fixes

lint

lint

cleanup code local urls /samlproviderconfig works

note needed right now

Fix import errors

lint

unused import

wip: first attempt at rbac auth and jwt cookie in test

round 2 with enterprise uuid as url param for samlproviderconfig

improve tests, still dont pass

fix test by using system role, wip other test

fix create test

add get/post tests for providerdata

isort fixes

string lint fix

Cleanup based on feedback round1

move utils to tests package

Move util fn to openedx.feature area

lint

ENT-3007 : Round 2 of work on auth/saml/v0/providerconfig and auth/saml/v0/providerdata endpoints

* Fix test issue use string uuid for permission obj

* snake case changes provider_config

* snake case

* provider_data, tests and lint

* patch and delete tests for providerdata

* snake_case

* snake_case

* snake_case

* make patch test stronger

* 404 if invalid uuid for get param

* common util for validate uuid4

* unused import

* lint fixes for pycodestyle

* 400 when uuid is missing

* 400 instead of 404 for missing uuid

* spell fix

* update docstring for api usage

* docstring clarify
2020-07-15 10:34:26 -04:00
Feanil Patel
5470ce5805 Revert "ENT-3007 : Add auth/saml/v0/providerconfig|data CRUD endpoints for use in admin portal (#24298)"
This reverts commit 96ddcdc288.
2020-07-10 13:38:30 -04:00
Binod Pant
96ddcdc288 ENT-3007 : Add auth/saml/v0/providerconfig|data CRUD endpoints for use in admin portal (#24298)
* Add auth/samlproviderconfig CRUD endpoints for use in admin portal

Fixes: ENT-3007

* Move code to subfolder for samlproviderconfig

* extra comma

* undo accidental remove of import

* GET works for a single config now

* Use ModelViewSet to get all CRUD method. Test still fails

* Add auth/saml/v0/providerdata endpoints

* fixup reverse and test issue, remove leading caret

* just triggering run, why is it failing in CI?

* pycodelint fixes

* Skip auth tests unless feature is on

* Tests for post/put for samlproviderdata

* move urls to their own folders

* api tests for post samlprovierconfig

* create 1 providerconfig test case

* lint fixes

* lint

* lint

* cleanup code local urls /samlproviderconfig works

* note needed right now

* Fix import errors

* lint

* unused import

* wip: first attempt at rbac auth and jwt cookie in test

* round 2 with enterprise uuid as url param for samlproviderconfig

* improve tests, still dont pass

* fix test by using system role, wip other test

* fix create test

* add get/post tests for providerdata

* isort fixes

* string lint fix

* Cleanup based on feedback round1

* move utils to tests package

* Move util fn to openedx.feature area

* lint

* lint fix

* remove unused import
2020-07-10 11:23:13 -04:00
Aarif
9e34cb3df9 Removed deprecated future imports (#24295) 2020-06-28 23:40:03 +05:00
Awais Qureshi
b4035bc71e BOM-1750
DeprecationWarning `callable is None` raised  since 3.5 throwing TypeError.
Fixed the assertion.
2020-06-24 01:43:09 +05:00
Aarif
27480cdd2f Removed deprecated future imports 2020-06-23 18:51:43 +05:00
Ned Batchelder
cca33732ba Correct markup mistakes in api docs 2020-05-12 13:36:14 -04:00
Tim McCormack
9cff06d762 Address 1+N django_site queries on login page by comparing keys directly (#23947)
Rather than fetching the Site for every provider in a loop, just look at
the ID of the site.

Added regression test, showing N `django_site` requests before and 0 after.
2020-05-11 15:37:22 +00:00
Zia Fazal
d04f2735a1 Merge pull request #23934 from edx/ziafazal/ENT-2730
ENT-2730: Apply same username restrictions during SSO pipeline
2020-05-08 09:29:19 +05:00
zia.fazal@arbisoft.com
647da21191 Apply same username restrictions during SSO pipeline
Apply same username restrictions during SSO pipeline as we have user registeration flow to avoid SSO flow breakage at the time of user creation.
ENT-2730

Code quality fixes
2020-05-07 19:50:56 +05:00
Robert Raposa
b98d200fdc Revert "Dark launch: Fix site shadowing and 1+N queries in third party auth config fetching (#23824)" (#23935)
This reverts commit 79420640d5.
2020-05-07 09:38:54 -04:00
Tim McCormack
79420640d5 Dark launch: Fix site shadowing and 1+N queries in third party auth config fetching (#23824)
This performs a dark launch compare of the existing implementation
(still in use) for fetching TPA provider configs and a new
implementation, recording metrics on exceptions and mismatches.

The new implementation should have two benefits, once we're switched
over:

- Fix 1+N queries on login page view where the site for each config
  was fetched in a loop (ARCHBOM-1139)
- Don't allow configs with the same key on different sites to
  interfere with each other (regression test added)

The new impl does not use TieredCache, but only the request cache,
which we may want to adjust later.
2020-05-06 13:54:32 +00:00
Aarif
98af9ce418 remove useless-supression warnings 2020-05-01 19:42:15 +05:00
Diana Huang
f316387cab Clean up migrations and handle manual merging. 2020-04-23 10:16:16 -04:00
Diana Huang
227df4e267 Auto-generated squashed migration. 2020-04-23 10:16:16 -04:00
zia.fazal@arbisoft.com
f70390d70f Added more info to log in SSO request/response flow
Added more info to log in SSO request/response flow
Fixed django admin links on model's link fields which are broken due to django 2.2 upgrade.
ENT-2798

Fixed quality violations and unit test

Fix xsscommitlint violation

Fixed pylint violation
2020-04-20 14:38:51 +05:00
Zia Fazal
f2f8d8519a Merge pull request #23658 from edx/ziafazal/ENT-2709
ENT-2709:Map first name to edx username by default oauth SSO
2020-04-09 09:56:56 +05: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
cd60f6c973 Map first name to edx username by default oauth SSO
Change to map first name to edx username by default oauth SSO with `identityserver3` backend
ENT-2709

Addressed reviewer's feedback
2020-04-08 19:26:24 +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
Diana Huang
ea0b7019cf Add a migration that was generated for Django 2. 2020-04-01 16:09:44 -04: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
zia.fazal@arbisoft.com
6f3fe9307c Use user's first name as username
Changes to use user's first name as username for SAP Success Factors SSO.
ENT-1705

Don't ask for username from oData by default

add code comment
2020-03-09 12:34:00 +05:00
Diana Huang
8e6647234f Update migration to not modify providerapipermissions. (#23271) 2020-03-03 11:31:56 -05:00
Manjinder Singh
4399d13955 removing all of provider (#23269)
* Revert "Ran make migration on third_party_auth (#23253)"

This reverts commit 49be65cc58.

* Removing provider.util import

* Removing further provider things

* Adding hash tests
2020-03-03 10:42:18 -05:00
Manjinder Singh
fa2140cd16 Revert "Ran make migration on third_party_auth (#23253)"
This reverts commit 49be65cc58.
2020-03-03 09:17:26 -05:00
Manjinder Singh
49be65cc58 Ran make migration on third_party_auth (#23253)
* Ran make migration on third_party_auth and removing skip comment from test_migrations_are_in_sync
2020-03-02 16:32:40 -05:00
Diana Huang
0fa91d72db Remove DOP libraries from edx-platform.
Remove DOP apps from INSTALLED_APPS.
Remove DOP libraries from requirements.
2020-03-02 11:17:47 -05: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
d08cd9ce04 Removing provider imports from edx-platform (#23229)
* Removing from provider imports from openedx

 * removed all uses of retire_dop_oauth2_models

* Removing provider library from lms, common, and cms

Created/copied function short_token(from django-oauth-provider) and create_hash256 to help with conversion
2020-03-02 08:56:54 -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
Nathan Sprenkle
c66176da13 Add error reporting to UI for CSV team management (#23035)
* Add error banner for upload memberships errors

* Edit error message language

* Fix linter warnings
2020-02-14 09:58:58 -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
Ayub-khan
d3a02bc3e5 BOM-1121
-Updated middleware setting to use use middleware insted of
middleware_classes
-github install of django-method-override fork to support
new style middleware in django1.11
2020-02-11 14:35:26 +05:00
Jeremy Bowman
59768e7498 Fix more deprecation warnings (#23061) 2020-02-10 13:17:25 -05:00
David Ormsbee
76a7d40065 Merge pull request #23047 from edx/ormsbee/update_config_models
Python upgrades (django-config-models v2)+
2020-02-10 09:13:10 -05:00
Zia Fazal
26891841e4 Merge pull request #22987 from edx/ziafazal/ENT-2269
ENT-2269: Added ability to logout from IDP when logout flow is triggered from learner portal
2020-02-10 12:53:41 +05:00
David Ormsbee
b134228954 Python upgrades (django-config-models v2)+
Some tests that used to mock the cache internals of ConfigurationModels
had to be modified to use CacheIsolationTestCase instead (the things
they were mocking no longer exist).
2020-02-09 20:37:45 -05:00
zia.fazal@arbisoft.com
d7ed021b8d Added ability to logout from IDP
Logout link should be displayed only for learner portal

Added changed to display only for learner portal
Added unit tests

check third_party_auth is enabled

Changes to extend SSO logout link feature to Oauth providers

Fixed quality violations

Removed unncessary assert

Reviewer feedback changes
2020-02-07 19:38:36 +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