Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP1
python-websockify
PyJWT-token-plugin.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File PyJWT-token-plugin.patch of Package python-websockify
From cf2bd3930d8506dbb4db172c89a6a628134595aa Mon Sep 17 00:00:00 2001 From: UXabre <arend.lapere@gmail.com> Date: Fri, 21 Dec 2018 03:21:29 -0500 Subject: [PATCH] Added JWT tokens capability --- setup.py | 2 +- tests/jwt.secret | 1 + tests/jwt_rsa | 27 ++++++++++++++++++ tests/jwt_rsa.pub | 1 + tests/test_websocketproxy.py | 54 ++++++++++++++++++++++++++++++++++++ websockify/token_plugins.py | 16 +++++++++++ 6 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 tests/jwt.secret create mode 100644 tests/jwt_rsa create mode 100644 tests/jwt_rsa.pub Index: websockify-0.8.0/setup.py =================================================================== --- websockify-0.8.0.orig/setup.py +++ websockify-0.8.0/setup.py @@ -34,7 +34,7 @@ setup(name=name, packages=['websockify'], include_package_data=True, - install_requires=['numpy'], + install_requires=['numpy', 'PyJWT', 'cryptography'], zip_safe=False, entry_points={ 'console_scripts': [ Index: websockify-0.8.0/websockify/token_plugins.py =================================================================== --- websockify-0.8.0.orig/websockify/token_plugins.py +++ websockify-0.8.0/websockify/token_plugins.py @@ -125,5 +125,17 @@ class JWTTokenApi(BasePlugin): print >>sys.stderr, "Failed to parse token: %s" % (e) return None except ImportError as e: - print >>sys.stderr, "package jwcrypto not found, are you sure you've installed it correctly?" + try: + import jwt + + secret = open(self.source, 'rb').read() + parsed = jwt.decode(token, secret, algorithms=['RS256', 'RS384', 'RS512', 'HS256', 'HS384', 'HS512', 'ES256', 'ES384', 'ES512', 'PS256', 'PS384', 'PS512']) + + return (parsed['host'], parsed['port']) + except Exception as e: + print >>sys.stderr, "Failed to parse token: %s" % (e) + return None + except ImportError: + print >>sys.stderr, "neither package jwcrypto nor PyJWT found, are you sure you've installed one of them correctly?" + return None return None
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor