Skip to content

Feature: django-entra application template - #893

Draft
alxbrd wants to merge 2 commits into
developfrom
feature/django-entra-application-template
Draft

alxbrd wants to merge 2 commits into
developfrom
feature/django-entra-application-template

Conversation

@alxbrd

@alxbrd alxbrd commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

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:

  • The pull request is explicitly linked to the relevant issue(s)
  • The issue is well described: clearly states the problem and the general proposed solution(s)
  • In this PR it is explicitly stated how to test the current change
  • The issue seta the scope and the type of issue (bug, story, task, etc.)
  • The relevant components are indicated in the issue (if any)
  • All the automated test checks are passing
  • All the linked issues are included in one Sprint
  • All the linked issues are in the Review state
  • All the linked issues are assigned

Breaking changes (select one):

  • The present changes do not change the preexisting api in any way
  • This PR and the issue are tagged as a breaking-change and the migration procedure is well described above

Possible deployment updates issues (select one):

  • There is no reason why deployments based on CloudHarness may break after the current update
  • This PR and the issue are tagged as alert:deployment

Test coverage (select one):

  • Tests for the relevant cases are included in this pr
  • The changes included in this pr are out of the current test coverage scope

Documentation (select one):

  • The documentation has been updated to match the current changes
  • The changes included in this PR are out of the current documentation scope

Nice to have (if relevant):

  • Screenshots of the changes
  • Explanatory video/animated gif

Alex Burdusel 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
@alxbrd
alxbrd requested a review from ddelpiano November 5, 2026 11:37
@alxbrd
alxbrd marked this pull request as draft November 5, 2026 11:37
@alxbrd
alxbrd requested a review from filippomc November 5, 2026 11:37
# 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

No deployments
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