Skip to content

Commit

Permalink
Add password to windows session user
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Luttrell <[email protected]>
  • Loading branch information
roblutt committed Oct 11, 2023
1 parent fb07f18 commit b2c5a67
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/openjd/sessions/_session_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ class WindowsSessionUser(SessionUser):
group: str
"""
Group name of the identity to run the Session's subprocesses under.
This can be just a group name for a local group, or a domain group in down-level format.
This can be just a group name for a local group, or a domain group in down-level logon form.
ex: localGroup, domain\\domainGroup
"""

password: str
"""
Password of the identity to run the Session's subprocess under.
"""

@staticmethod
def is_domain_joined() -> bool:
"""
Expand All @@ -76,7 +81,7 @@ def is_domain_joined() -> bool:
_, join_status = win32net.NetGetJoinInformation()
return join_status != win32netcon.NetSetupUnjoined

def __init__(self, user: str, *, group: str) -> None:
def __init__(self, user: str, password: str, *, group: str) -> None:
"""
Arguments:
user (str): User name of the identity to run the Session's subprocesses under.
Expand All @@ -85,11 +90,13 @@ def __init__(self, user: str, *, group: str) -> None:
group (str): Group name of the identity to run the Session's subprocesses under.
This can be just a group name for a local group, or a domain group in down-level format.
ex: localGroup, domain\\domainGroup
password (str): Password of the identity to run the Session's subprocess under.
"""
if not is_windows():
raise RuntimeError("Only available on Windows systems.")

self.group = group
self.password = password

if "@" in user and self.is_domain_joined():
user = win32security.TranslateName(
Expand Down

0 comments on commit b2c5a67

Please sign in to comment.