Fix SAML token recognition

This commit is contained in:
Jiang Yio 2023-05-29 18:29:43 -04:00
parent 770a9cfb2e
commit 0f019ebc34

4
rpc.py
View File

@ -144,7 +144,7 @@ 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"?>'): if identity.startswith('<?xml version="1.0"'):
res = self('XUS ESSO VALIDATE', RPCType(tuple(identity[i:i+200] for i in range(0, len(identity), 200)), RPCType.GLOBAL)) res = self('XUS ESSO VALIDATE', RPCType(tuple(identity[i:i+200] for i in range(0, len(identity), 200)), RPCType.GLOBAL))
else: else:
res = self('XUS AV CODE', XWBHash_encrypt(identity)) res = self('XUS AV CODE', XWBHash_encrypt(identity))
@ -225,7 +225,7 @@ 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"?>'): if identity.startswith('<?xml version="1.0"'):
res = await self('XUS ESSO VALIDATE', RPCType(tuple(identity[i:i+200] for i in range(0, len(identity), 200)), RPCType.GLOBAL)) res = await self('XUS ESSO VALIDATE', RPCType(tuple(identity[i:i+200] for i in range(0, len(identity), 200)), RPCType.GLOBAL))
else: else:
res = await self('XUS AV CODE', XWBHash_encrypt(identity)) res = await self('XUS AV CODE', XWBHash_encrypt(identity))