Properly handle the "manual" mode of copy and paste auth information
This commit is contained in:
@@ -108,7 +108,8 @@ class Esi(EsiAccess):
|
|||||||
else:
|
else:
|
||||||
with gui.ssoLogin.SsoLogin() as dlg:
|
with gui.ssoLogin.SsoLogin() as dlg:
|
||||||
if dlg.ShowModal() == wx.ID_OK:
|
if dlg.ShowModal() == wx.ID_OK:
|
||||||
self.handleLogin({'SSOInfo': [dlg.ssoInfoCtrl.Value.strip()]})
|
message = json.loads(base64.b64decode(dlg.ssoInfoCtrl.Value.strip()))
|
||||||
|
self.handleLogin(message)
|
||||||
|
|
||||||
def stopServer(self):
|
def stopServer(self):
|
||||||
pyfalog.debug("Stopping Server")
|
pyfalog.debug("Stopping Server")
|
||||||
@@ -134,7 +135,7 @@ class Esi(EsiAccess):
|
|||||||
return 'http://localhost:{}'.format(port)
|
return 'http://localhost:{}'.format(port)
|
||||||
|
|
||||||
def handleLogin(self, message):
|
def handleLogin(self, message):
|
||||||
auth_response, data = self.auth(message['code'][0])
|
auth_response, data = self.auth(message['code'])
|
||||||
|
|
||||||
currentCharacter = self.getSsoCharacter(data['name'])
|
currentCharacter = self.getSsoCharacter(data['name'])
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ class Esi(EsiAccess):
|
|||||||
raise SSOError("Could not parse out querystring parameters.")
|
raise SSOError("Could not parse out querystring parameters.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
state_enc = message['state'][0]
|
state_enc = message['state']
|
||||||
state = json.loads(base64.b64decode(state_enc))['state']
|
state = json.loads(base64.b64decode(state_enc))['state']
|
||||||
except Exception:
|
except Exception:
|
||||||
raise SSOError("There was a problem decoding state parameter.")
|
raise SSOError("There was a problem decoding state parameter.")
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class APIException(Exception):
|
|||||||
class EsiAccess:
|
class EsiAccess:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.settings = EsiSettings.getInstance()
|
self.settings = EsiSettings.getInstance()
|
||||||
|
self.server_base: ApiBase = supported_servers[self.settings.get("server")]
|
||||||
|
|
||||||
# session request stuff
|
# session request stuff
|
||||||
self._session = Session()
|
self._session = Session()
|
||||||
@@ -95,8 +96,6 @@ class EsiAccess:
|
|||||||
jwks_call.raise_for_status()
|
jwks_call.raise_for_status()
|
||||||
self.jwks = jwks_call.json()
|
self.jwks = jwks_call.json()
|
||||||
|
|
||||||
self.server_base: ApiBase = supported_servers[self.settings.get("server")]
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def sso_url(self):
|
def sso_url(self):
|
||||||
return 'https://%s/v2' % self.server_base.sso
|
return 'https://%s/v2' % self.server_base.sso
|
||||||
@@ -173,7 +172,7 @@ class EsiAccess:
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = self.token_call(values)
|
res = self.token_call(values)
|
||||||
json_res = res.json();
|
json_res = res.json()
|
||||||
|
|
||||||
decoded_jwt = self.validate_eve_jwt(json_res['access_token'])
|
decoded_jwt = self.validate_eve_jwt(json_res['access_token'])
|
||||||
return json_res, decoded_jwt
|
return json_res, decoded_jwt
|
||||||
@@ -187,7 +186,7 @@ class EsiAccess:
|
|||||||
}
|
}
|
||||||
|
|
||||||
res = self.token_call(values)
|
res = self.token_call(values)
|
||||||
json_res = res.json();
|
json_res = res.json()
|
||||||
self.update_token(ssoChar, json_res)
|
self.update_token(ssoChar, json_res)
|
||||||
return json_res
|
return json_res
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class AuthHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
parsed_path = urllib.parse.urlparse(self.path)
|
parsed_path = urllib.parse.urlparse(self.path)
|
||||||
parts = urllib.parse.parse_qs(parsed_path.query)
|
parts = {k: ";".join(v) for k, v in urllib.parse.parse_qs(parsed_path.query).items()}
|
||||||
is_success = False
|
is_success = False
|
||||||
try:
|
try:
|
||||||
self.server.callback(parts)
|
self.server.callback(parts)
|
||||||
@@ -48,8 +48,6 @@ class AuthHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
self.end_headers()
|
self.end_headers()
|
||||||
# send error
|
# send error
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if is_success:
|
if is_success:
|
||||||
self.server.stop()
|
self.server.stop()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user