Browse Source

feat: validate auth header in session request if provided

master
theborakompanioni 4 years ago
parent
commit
c7a2612633
No known key found for this signature in database
GPG Key ID: E8070AF0053AAC0D
  1. 9
      jmclient/jmclient/wallet_rpc.py

9
jmclient/jmclient/wallet_rpc.py

@ -342,6 +342,11 @@ class JMWalletDaemon(Service):
jlog.warn("Invalid cookie: " + str(
request_cookie) + ", request rejected.")
raise NotAuthorized()
def check_cookie_if_present(self, request):
auth_header = request.getHeader('Authorization')
if auth_header is not None:
self.check_cookie(request)
def set_token(self, wallet_name):
""" This function creates a new JWT token and sets it as our
@ -502,6 +507,10 @@ class JMWalletDaemon(Service):
to the client what the current status of the wallet
and services is. TODO: add more data to send to client.
"""
#validate auth header if provided
#this lets caller know if cookie is invalid or outdated
self.check_cookie_if_present(request)
#if no wallet loaded then clear frontend session info
#when no wallet status is false
session = not self.cookie==None

Loading…
Cancel
Save