Skip to content

Commit

Permalink
Merge pull request WebGoat#188 from dougmorato/master
Browse files Browse the repository at this point in the history
Fixining all the javadoc issues preventing the release
  • Loading branch information
dougmorato committed Feb 1, 2016
2 parents 35a3977 + 6320c2d commit 61d8e20
Show file tree
Hide file tree
Showing 43 changed files with 215 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ protected WebSession updateSession(HttpServletRequest request, HttpServletRespon
*
* @param s Description of the Parameter
* @param screen a {@link org.owasp.webgoat.session.Screen} object.
* @param screen a {@link org.owasp.webgoat.session.Screen} object.
* @param response Description of the Parameter
* @exception IOException Description of the Exception
* @throws java.io.IOException if any.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ public class WebGoatServletListener implements ServletContextListener {

private static final Logger logger = LoggerFactory.getLogger(HammerHead.class);

/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
@Override
public void contextInitialized(ServletContextEvent sce) {
ServletContext context = sce.getServletContext();
Expand Down Expand Up @@ -80,9 +78,7 @@ private void loadPlugins(ServletContextEvent sce) {
new PluginsLoader(Paths.get(pluginPath), Paths.get(targetPath)).loadPlugins();
}

/**
* {@inheritDoc}
*/
/** {@inheritDoc} */
@Override
public void contextDestroyed(ServletContextEvent sce) {
ServletContext context = sce.getServletContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ public Category getCategory() {

/**
* <p>getSubmitMethod</p>
*
* @return a {@link java.lang.String} object.
*/
public abstract String getSubmitMethod();

Expand Down Expand Up @@ -647,12 +649,14 @@ public String getLink() {
.append("/").append(getCategory().getRanking()).toString();
}

/**
/**
* Get the link to the target servlet.
*
* Unlike getLink() this method does not require rendering the output of
* the request to the link in order to execute the servlet's method with
* conventional HTTP query parameters.
*
* @return a {@link java.lang.String} object.
*/
public String getServletLink() {
StringBuffer link = new StringBuffer("attack");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ protected boolean getDefaultHidden() {
}

/**
* Initiates lesson restart functionality. Lessons should override this for
* lesson specific actions
* Initiates lesson restart functionality. Lessons should override this for
* lesson specific actions
*/
public void restartLesson() {
// Do Nothing - called when restart lesson is pressed. Each lesson can do something
Expand Down Expand Up @@ -153,6 +153,8 @@ protected List<String> getHints(WebSession s) {

/**
* provide a default submitMethod of lesson does not implement
*
* @return a {@link java.lang.String} object.
*/
public String getSubmitMethod() {
return "GET";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/***************************************************************************************************
/**
*************************************************************************************************
* This file is part of WebGoat, an Open Web Application Security Project utility. For details,
* please see http://www.owasp.org/
* <p>
Expand All @@ -26,8 +27,10 @@
* Source for this application is maintained at https://github.com/WebGoat/WebGoat, a repository for free software
* projects.
* <p>
*
* @author Nanne Baars
* @created December 12, 2015
* @since December 12, 2015
* @version $Id: $Id
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface LessonServletMapping {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* <p>Abstract RandomLessonAdapter class.</p>
*
* @version $Id: $Id
* @author dm
*/
public abstract class RandomLessonAdapter extends LessonAdapter
{
Expand All @@ -30,6 +31,7 @@ public abstract class RandomLessonAdapter extends LessonAdapter
*
* @param s a {@link org.owasp.webgoat.session.WebSession} object.
* @param stage a {@link java.lang.String} object.
* @param stage a {@link java.lang.String} object.
*/
public void setStage(WebSession s, String stage)
{
Expand Down Expand Up @@ -65,6 +67,7 @@ public String getStage(WebSession s)
*
* @param s a {@link org.owasp.webgoat.session.WebSession} object.
* @param stage a {@link java.lang.String} object.
* @param stage a {@link java.lang.String} object.
*/
public void setStageComplete(WebSession s, String stage)
{
Expand Down Expand Up @@ -100,6 +103,7 @@ public void setStageComplete(WebSession s, String stage)
*
* @param s a {@link org.owasp.webgoat.session.WebSession} object.
* @param stage a {@link java.lang.String} object.
* @param stage a {@link java.lang.String} object.
* @return a boolean.
*/
public boolean isStageComplete(WebSession s, String stage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* <p>Abstract SequentialLessonAdapter class.</p>
*
* @version $Id: $Id
* @author dm
*/
public abstract class SequentialLessonAdapter extends LessonAdapter
{
Expand All @@ -22,6 +23,7 @@ public abstract class SequentialLessonAdapter extends LessonAdapter
*
* @param s a {@link org.owasp.webgoat.session.WebSession} object.
* @param stage a int.
* @param stage a int.
*/
public void setStage(WebSession s, int stage)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected Category getDefaultCategory()
/**
* <p>getDefaultRanking.</p>
*
* @return a {@link Integer} object.
* @return a {@link java.lang.Integer} object.
*/
protected Integer getDefaultRanking()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
* use for more complex lessons.
*
* @version $Id: $Id
* @author dm
*/
public class HttpBasicsModel {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
import org.owasp.webgoat.lessons.Category;
import org.owasp.webgoat.session.WebSession;

/**
* <p>LessonInfoModel class.</p>
*
* @author dm
* @version $Id: $Id
*/
public class LessonInfoModel {

private String lessonTitle;
Expand All @@ -13,6 +19,11 @@ public class LessonInfoModel {
private boolean hasPlan;
private String submitMethod;

/**
* <p>Constructor for LessonInfoModel.</p>
*
* @param webSession a {@link org.owasp.webgoat.session.WebSession} object.
*/
public LessonInfoModel(WebSession webSession) {
AbstractLesson lesson = webSession.getCurrentLesson();
//TODO make these first class citizens of the lesson itself; and stop passing the session all over ... and generally tighten the checks up
Expand All @@ -36,26 +47,56 @@ public LessonInfoModel(WebSession webSession) {
}

// GETTERS
/**
* <p>Getter for the field <code>lessonTitle</code>.</p>
*
* @return a {@link java.lang.String} object.
*/
public String getLessonTitle() {
return lessonTitle;
}

/**
* <p>Getter for the field <code>numberHints</code>.</p>
*
* @return a int.
*/
public int getNumberHints() {
return numberHints;
}

/**
* <p>isHasSource.</p>
*
* @return a boolean.
*/
public boolean isHasSource() {
return hasSource;
}

/**
* <p>isHasSolution.</p>
*
* @return a boolean.
*/
public boolean isHasSolution() {
return hasSolution;
}

/**
* <p>isHasPlan.</p>
*
* @return a boolean.
*/
public boolean isHasPlan() {
return hasPlan;
}

/**
* <p>Getter for the field <code>submitMethod</code>.</p>
*
* @return a {@link java.lang.String} object.
*/
public String getSubmitMethod() {
return submitMethod;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* <p>Plugin class.</p>
*
* @version $Id: $Id
* @author dm
*/
public class Plugin {

Expand All @@ -34,6 +35,11 @@ public class Plugin {
private List<File> pluginFiles = Lists.newArrayList();
private File lessonSourceFile;

/**
* <p>findLesson.</p>
*
* @param classes a {@link java.util.List} object.
*/
public void findLesson(List<String> classes) {
for (String clazzName : classes) {
findLesson(clazzName);
Expand All @@ -56,6 +62,11 @@ private void findLesson(String name) {
}
}

/**
* <p>loadFiles.</p>
*
* @param file a {@link java.nio.file.Path} object.
*/
public void loadFiles(Path file) {
if (fileEndsWith(file, ".html") && hasParentDirectoryWithName(file, NAME_LESSON_SOLUTION_DIRECTORY)) {
solutionLanguageFiles.put(file.getParent().getFileName().toString(), file.toFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@
/**
* Extract the jar file and place them in the system temp directory in the folder webgoat and collect the files
* and classes.
*
* @author dm
* @version $Id: $Id
*/
public class PluginExtractor {

private final List<String> classes = Lists.newArrayList();
private final List<Path> files = new ArrayList<>();

/**
* <p>extractJarFile.</p>
*
* @param archive a {@link java.io.File} object.
* @param targetDirectory a {@link java.io.File} object.
* @return a {@link org.owasp.webgoat.plugins.Plugin} object.
* @throws java.io.IOException if any.
*/
public Plugin extractJarFile(final File archive, final File targetDirectory) throws IOException {
ZipFile zipFile = new ZipFile(archive);
Plugin plugin = new Plugin();
Expand Down Expand Up @@ -88,11 +99,21 @@ private File copyFile(ZipFile zipFile, ZipEntry zipEntry, File targetFile, boole
return targetFile;
}

/**
* <p>Getter for the field <code>classes</code>.</p>
*
* @return a {@link java.util.List} object.
*/
public List<String> getClasses() {
return this.classes;
}

/**
* <p>Getter for the field <code>files</code>.</p>
*
* @return a {@link java.util.List} object.
*/
public List<Path> getFiles() {
return this.files;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* <p>PluginFileUtils class.</p>
*
* @version $Id: $Id
* @author dm
*/
public class PluginFileUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* <p>PluginLoadingFailure class.</p>
*
* @version $Id: $Id
* @author dm
*/
public class PluginLoadingFailure extends RuntimeException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* <p>PluginsLoader class.</p>
*
* @version $Id: $Id
* @author dm
*/
public class PluginsLoader {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class LabelDebugService extends BaseService {

/**
* Reload all the plugins
*
* @return a {@link org.springframework.http.ResponseEntity} object.
*/
@RequestMapping(value = "/debug/labels.mvc")
public @ResponseBody
Expand Down
Loading

0 comments on commit 61d8e20

Please sign in to comment.