Skip to content

Commit

Permalink
Merge pull request #53 from Alcoinus/patch-1
Browse files Browse the repository at this point in the history
Added csrf_token to login POST (KIT)

Since recently the login to KIT ILIAS failed due to the csrf_token missing in the POST to idp.scc.kit.edu (see #52). These changes fixed it for me.
  • Loading branch information
DeOldSax authored Jan 6, 2021
2 parents 486f315 + 69c07b5 commit c7ca12a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/plugin/KITIlias.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ public LoginStatus login(String username, String password) {

Document doc = Jsoup.parse(html);
Element form = doc.select("form[action*=idp").first();
Element csrf = doc.select("[name=csrf_token]").first();

post = new HttpPost("https://idp.scc.kit.edu" + form.attr("action"));
nvps.add(new BasicNameValuePair("_eventId_proceed", ""));
nvps.add(new BasicNameValuePair("j_username", username));
nvps.add(new BasicNameValuePair("j_password", password));
nvps.add(new BasicNameValuePair("csrf_token", csrf.attr("value")));
post.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8));

executePost();
Expand Down

0 comments on commit c7ca12a

Please sign in to comment.