diff --git a/webgoat-container/src/main/java/org/owasp/webgoat/assignments/AssignmentEndpoint.java b/webgoat-container/src/main/java/org/owasp/webgoat/assignments/AssignmentEndpoint.java index b316f40ee..15b9415c0 100644 --- a/webgoat-container/src/main/java/org/owasp/webgoat/assignments/AssignmentEndpoint.java +++ b/webgoat-container/src/main/java/org/owasp/webgoat/assignments/AssignmentEndpoint.java @@ -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. - *
- * Extend this class and implement the met - * - * 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) { @@ -68,21 +57,21 @@ public abstract class AssignmentEndpoint { userTrackerRepository.save(userTracker); return attackResult; } - - protected WebSession getWebSession() { - return webSession; - } - protected UserSessionData getUserSessionData() { + protected WebSession getWebSession() { + return webSession; + } + + protected UserSessionData getUserSessionData() { return userSessionData; } /** * Convenience method for create a successful result: - * + ** - Assignment is set to solved * - Feedback message is set to 'assignment.solved' - * + *
* 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: - * + *
* - Assignment is set to not solved * - Feedback message is set to 'assignment.not.solved' - * + *
* Of course you can overwrite these values in a specific lesson * * @return a builder for creating a result from a lesson