improved

Decorator and Mixin Support for Django

๐Ÿ“ฃ Django Auth SDK 0.3.0 Release ๐ŸŽ‰

There were several enhancements to the Django Auth SDK with this release. Below is a summary of all changes:

  • Added the following authentication markers to identify your protected endpoints:
    • @wristband_auth_required decorator: Apply to function-based views that need authentication
    • WristbandAuthRequiredMixin mixin: Inherit in class-based views to mark them as protected
      These markers don't handle the actual authentication logic themselves. Instead, they serve as signals to your auth middleware, telling it which routes require user validation.
  • Added the is_wristband_auth_required() utility function, which determines if the incoming request targets a protected endpoint. Your auth middleware can rely on it to determine whether to validate the user's authenticated session or not.
  • Added a new section to the README to show how to combine Wristband auth with Django's built-in user management system. This hybrid approach lets you leverage Wristband for secure, scalable authentication while using Django's familiar User model, groups, permissions, and admin interface for application-specific user management.
  • When the login() function cannot resolve a tenant domain and redirects to the Tenant Discovery Page, the return URL (whether provided via LoginConfig or request query parameter) is now preserved by appending it as a state query parameter to the tenant discovery URL. This ensures the return URL persists throughout the complete authentication flow, allowing users to land at their intended destination after tenant selection and login.

The Django Demo App has been updated to show usage of the authentication markers and utility function.