Repository navigation
Conversation
added 2 commits
November 5, 2026 08:16
Add a self-contained application template: a Django Ninja backend and a React frontend that log users in with Microsoft Entra ID instead of Keycloak. It does not use the accounts, events or gatekeeper applications, or the CloudHarness base images. - application-templates/django-entra: new template (harness-application myapp -t django-entra), not combinable with other templates - DjangoEntraBuilder: copies the template verbatim (keeps comments in yaml/json), adds the __APP_MODULE__ placeholder for markdown files, installs the frontend packages and generates the ts client - harness-generate and manifest inference handle django-entra apps - vscode debug template for Entra (.env file, no Keycloak variables) - docs: harness-application.md
| # Check if name is a defined pydantic field | ||
| if hasattr(self, 'model_fields') and name in self.model_fields: | ||
| # Use the original __setattr__ for defined fields | ||
| super(BaseModel, self).__setattr__(name, value) |
|
|
||
| snake_case_name = humps.decamelize(name) | ||
| if hasattr(self, 'model_fields') and snake_case_name in self.model_fields: | ||
| super(BaseModel, self).__setattr__(snake_case_name, value) |
Comment on lines
+18
to
+21
| _auth_service = AuthService( | ||
| client_roles=client_roles if client_roles is not None else settings.AUTH_ALL_ROLES, | ||
| admin_role=admin_role or settings.AUTH_ADMIN_ROLE, | ||
| ) |
| return super().__contains__(key) | ||
|
|
||
|
|
||
| class CloudHarnessBaseModel(BaseModel): |
| from flask import current_app as app | ||
| from sentry_sdk.integrations.flask import FlaskIntegration | ||
| integrations = [FlaskIntegration()] | ||
| except: |
| def get_namespace(): | ||
| try: | ||
| namespace = conf.get_configuration()['namespace'] | ||
| except: |
| settings, | ||
| 'CSRF_TRUSTED_ORIGINS', | ||
| []) + [f"https://{CH_DOMAIN}", f"https://*.{CH_DOMAIN}"] | ||
| except: |
|
|
||
| try: | ||
| schema = st.from_uri(app_url + "/openapi.json") | ||
| except: |
| for field_name, field_info in model_fields.items(): | ||
| if hasattr(field_info, 'alias') and field_info.alias == key: | ||
| return object.__getattribute__(obj, field_name) | ||
| except AttributeError: |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes CH-X
Implemented solution
Implements Entra as an authentication provider for django-ninja. Replaces keycloak-gogatekeeper for this template.
How to test this PR
Create a sample app with template type django-entra.
Configure an entra app registration and set up the values.yaml config values.
Verify that the oidc flow works and that auth requests are redirected to the configured client in entra.
Sanity checks:
Breaking changes (select one):
breaking-changeand the migration procedure is well described abovePossible deployment updates issues (select one):
alert:deploymentTest coverage (select one):
Documentation (select one):
Nice to have (if relevant):