only formatting hopefully

This commit is contained in:
i 2026-02-06 17:42:40 +01:00
parent 025c87216d
commit 8ad5f1964e
9 changed files with 241 additions and 198 deletions

View file

@ -10,27 +10,28 @@ class KITProvider(SSOProvider):
domain = "kit.edu"
def authenticate(self) -> str:
self.session.headers.pop('x-requested-with', None)
self.session.headers.pop('x-inertia', None)
self.session.headers.pop('x-inertia-version', None)
self.session.headers.pop("x-requested-with", None)
self.session.headers.pop("x-inertia", None)
self.session.headers.pop("x-inertia-version", None)
csrf_token = extract_html_value(
self.redirect_response.text,
r'name="csrf_token" value="([^"]+)"'
self.redirect_response.text, r'name="csrf_token" value="([^"]+)"'
)
response = self.session.post(
'https://idp.scc.kit.edu/idp/profile/SAML2/Redirect/SSO?execution=e1s1',
"https://idp.scc.kit.edu/idp/profile/SAML2/Redirect/SSO?execution=e1s1",
data={
'csrf_token': csrf_token,
'j_username': self.username,
'j_password': self.password,
'_eventId_proceed': '',
'fudis_web_authn_assertion_input': '',
}
"csrf_token": csrf_token,
"j_username": self.username,
"j_password": self.password,
"_eventId_proceed": "",
"fudis_web_authn_assertion_input": "",
},
)
if "/consume" not in html.unescape(response.text):
raise ValueError("KIT authentication failed - invalid credentials or SSO error")
raise ValueError(
"KIT authentication failed - invalid credentials or SSO error"
)
return response.text