Skip to content

feat(JD-1/DS-314): Microsite aware key-secret pairs for oauth#698

Merged
Henrrypg merged 1 commit intoednx-release/nuez.masterfrom
nu/ednx/JU-1
Nov 25, 2022
Merged

feat(JD-1/DS-314): Microsite aware key-secret pairs for oauth#698
Henrrypg merged 1 commit intoednx-release/nuez.masterfrom
nu/ednx/JU-1

Conversation

@Henrrypg
Copy link

@Henrrypg Henrrypg commented Nov 22, 2022

Description

This PR allows us to create an Oauth2 configuration for each site with different backends, enabling multitenancy.

A more detailed description of these changes: #433

How to test

  1. Add backends to your platform settings
    File: env/apps/openedx/settings/lms/development.py

"THIRD_PARTY_AUTH_BACKENDS": [
        'social_core.backends.google.GoogleOAuth2',
        'social_core.backends.linkedin.LinkedinOAuth2',
        'social_core.backends.facebook.FacebookOAuth2',
        'social_core.backends.azuread.AzureADOAuth2',
        'third_party_auth.saml.SAMLAuthBackend',
        'third_party_auth.lti.LTIAuthBackend',
]
  1. Enable TPA and add third party auth as installed app in your tenant:
"FEATURES": {
	.
	.
	.
	"ENABLE_THIRD_PARTY_AUTH": true
    },

"EDNX_TENANT_INSTALLED_APPS": [ "common.djangoapps.third_party_auth" ]
  1. Create an Oauth2 Configuration (using Google backend) for Tenant A and Tenant B:
    image

Checkout this document on how to configure your Google provider

  1. List Oauth2 Configurations:

Before changes (optional)
image

With JD-1
image

  1. Login/register to your site using Google

image

If your site/provider is well configured then you'll be able to register and login to your site.

- Change KEY_FIELD from KEY_FIELDS = ('backend_name') to KEY_FIELDS = ('site_id', 'backend_name')
- Override provider_id to cast field
- Override current method to pass site_id
@Henrrypg Henrrypg marked this pull request as ready for review November 22, 2022 21:06
@Henrrypg Henrrypg self-assigned this Nov 22, 2022
Copy link
Member

@JuanDavidBuitrago JuanDavidBuitrago left a comment

Choose a reason for hiding this comment

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

It's working as expected

Copy link
Contributor

@MaferMazu MaferMazu left a comment

Choose a reason for hiding this comment

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

It works, but I think it is important you update the documentation in favor of tenant configs instead of a microsite; the variable ENABLE_THIRD_PARTY_AUTH should be inside FEATURES (the doc doesn't reflect that); and in the PR you mention stack-builder, I think you can drop it because that setting can be placed in that file only with Tutor if you want. Can you update the documentation? Thanks in advance @Henrrypg

@Henrrypg
Copy link
Author

Thank you @MaferMazu, the doc and the PR is updated.

@Henrrypg Henrrypg merged commit 0abcbc0 into ednx-release/nuez.master Nov 25, 2022
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.

4 participants