Fixed sessions providers for html5rdp

This commit is contained in:
Adolfo Gómez García 2021-12-22 14:04:49 +01:00
parent 36acb0b0c0
commit 8be0d9702a

View File

@ -362,24 +362,20 @@ class HTML5RDPTransport(transports.Transport):
user: 'models.User', user: 'models.User',
password: str, password: str,
) -> typing.Mapping[str, str]: ) -> typing.Mapping[str, str]:
host: str = '' username = user.getUsernameForAuth()
username: str = ''
passwd: str = ''
# Maybe this is called from another provider, as for example WYSE, that need all connections BEFORE # Maybe this is called from another provider, as for example WYSE, that need all connections BEFORE
if isinstance(userService, models.UserService): if isinstance(userService, models.UserService):
conDatta = userService.getInstance().getConnectionData() # type: ignore # available only for RDS services cdata = userService.getInstance().getConnectionData()
if not conDatta: if cdata:
raise Exception('Invalid connection data received!') _, username, password = cdata # Host is unused
host, username, passwd = conDatta if self.fixedPassword.value != '':
password = self.fixedPassword.value
# if no password is provided from service, use "user" one if self.fixedName.value != '':
if passwd is None: username = self.fixedName.value
passwd = password
if username is None:
username = user.getUsernameForAuth()
proc = username.split('@') proc = username.split('@')
if len(proc) > 1: if len(proc) > 1:
@ -388,6 +384,9 @@ class HTML5RDPTransport(transports.Transport):
domain = '' domain = ''
username = proc[0] username = proc[0]
azureAd = False
if self.fixedDomain.value != '': if self.fixedDomain.value != '':
domain = self.fixedDomain.value domain = self.fixedDomain.value
@ -402,14 +401,13 @@ class HTML5RDPTransport(transports.Transport):
domain = '' domain = ''
# Fix username/password acording to os manager # Fix username/password acording to os manager
username, passwd = userService.processUserPassword(username, passwd) username, password = userService.processUserPassword(username, password)
return { return {
'protocol': self.protocol, 'protocol': self.protocol,
'username': username, 'username': username,
'password': passwd, 'password': password,
'domain': domain, 'domain': domain,
'host': host,
} }
def getLink( # pylint: disable=too-many-locals def getLink( # pylint: disable=too-many-locals