-
Notifications
You must be signed in to change notification settings - Fork 40
Okfn updates #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Okfn updates #126
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
6d14a80
Allow skip logout
avdata99 e738d36
Improve logout
avdata99 c613c9d
Trigger CKAN failed login signal
avdata99 0f559d4
Merge pull request #1 from okfn/up-main
avdata99 4ffc090
Merge pull request #2 from avdata99/allow_skipping_logout
avdata99 84e3de5
Merge pull request #3 from avdata99/trigger_ckan_failed_login_signal
avdata99 4052034
Fix flake8
avdata99 32d67f8
drop Py37 and CKAN 2.9 support
avdata99 d40a753
Increse coverage
avdata99 86d7cb7
drop failing CKAN 2.9
avdata99 f59f258
README notes
avdata99 0abb4dd
rename test
avdata99 2774947
$
avdata99 179f8c0
Merge pull request #4 from okfn/fix_flake
avdata99 d8ee89b
Search email ignoring case
avdata99 bd49194
Merge pull request #5 from okfn/raise_error_on_duplicated_email
avdata99 67fe0a8
Add test for _get_user_by_email (#6)
avdata99 f5e0cfd
NameID no serializable
pdelboca 9bfa777
Test CKAN 2.11 (#7)
avdata99 f5c8429
Improve error log (#10)
avdata99 5f03659
Change the SSO button text (#11)
germankay 3c50674
release 1.3.5
avdata99 9b3a17f
Add coverage tests
blagojabozinovski e73f351
Add tests for cache.py
blagojabozinovski 0f5ac7d
Additional tests for cache.py
blagojabozinovski 6f0a361
Tests code cleanup
blagojabozinovski 384925c
Tests code refactor
blagojabozinovski 91ffae0
Merge pull request #127 from keitaroinc/coverage-tests
blagojabozinovski 25ad215
Disable conftests
blagojabozinovski 4f5fc4c
Add slo unit tests
blagojabozinovski 8bc6142
Flake8 fixes
blagojabozinovski 0bf0bca
Remove unit test for CKAN 2.9
blagojabozinovski 8b84a4e
Revert change to tests
blagojabozinovski fe79a00
Flake8 fix
blagojabozinovski b0d2f8b
Drop CKAN 2.9 support for test ckan cookie
blagojabozinovski 838ffcd
Update README.md
blagojabozinovski c158223
Update setup
blagojabozinovski 0cbe81f
Update setup
blagojabozinovski 62cc216
Remove additional plugins for conftest
blagojabozinovski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| from ckanext.saml2auth.cache import set_subject_id, get_subject_id, get_saml_session_info | ||
| from types import SimpleNamespace | ||
| from saml2.ident import code | ||
|
|
||
| nameid = SimpleNamespace( | ||
| name_qualifier="issuer.example.com", | ||
| sp_name_qualifier="sp.example.com", | ||
| text="user123", | ||
| format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent", | ||
| sp_provided_id=None | ||
| ) | ||
|
|
||
|
|
||
| def test_set_subject_id_with_string(): | ||
| session = {} | ||
| set_subject_id(session, "user123") | ||
| assert session['_saml2_subject_id'] == "user123" | ||
|
|
||
|
|
||
| def test_set_subject_id_with_nameid_like_object(): | ||
| session = {} | ||
| expected_code = code(nameid) | ||
| set_subject_id(session, nameid) | ||
| assert session['_saml2_subject_id'] == expected_code | ||
|
|
||
|
|
||
| def test_get_subject_id_missing(): | ||
| session = {} | ||
| result = get_subject_id(session) | ||
| assert result is None | ||
|
|
||
|
|
||
| def test_get_subject_id_with_real_code_decode(): | ||
|
|
||
| encoded = code(nameid) | ||
| session = {'_saml2_subject_id': encoded} | ||
|
|
||
| result = get_subject_id(session) | ||
|
|
||
| assert result.name_qualifier == nameid.name_qualifier | ||
| assert result.sp_name_qualifier == nameid.sp_name_qualifier | ||
| assert result.format == nameid.format | ||
| assert result.text == nameid.text | ||
| assert result.sp_provided_id == nameid.sp_provided_id | ||
|
|
||
|
|
||
| def test_get_saml_session_info_with_encoded_nameid(): | ||
|
|
||
| encoded_nameid = code(nameid) | ||
| session = { | ||
| '_saml_session_info': { | ||
| 'name_id': encoded_nameid, | ||
| 'other_data': 'example' | ||
| } | ||
| } | ||
|
|
||
| result = get_saml_session_info(session) | ||
|
|
||
| assert isinstance(result['name_id'], object) | ||
| assert result['name_id'].name_qualifier == nameid.name_qualifier | ||
| assert result['name_id'].sp_name_qualifier == nameid.sp_name_qualifier | ||
| assert result['name_id'].text == nameid.text | ||
| assert result['name_id'].format == nameid.format | ||
| assert result['name_id'].sp_provided_id == nameid.sp_provided_id | ||
| assert result['other_data'] == 'example' | ||
|
|
||
|
|
||
| def test_get_saml_session_info_with_decoded_nameid(): | ||
|
|
||
| session = { | ||
| '_saml_session_info': { | ||
| 'name_id': nameid, | ||
| 'foo': 'bar' | ||
| } | ||
| } | ||
|
|
||
| result = get_saml_session_info(session) | ||
|
|
||
| assert result['name_id'] == nameid | ||
| assert result['foo'] == 'bar' | ||
|
|
||
|
|
||
| def test_get_saml_session_info_missing(): | ||
| session = {} | ||
| result = get_saml_session_info(session) | ||
| assert result is None |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.