Fix -p and -u flags

This commit is contained in:
I-Al-Istannen 2021-04-29 00:15:12 +02:00
parent 2ca1101326
commit 2bd40a5f30

View File

@ -26,9 +26,10 @@ _LOGGER = logging.getLogger("sync_url")
_PRETTY = PrettyLogger(_LOGGER) _PRETTY = PrettyLogger(_LOGGER)
def _extract_credentials(file_path: Optional[str]) -> UserPassAuthenticator: def _extract_credentials(file_path: Optional[str],
username: Optional[str], password: Optional[str]) -> UserPassAuthenticator:
if not file_path: if not file_path:
return UserPassAuthenticator("KIT ILIAS Shibboleth", None, None) return UserPassAuthenticator("KIT ILIAS Shibboleth", username, password)
if not Path(file_path).exists(): if not Path(file_path).exists():
_PRETTY.error("Credential file does not exist") _PRETTY.error("Credential file does not exist")
@ -96,7 +97,7 @@ def main() -> None:
"KIT ILIAS Shibboleth", username=args.username, password=args.password "KIT ILIAS Shibboleth", username=args.username, password=args.password
) )
else: else:
inner_auth = _extract_credentials(args.credential_file) inner_auth = _extract_credentials(args.credential_file, args.username, args.password)
username, password = inner_auth.get_credentials() username, password = inner_auth.get_credentials()
authenticator = KitShibbolethAuthenticator(inner_auth) authenticator = KitShibbolethAuthenticator(inner_auth)