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

DBC22-2535 IDIR login for admin/cms #784

Merged
merged 3 commits into from
Jan 24, 2025
Merged

DBC22-2535 IDIR login for admin/cms #784

merged 3 commits into from
Jan 24, 2025

Conversation

fatbird
Copy link
Collaborator

@fatbird fatbird commented Dec 16, 2024

Changes Django admin and Wagtail admin to use Keycloak IDIR auth. Adds functionality to email an access request after authenticating, if further actions are required.

This is disabled by default; enabling it requires adding the following environment variable:

FORCE_IDIR_AUTHENTICATION=True
DRIVEBC_ACCESS_REQUEST_RECEIVERS=<semicolon separated list of email addresses>

Which has been added to all OpenShift environments. To continue using local accounts in local dev, simply don't enable this.

msg.attach_alternative(html, 'text/html')
msg.send()
return HttpResponseRedirect(request.path)

Check warning

Code scanning / CodeQL

URL redirection from remote source Medium

Untrusted URL redirection depends on a
user-provided value
.
@fatbird fatbird force-pushed the feature/DBC22-2535 branch from dec203e to 1beba00 Compare January 14, 2025 18:04
@fatbird fatbird force-pushed the feature/DBC22-2535 branch from 1beba00 to f39cab4 Compare January 14, 2025 18:10
@fatbird fatbird requested a review from ray-oxd January 14, 2025 18:12
@fatbird fatbird marked this pull request as ready for review January 14, 2025 18:13
"django.contrib.auth.backends.ModelBackend",

# `allauth` specific authentication methods, such as login by email
'allauth.account.auth_backends.AuthenticationBackend',
]

LOGIN_REDIRECT_URL = FRONTEND_BASE_URL
LOGIN_URL = 'http://localhost:8000/accounts/oidc/idir/login/?process=login&next=%2Fdrivebc-admin%2F&auth_params=kc_idp_hint=azureidir'

Copy link
Collaborator

Choose a reason for hiding this comment

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

This login URL shouldn't be static?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. I'll fix.

f'{name} requests access to Wagtail admin',
text,
'do_not_reply@gov.bc.ca',
settings.ACCESS_REQUEST_RECEIVERS,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please replace instances of these FROM emails to env("DRIVEBC_FEEDBACK_EMAIL_DEFAULT")

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, yes.

f'{name} requests access to DriveBC admin',
text,
'do_not_reply@gov.bc.ca',
settings.ACCESS_REQUEST_RECEIVERS,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please replace this instance too

@ray-oxd ray-oxd merged commit b4215b6 into main Jan 24, 2025
3 checks passed
@ray-oxd ray-oxd deleted the feature/DBC22-2535 branch January 24, 2025 18:58
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