WIP
This commit is contained in:
parent
f2ab5c1968
commit
1ebd50cb5b
@ -36,6 +36,8 @@ public class JWTLessonTest extends IntegrationTest {
|
|||||||
|
|
||||||
startLesson("JWT");
|
startLesson("JWT");
|
||||||
|
|
||||||
|
decodingToken();
|
||||||
|
|
||||||
resetVotes();
|
resetVotes();
|
||||||
|
|
||||||
findPassword();
|
findPassword();
|
||||||
@ -74,6 +76,31 @@ public class JWTLessonTest extends IntegrationTest {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void decodingToken() throws IOException, NoSuchAlgorithmException, InvalidKeyException {
|
||||||
|
|
||||||
|
String accessToken = RestAssured.given()
|
||||||
|
.when()
|
||||||
|
.relaxedHTTPSValidation()
|
||||||
|
.cookie("JSESSIONID", getWebGoatCookie())
|
||||||
|
.get(url("/WebGoat/JWT/secret/gettoken"))
|
||||||
|
.then()
|
||||||
|
.extract().response().asString();
|
||||||
|
|
||||||
|
String secret = getSecretToken(accessToken);
|
||||||
|
|
||||||
|
MatcherAssert.assertThat(
|
||||||
|
RestAssured.given()
|
||||||
|
.when()
|
||||||
|
.relaxedHTTPSValidation()
|
||||||
|
.cookie("JSESSIONID", getWebGoatCookie())
|
||||||
|
.formParam("token", generateToken(secret))
|
||||||
|
.post(url("/WebGoat/JWT/secret"))
|
||||||
|
.then()
|
||||||
|
.statusCode(200)
|
||||||
|
.extract().path("lessonCompleted"), CoreMatchers.is(true));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void findPassword() throws IOException, NoSuchAlgorithmException, InvalidKeyException {
|
private void findPassword() throws IOException, NoSuchAlgorithmException, InvalidKeyException {
|
||||||
|
|
||||||
String accessToken = RestAssured.given()
|
String accessToken = RestAssured.given()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user