Review comment

This commit is contained in:
Nanne Baars 2019-09-24 07:36:49 +02:00
parent dad9c75ee0
commit d080b3ef06

View File

@ -27,34 +27,23 @@ package org.owasp.webgoat.assignments;
import lombok.Getter;
import org.owasp.webgoat.i18n.PluginMessages;
import org.owasp.webgoat.session.UserSessionData;
import org.owasp.webgoat.session.WebSession;
import org.owasp.webgoat.users.UserTracker;
import org.owasp.webgoat.users.UserTrackerRepository;
import org.owasp.webgoat.session.WebSession;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Each lesson can define an endpoint which can support the lesson. So for example if you create a lesson which uses JavaScript and
* needs to call out to the server to fetch data you can define an endpoint in that lesson. WebGoat will pick up this endpoint and
* Spring will publish it.
* </p>
* Extend this class and implement the met
* </p>
* Note: each subclass should declare this annotation otherwise the WebGoat framework cannot find your endpoint.
*/
//TODO: rename to assignment
public abstract class AssignmentEndpoint {
@Autowired
private UserTrackerRepository userTrackerRepository;
@Autowired
private WebSession webSession;
private WebSession webSession;
@Autowired
private UserSessionData userSessionData;
@Getter
@Autowired
private PluginMessages messages;
//// TODO: 11/13/2016 events better fit?
protected AttackResult trackProgress(AttackResult attackResult) {
UserTracker userTracker = userTrackerRepository.findByUser(webSession.getUserName());
if (userTracker == null) {
@ -70,19 +59,19 @@ public abstract class AssignmentEndpoint {
}
protected WebSession getWebSession() {
return webSession;
}
return webSession;
}
protected UserSessionData getUserSessionData() {
protected UserSessionData getUserSessionData() {
return userSessionData;
}
/**
* Convenience method for create a successful result:
*
* <p>
* - Assignment is set to solved
* - Feedback message is set to 'assignment.solved'
*
* <p>
* Of course you can overwrite these values in a specific lesson
*
* @return a builder for creating a result from a lesson
@ -93,10 +82,10 @@ public abstract class AssignmentEndpoint {
/**
* Convenience method for create a failed result:
*
* <p>
* - Assignment is set to not solved
* - Feedback message is set to 'assignment.not.solved'
*
* <p>
* Of course you can overwrite these values in a specific lesson
*
* @return a builder for creating a result from a lesson