Better SSO login experience
This commit is contained in:
parent
24291804a2
commit
132c85c1fd
6
rpc.py
6
rpc.py
@ -140,6 +140,9 @@ class ClientSync(object):
|
|||||||
return res
|
return res
|
||||||
def authenticate(self, identity: str, *, context=('XUS SIGNON',)):
|
def authenticate(self, identity: str, *, context=('XUS SIGNON',)):
|
||||||
self._server.update(RecordServerInfo(*self('XUS SIGNON SETUP', '', '1', context=context))._asdict())
|
self._server.update(RecordServerInfo(*self('XUS SIGNON SETUP', '', '1', context=context))._asdict())
|
||||||
|
if identity.startswith('<?xml version="1.0" encoding="UTF-8"?>'):
|
||||||
|
res = self('XUS ESSO VALIDATE', RPCType(tuple(identity[i:i+200] for i in range(0, len(identity), 200)), RPCType.GLOBAL))
|
||||||
|
else:
|
||||||
res = self('XUS AV CODE', XWBHash_encrypt(identity))
|
res = self('XUS AV CODE', XWBHash_encrypt(identity))
|
||||||
if res[0] == '0' or res[2] != '0':
|
if res[0] == '0' or res[2] != '0':
|
||||||
raise RPCExcAuth(res[3], res)
|
raise RPCExcAuth(res[3], res)
|
||||||
@ -217,6 +220,9 @@ class ClientAsync(object):
|
|||||||
return res
|
return res
|
||||||
async def authenticate(self, identity: str, *, context=('XUS SIGNON',)):
|
async def authenticate(self, identity: str, *, context=('XUS SIGNON',)):
|
||||||
self._server.update(RecordServerInfo(*await self('XUS SIGNON SETUP', '', '1', context=context))._asdict())
|
self._server.update(RecordServerInfo(*await self('XUS SIGNON SETUP', '', '1', context=context))._asdict())
|
||||||
|
if identity.startswith('<?xml version="1.0" encoding="UTF-8"?>'):
|
||||||
|
res = await self('XUS ESSO VALIDATE', RPCType(tuple(identity[i:i+200] for i in range(0, len(identity), 200)), RPCType.GLOBAL))
|
||||||
|
else:
|
||||||
res = await self('XUS AV CODE', XWBHash_encrypt(identity))
|
res = await self('XUS AV CODE', XWBHash_encrypt(identity))
|
||||||
if res[0] == '0' or res[2] != '0':
|
if res[0] == '0' or res[2] != '0':
|
||||||
raise RPCExcAuth(res[3], res)
|
raise RPCExcAuth(res[3], res)
|
||||||
|
Loading…
Reference in New Issue
Block a user