mirror of
https://github.com/ysoftdevs/oauth-playground-server.git
synced 2026-03-22 00:59:51 +01:00
34 lines
967 B
Java
34 lines
967 B
Java
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);
|
|
}
|
|
}
|