Skip to content
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

Various amends #20

Merged
merged 16 commits into from
Jan 11, 2019
Merged

Various amends #20

merged 16 commits into from
Jan 11, 2019

Conversation

lgarvey
Copy link
Contributor

@lgarvey lgarvey commented Jan 10, 2019

As discussed, here's a PR with the changes that I've made to satisfy requirements for this project: https://www.github.com/uktrade/staff-sso. We have integrated our sso solution with Google and AWS via saml2, using this module.

Here's a summary of the changes:

  1. use the correct saml binding
  2. Pass the entity id into when instantiating the processor
  3. add an is_enabled method to the processor - use case: to enable the integration to be enabled/disabled.
  4. Allow configuration of the primary user field using either User.USERNAME_FIELD or SAML_IDP_USERNAME_FIELD [mirrors the logic in the djangosaml2 (sp) module]
  5. Move user name id retrieval logic to processor
  6. add some tests and a couple of bug fixes

Copy link
Contributor

@mhindery mhindery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks all good to me.

I've added a comment about a little bugfix which I just pushed which isn't in your fork, and another about a small possible optimization.

Do you find the separate is_enabled() and has_access methods on the Processor classes are okay, or could they be combined into a single method taking the request as param?

identity=identity, userid=request.user.username,
name_id=NameID(format=resp_args['name_id_policy'].format, sp_name_qualifier=resp_args['sp_entity_id'], text=request.user.username),
identity=identity, userid=user_id,
name_id=NameID(format=resp_args['name_id_policy'].format, sp_name_qualifier=resp_args['sp_entity_id'], text=user_id),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an fyi: this was changed from sp_name_qualifier=resp_args['destination'] to sp_name_qualifier=resp_args['sp_entity_id'] according to the issue filed here #18

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, makes sense - I'll test this in our UAT env tomorrow.

djangosaml2idp/processors.py Show resolved Hide resolved
djangosaml2idp/processors.py Outdated Show resolved Hide resolved
@lgarvey
Copy link
Contributor Author

lgarvey commented Jan 11, 2019

@mhindery I haven't had time to do what I wanted today - so maybe let's get this in a mergeable state and I'll raise another PR with some tests.

@mhindery
Copy link
Contributor

I'm fine with merging this as it is. I'll then add some documentation about the changes as there are some backwards-incompatible changes, and publish a new version. Does that sound ok to you?

@lgarvey
Copy link
Contributor Author

lgarvey commented Jan 11, 2019 via email

@mhindery mhindery merged commit ba324d7 into OTA-Insight:master Jan 11, 2019
@mhindery
Copy link
Contributor

The docs have been updated, I've released a new version: https://pypi.org/project/djangosaml2idp/0.5.0/

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants