mirror of
https://github.com/Garmelon/PFERD.git
synced 2026-04-12 15:35:05 +02:00
fixed and tested TFA (OTP) for FAU
This commit is contained in:
parent
31d2c86a05
commit
40715d648b
1 changed files with 9 additions and 5 deletions
|
|
@ -96,10 +96,12 @@ class SimpleSAMLLogin:
|
||||||
form = cast(Tag, soup.find("form", {"method": "post"}))
|
form = cast(Tag, soup.find("form", {"method": "post"}))
|
||||||
action = cast(str, form["action"])
|
action = cast(str, form["action"])
|
||||||
|
|
||||||
url = str(saml_url.origin()) + action
|
if action.startswith("https"): # FAU uses full URL here
|
||||||
data = {
|
url = action
|
||||||
"_eventId_proceed": "",
|
else:
|
||||||
"fudis_otp_input": tfa_token,
|
url = str(saml_url.origin()) + action #KIT uses relative URL here
|
||||||
|
data = { # for www.sso.uni-erlangen.de/simplesaml/module.php/mfa/otp?...
|
||||||
|
"otp": tfa_token
|
||||||
}
|
}
|
||||||
if csrf_token_input := form.find("input", {"name": "csrf_token"}):
|
if csrf_token_input := form.find("input", {"name": "csrf_token"}):
|
||||||
data["csrf_token"] = csrf_token_input["value"] # type: ignore
|
data["csrf_token"] = csrf_token_input["value"] # type: ignore
|
||||||
|
|
@ -113,7 +115,9 @@ class SimpleSAMLLogin:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _tfa_required(soup: BeautifulSoup) -> bool:
|
def _tfa_required(soup: BeautifulSoup) -> bool:
|
||||||
return soup.find(id="fudiscr-form") is not None
|
# Also treat a body with id="mfa:otp" as TFA required (for FAU)
|
||||||
|
body = soup.find("body")
|
||||||
|
return body is not None and body.get("id") == "mfa:otp"
|
||||||
|
|
||||||
|
|
||||||
async def _post(session: aiohttp.ClientSession, url: str, data: Any) -> BeautifulSoup:
|
async def _post(session: aiohttp.ClientSession, url: str, data: Any) -> BeautifulSoup:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue