Code Monkey home page Code Monkey logo

django-channels-jwt-auth-middleware's People

Contributors

joshua-hashimoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

django-channels-jwt-auth-middleware's Issues

Reject Connection of Anonymous User

Is it possible to reject connection of who wants to connect in connect() function with token in URL and even We don't check in the receive() function for user validity?

How to handle "Signature has expired" exceptions

Is there a way to return the ExpiredSignatureErrors to the socket?

Currently the middleware is raising the following exception:

File ".../env/lib/python3.11/site-packages/django_channels_jwt_auth_middleware/auth.py", line 39, in get_payload
    payload = jwt_decode(
              ^^^^^^^^^^^
  File ".../env/lib/python3.11/site-packages/jwt/api_jwt.py", line 210, in decode
    decoded = self.decode_complete(
              ^^^^^^^^^^^^^^^^^^^^^
  File ".../env/lib/python3.11/site-packages/jwt/api_jwt.py", line 162, in decode_complete
    self._validate_claims(
  File ".../env/lib/python3.11/site-packages/jwt/api_jwt.py", line 248, in _validate_claims
    self._validate_exp(payload, now, leeway)
  File ".../env/lib/python3.11/site-packages/jwt/api_jwt.py", line 306, in _validate_exp
    raise ExpiredSignatureError("Signature has expired")
jwt.exceptions.ExpiredSignatureError: Signature has expired

IMO the exception should be captured and returned to the socket so that the client can refresh their token and try again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.