Review comment

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

View File

@ -27,21 +27,11 @@ package org.owasp.webgoat.assignments;
import lombok.Getter; import lombok.Getter;
import org.owasp.webgoat.i18n.PluginMessages; import org.owasp.webgoat.i18n.PluginMessages;
import org.owasp.webgoat.session.UserSessionData; import org.owasp.webgoat.session.UserSessionData;
import org.owasp.webgoat.session.WebSession;
import org.owasp.webgoat.users.UserTracker; import org.owasp.webgoat.users.UserTracker;
import org.owasp.webgoat.users.UserTrackerRepository; import org.owasp.webgoat.users.UserTrackerRepository;
import org.owasp.webgoat.session.WebSession;
import org.springframework.beans.factory.annotation.Autowired; 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 { public abstract class AssignmentEndpoint {
@Autowired @Autowired
@ -54,7 +44,6 @@ public abstract class AssignmentEndpoint {
@Autowired @Autowired
private PluginMessages messages; private PluginMessages messages;
//// TODO: 11/13/2016 events better fit?
protected AttackResult trackProgress(AttackResult attackResult) { protected AttackResult trackProgress(AttackResult attackResult) {
UserTracker userTracker = userTrackerRepository.findByUser(webSession.getUserName()); UserTracker userTracker = userTrackerRepository.findByUser(webSession.getUserName());
if (userTracker == null) { if (userTracker == null) {
@ -79,10 +68,10 @@ public abstract class AssignmentEndpoint {
/** /**
* Convenience method for create a successful result: * Convenience method for create a successful result:
* * <p>
* - Assignment is set to solved * - Assignment is set to solved
* - Feedback message is set to 'assignment.solved' * - Feedback message is set to 'assignment.solved'
* * <p>
* Of course you can overwrite these values in a specific lesson * Of course you can overwrite these values in a specific lesson
* *
* @return a builder for creating a result from a 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: * Convenience method for create a failed result:
* * <p>
* - Assignment is set to not solved * - Assignment is set to not solved
* - Feedback message is set to 'assignment.not.solved' * - Feedback message is set to 'assignment.not.solved'
* * <p>
* Of course you can overwrite these values in a specific lesson * Of course you can overwrite these values in a specific lesson
* *
* @return a builder for creating a result from a lesson * @return a builder for creating a result from a lesson