test of Auth Code Grant flow

This commit is contained in:
Dusan Jakub
2023-09-18 16:25:54 +02:00
parent 650dbdb074
commit 641927387c
4 changed files with 186 additions and 50 deletions

View File

@@ -0,0 +1,33 @@
package com.ysoft.geecon.helpers;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.FormElement;
import java.io.IOException;
public class LoginScreen {
private final FormElement form;
public LoginScreen(Document doc) {
this.form = doc.expectForm("form");
;
}
public Document submit(String username, String password) throws IOException {
form.getElementsByAttributeValue("name", "username").val(username);
form.getElementsByAttributeValue("name", "password").val(password);
return form.submit().post();
}
public ConsentScreen submitCorrect(String username, String password) throws IOException {
Document posted = submit(username, password);
return new ConsentScreen(posted);
}
public LoginScreen submitWrong(String username, String password) throws IOException {
Document posted = submit(username, password);
return new LoginScreen(posted);
}
}