Send CSRF token to Shibboleth

This commit is contained in:
I-Al-Istannen 2020-12-30 14:34:11 +01:00
parent 9b048a9cfc
commit 2714ac6be6

View File

@ -74,6 +74,8 @@ class KitShibbolethAuthenticator(IliasAuthenticator):
form = soup.find("form", {"class": "full content", "method": "post"}) form = soup.find("form", {"class": "full content", "method": "post"})
action = form["action"] action = form["action"]
csrf_token = form.find("input", {"name": "csrf_token"})["value"]
# Equivalent: Enter credentials in # Equivalent: Enter credentials in
# https://idp.scc.kit.edu/idp/profile/SAML2/Redirect/SSO # https://idp.scc.kit.edu/idp/profile/SAML2/Redirect/SSO
LOGGER.debug("Attempt to log in to Shibboleth using credentials") LOGGER.debug("Attempt to log in to Shibboleth using credentials")
@ -82,6 +84,7 @@ class KitShibbolethAuthenticator(IliasAuthenticator):
"_eventId_proceed": "", "_eventId_proceed": "",
"j_username": self._auth.username, "j_username": self._auth.username,
"j_password": self._auth.password, "j_password": self._auth.password,
"csrf_token": csrf_token
} }
soup = soupify(sess.post(url, data=data)) soup = soupify(sess.post(url, data=data))