Skip to content

Commit

Permalink
Delombok the sources
Browse files Browse the repository at this point in the history
  • Loading branch information
vlkl-sap committed Nov 24, 2021
1 parent 36bdd9b commit 02a5131
Show file tree
Hide file tree
Showing 78 changed files with 2,606 additions and 1,160 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

// Generated by delombok at Sun Nov 21 11:47:17 UTC 2021
/**
* ************************************************************************************************
* This file is part of WebGoat, an Open Web Application Security Project utility. For details,
Expand Down Expand Up @@ -28,10 +28,8 @@
* @version $Id: $Id
* @since December 12, 2015
*/

package org.owasp.webgoat;

import lombok.extern.slf4j.Slf4j;
import org.asciidoctor.Asciidoctor;
import org.asciidoctor.extension.JavaExtensionRegistry;
import org.owasp.webgoat.asciidoc.*;
Expand All @@ -40,15 +38,13 @@
import org.thymeleaf.templateresolver.FileTemplateResolver;
import org.thymeleaf.templateresource.ITemplateResource;
import org.thymeleaf.templateresource.StringTemplateResource;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import static org.asciidoctor.Asciidoctor.Factory.create;

/**
Expand All @@ -58,9 +54,9 @@
* <div th:replace="doc:AccessControlMatrix_plan.adoc"></div>
* </code>
*/
@Slf4j
public class AsciiDoctorTemplateResolver extends FileTemplateResolver {

@java.lang.SuppressWarnings("all")
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(AsciiDoctorTemplateResolver.class);
private static final Asciidoctor asciidoctor = create();
private static final String PREFIX = "doc:";
private final Language language;
Expand All @@ -85,7 +81,6 @@ protected ITemplateResource computeTemplateResource(IEngineConfiguration configu
extensionRegistry.inlineMacro("webGoatTempDir", WebGoatTmpDirMacro.class);
extensionRegistry.inlineMacro("operatingSystem", OperatingSystemMacro.class);
extensionRegistry.inlineMacro("username", UsernameMacro.class);

StringWriter writer = new StringWriter();
asciidoctor.convert(new InputStreamReader(is), writer, createAttributes());
return new StringTemplateResource(writer.getBuffer().toString());
Expand Down Expand Up @@ -117,10 +112,8 @@ private Map<String, Object> createAttributes() {
attributes.put("source-highlighter", "coderay");
attributes.put("backend", "xhtml");
attributes.put("icons", org.asciidoctor.Attributes.FONT_ICONS);

Map<String, Object> options = new HashMap<>();
options.put("attributes", attributes);

return options;
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Generated by delombok at Sun Nov 21 11:47:17 UTC 2021
package org.owasp.webgoat;

import lombok.AllArgsConstructor;
import org.owasp.webgoat.session.Course;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

Expand Down Expand Up @@ -46,9 +45,7 @@
* @since October 28, 2003
*/
@Controller
@AllArgsConstructor
public class HammerHead {

private final Course course;

/**
Expand All @@ -58,4 +55,9 @@ public class HammerHead {
public ModelAndView attack(Authentication authentication, HttpServletRequest request, HttpServletResponse response) {
return new ModelAndView("redirect:" + "start.mvc" + course.getFirstLesson().getLink());
}

@java.lang.SuppressWarnings("all")
public HammerHead(final Course course) {
this.course = course;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Generated by delombok at Sun Nov 21 11:47:17 UTC 2021
/**
* ************************************************************************************************
* This file is part of WebGoat, an Open Web Application Security Project utility. For details,
Expand Down Expand Up @@ -27,10 +28,8 @@
* @version $Id: $Id
* @since December 12, 2015
*/

package org.owasp.webgoat;

import lombok.AllArgsConstructor;
import org.owasp.webgoat.users.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
Expand All @@ -48,29 +47,16 @@
* Security configuration for WebGoat.
*/
@Configuration
@AllArgsConstructor
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

private final UserService userDetailsService;

@Override
protected void configure(HttpSecurity http) throws Exception {
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry security = http
.authorizeRequests()
.antMatchers("/css/**", "/images/**", "/js/**", "fonts/**", "/plugins/**", "/registration", "/register.mvc", "/actuator/**").permitAll()
.anyRequest().authenticated();
security.and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/welcome.mvc", true)
.usernameParameter("username")
.passwordParameter("password")
.permitAll();
security.and()
.logout().deleteCookies("JSESSIONID").invalidateHttpSession(true);
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry security = http.authorizeRequests().antMatchers("/css/**", "/images/**", "/js/**", "fonts/**", "/plugins/**", "/registration", "/register.mvc", "/actuator/**").permitAll().anyRequest().authenticated();
security.and().formLogin().loginPage("/login").defaultSuccessUrl("/welcome.mvc", true).usernameParameter("username").passwordParameter("password").permitAll();
security.and().logout().deleteCookies("JSESSIONID").invalidateHttpSession(true);
security.and().csrf().disable();

http.headers().cacheControl().disable();
http.exceptionHandling().authenticationEntryPoint(new AjaxAuthenticationEntryPoint("/login"));
}
Expand All @@ -97,4 +83,9 @@ protected AuthenticationManager authenticationManager() throws Exception {
public NoOpPasswordEncoder passwordEncoder() {
return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}
}

@java.lang.SuppressWarnings("all")
public WebSecurityConfig(final UserService userDetailsService) {
this.userDetailsService = userDetailsService;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Generated by delombok at Sun Nov 21 11:47:17 UTC 2021
/*
* This file is part of WebGoat, an Open Web Application Security Project utility. For details,
* please see http://www.owasp.org/
Expand All @@ -22,23 +23,19 @@
* projects.
* <p>
*/

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.UserTrackerRepository;
import org.springframework.beans.factory.annotation.Autowired;

public abstract class AssignmentEndpoint {

@Autowired
private WebSession webSession;
@Autowired
private UserSessionData userSessionData;
@Getter
@Autowired
private PluginMessages messages;

Expand Down Expand Up @@ -83,4 +80,9 @@ protected AttackResult.AttackResultBuilder failed(AssignmentEndpoint assignment)
protected AttackResult.AttackResultBuilder informationMessage(AssignmentEndpoint assignment) {
return AttackResult.builder(messages).lessonCompleted(false).assignment(assignment);
}

@java.lang.SuppressWarnings("all")
public PluginMessages getMessages() {
return this.messages;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Generated by delombok at Sun Nov 21 11:47:17 UTC 2021
/*
* This file is part of WebGoat, an Open Web Application Security Project utility. For details,
* please see http://www.owasp.org/
Expand All @@ -22,18 +23,14 @@
* projects.
* <p>
*/

package org.owasp.webgoat.assignments;

import lombok.Getter;
import org.apache.commons.lang3.StringEscapeUtils;
import org.owasp.webgoat.i18n.PluginMessages;

public class AttackResult {


public static class AttackResultBuilder {

private boolean lessonCompleted;
private PluginMessages messages;
private Object[] feedbackArgs;
Expand Down Expand Up @@ -94,15 +91,10 @@ public AttackResultBuilder assignment(AssignmentEndpoint assignment) {
}
}

@Getter
private boolean lessonCompleted;
@Getter
private String feedback;
@Getter
private String output;
@Getter
private final String assignment;
@Getter
private boolean attemptWasMade;

public AttackResult(boolean lessonCompleted, String feedback, String output, String assignment, boolean attemptWasMade) {
Expand All @@ -120,4 +112,29 @@ public static AttackResultBuilder builder(PluginMessages messages) {
public boolean assignmentSolved() {
return lessonCompleted;
}

@java.lang.SuppressWarnings("all")
public boolean isLessonCompleted() {
return this.lessonCompleted;
}

@java.lang.SuppressWarnings("all")
public String getFeedback() {
return this.feedback;
}

@java.lang.SuppressWarnings("all")
public String getOutput() {
return this.output;
}

@java.lang.SuppressWarnings("all")
public String getAssignment() {
return this.assignment;
}

@java.lang.SuppressWarnings("all")
public boolean isAttemptWasMade() {
return this.attemptWasMade;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Generated by delombok at Sun Nov 21 11:47:17 UTC 2021
/*
* This file is part of WebGoat, an Open Web Application Security Project utility. For details,
* please see http://www.owasp.org/
Expand All @@ -22,14 +23,11 @@
* projects.
* <p>
*/

package org.owasp.webgoat.i18n;

import lombok.AllArgsConstructor;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.LocaleResolver;

import java.util.Locale;

/**
Expand All @@ -39,13 +37,15 @@
* @author nbaars
* @date 2/7/17
*/
@AllArgsConstructor
public class Language {

private final LocaleResolver localeResolver;

public Locale getLocale() {
return localeResolver.resolveLocale(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest());
}

@java.lang.SuppressWarnings("all")
public Language(final LocaleResolver localeResolver) {
this.localeResolver = localeResolver;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Generated by delombok at Sun Nov 21 11:47:17 UTC 2021
/*
* This file is part of WebGoat, an Open Web Application Security Project utility. For details,
* please see http://www.owasp.org/
Expand All @@ -22,12 +23,9 @@
* projects.
* <p>
*/

package org.owasp.webgoat.i18n;

import lombok.AllArgsConstructor;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;

import java.util.Properties;

/**
Expand All @@ -36,9 +34,7 @@
*
* @author zupzup
*/
@AllArgsConstructor
public class Messages extends ReloadableResourceBundleMessageSource {

private final Language language;

/**
Expand All @@ -57,4 +53,9 @@ public String getMessage(String code, Object... args) {
public String getMessage(String code, String defaultValue, Object... args) {
return super.getMessage(code, args, defaultValue, language.getLocale());
}

@java.lang.SuppressWarnings("all")
public Messages(final Language language) {
this.language = language;
}
}
Loading

0 comments on commit 02a5131

Please sign in to comment.