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

Feature: Custom SSO Adapter and Config Loading for Flexible SSO #502

Closed
wants to merge 21 commits into from

Conversation

chrismaddalena
Copy link
Collaborator

This includes the changes from PR #501 and uses those changes to support loading SSO configurations without requiring any editing of the config files from the repository.

This also includes a customized social login adapter for django-allauth. The adapter includes a pre_social_login() check that look at the user's primary email address to perform the following:

  • If en existing account has the same email address, the social login is allowed and the accounts are connected
  • If multiple accounts share the same email address, the user is redirected with an error message
  • If no account is found, the social login results in a new account being created (if registration is enabled)

We could potentially check all email addresses attached to user accounts or require email addresses be verified. That may come in a later update.

If SOCIAL_ACCOUNT_ALLOW_REGISTRATION is enabled (set to True) Ghostwriter will create a new account for the incoming user. A custom populate_user() sets the user's first, last, and full name fields and sets the username from the the SSO provider or the first half of the email address.

The custom is_open_for_signup() also checks a new SOCIAL_ACCOUNT_DOMAIN_ALLOWLIST config option. If this option is filled-in, Ghostwriter will only allow a new account to be created if the incoming user's email address matches a domain in this allowlist.

Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 65.21739% with 8 lines in your changes missing coverage. Please review.

Project coverage is 91.93%. Comparing base (ff61393) to head (19ec9c2).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
ghostwriter/users/forms.py 42.85% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #502      +/-   ##
==========================================
- Coverage   91.96%   91.93%   -0.04%     
==========================================
  Files         314      315       +1     
  Lines       18158    18183      +25     
==========================================
+ Hits        16699    16716      +17     
- Misses       1459     1467       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chrismaddalena
Copy link
Collaborator Author

Closed in favor of #513 that includes these changes.

@chrismaddalena chrismaddalena deleted the feature/sso-adapter branch September 30, 2024 23:13
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.

1 participant