jazzband / djangorestframework-simplejwt

A JSON Web Token authentication plugin for the Django REST Framework.
https://django-rest-framework-simplejwt.readthedocs.io/
MIT License
4.02k stars 663 forks source link

Implement django authentication signals #190

Open ricardocamposilva opened 4 years ago

ricardocamposilva commented 4 years ago

Wouldn't it be better?

If implemented this feature developers could apply their own logic around it and use where they want. In this case I think it's more for security and audit purposes, today I have to apply lots of code lines to record a log raster.

sieira commented 4 years ago

This https://github.com/davesque/django-rest-framework-simplejwt/pull/196 should to it, although I wonder what should happen on token refresh (impressive job, by the way, @davesque)

As I see it, it should:

Emit logged_in if refresh OK Emit login_failed if token is invalid Emit logged_out if token is valid but expired

Roughly this: https://github.com/sieira/django-rest-framework-simplejwt/pull/1 (the latest is a proposition, not a real pull request, since I doubt we can centralise the signal handling like that )

Routhinator commented 4 years ago

This would be a solid addition and I just came here looking to see if this was already supported. :+1: