|
|
|
@ -343,6 +343,11 @@ class JMWalletDaemon(Service): |
|
|
|
request_cookie) + ", request rejected.") |
|
|
|
request_cookie) + ", request rejected.") |
|
|
|
raise NotAuthorized() |
|
|
|
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): |
|
|
|
def set_token(self, wallet_name): |
|
|
|
""" This function creates a new JWT token and sets it as our |
|
|
|
""" This function creates a new JWT token and sets it as our |
|
|
|
'cookie' for API and WS. Note this always creates a new fresh token, |
|
|
|
'cookie' for API and WS. Note this always creates a new fresh token, |
|
|
|
@ -502,6 +507,10 @@ class JMWalletDaemon(Service): |
|
|
|
to the client what the current status of the wallet |
|
|
|
to the client what the current status of the wallet |
|
|
|
and services is. TODO: add more data to send to client. |
|
|
|
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 |
|
|
|
#if no wallet loaded then clear frontend session info |
|
|
|
#when no wallet status is false |
|
|
|
#when no wallet status is false |
|
|
|
session = not self.cookie==None |
|
|
|
session = not self.cookie==None |
|
|
|
|