From 51b61e552e451bb06e0c6b813b222963b1bff2cc Mon Sep 17 00:00:00 2001 From: Adrian Milne Date: Wed, 4 Jun 2014 16:33:02 +0100 Subject: [PATCH] initial commit --- spring-security-ldap/README.md | 12 + spring-security-ldap/pom.xml | 266 ++++++++++++++++++ .../persistence/service/FooService.java | 23 ++ .../MyBasicAuthenticationEntryPoint.java | 31 ++ .../java/org/baeldung/spring/MvcConfig.java | 39 +++ .../baeldung/spring/PersistenceConfig.java | 14 + .../baeldung/spring/SecSecurityConfig.java | 16 ++ .../java/org/baeldung/spring/WebConfig.java | 17 ++ .../web/controller/FooController.java | 74 +++++ .../org/baeldung/web/controller/LinkUtil.java | 30 ++ .../web/controller/ResourceCreated.java | 35 +++ ...esourceCreatedDiscoverabilityListener.java | 35 +++ .../controller/SingleResourceRetrieved.java | 29 ++ ...ourceRetrievedDiscoverabilityListener.java | 32 +++ .../web/controller/TestController.java | 28 ++ .../main/java/org/baeldung/web/dto/Foo.java | 11 + .../src/main/resources/logback.xml | 20 ++ .../src/main/resources/webSecurityConfig.xml | 25 ++ .../src/main/webapp/WEB-INF/mvc-servlet.xml | 5 + .../src/main/webapp/WEB-INF/view/homepage.jsp | 7 + .../src/main/webapp/WEB-INF/web.xml | 42 +++ .../src/test/resources/.gitignore | 13 + 22 files changed, 804 insertions(+) create mode 100644 spring-security-ldap/README.md create mode 100644 spring-security-ldap/pom.xml create mode 100644 spring-security-ldap/src/main/java/org/baeldung/persistence/service/FooService.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/security/basic/MyBasicAuthenticationEntryPoint.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/spring/MvcConfig.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/spring/PersistenceConfig.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/spring/SecSecurityConfig.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/spring/WebConfig.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/web/controller/FooController.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/web/controller/LinkUtil.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/web/controller/ResourceCreated.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/web/controller/ResourceCreatedDiscoverabilityListener.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/web/controller/SingleResourceRetrieved.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/web/controller/SingleResourceRetrievedDiscoverabilityListener.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/web/controller/TestController.java create mode 100644 spring-security-ldap/src/main/java/org/baeldung/web/dto/Foo.java create mode 100644 spring-security-ldap/src/main/resources/logback.xml create mode 100644 spring-security-ldap/src/main/resources/webSecurityConfig.xml create mode 100644 spring-security-ldap/src/main/webapp/WEB-INF/mvc-servlet.xml create mode 100644 spring-security-ldap/src/main/webapp/WEB-INF/view/homepage.jsp create mode 100644 spring-security-ldap/src/main/webapp/WEB-INF/web.xml create mode 100644 spring-security-ldap/src/test/resources/.gitignore diff --git a/spring-security-ldap/README.md b/spring-security-ldap/README.md new file mode 100644 index 0000000000..95e45ae519 --- /dev/null +++ b/spring-security-ldap/README.md @@ -0,0 +1,12 @@ +========= + +## Spring Security with Basic Authentication Example Project + + +### Relevant Article: +- [Spring Security - security none, filters none, access permitAll](http://www.baeldung.com/security-none-filters-none-access-permitAll) +- [Spring Security Basic Authentication](http://www.baeldung.com/spring-security-basic-authentication) + + +### Notes +- the project includes both views as well as a REST layer \ No newline at end of file diff --git a/spring-security-ldap/pom.xml b/spring-security-ldap/pom.xml new file mode 100644 index 0000000000..607ddf50d1 --- /dev/null +++ b/spring-security-ldap/pom.xml @@ -0,0 +1,266 @@ + + 4.0.0 + org.baeldung + spring-security-ldap + 0.1-SNAPSHOT + + spring-security-ldap + war + + + + + + + org.springframework.security + spring-security-web + ${org.springframework.security.version} + + + org.springframework.security + spring-security-config + ${org.springframework.security.version} + + + + + + org.springframework + spring-core + ${org.springframework.version} + + + commons-logging + commons-logging + + + + + org.springframework + spring-context + ${org.springframework.version} + + + org.springframework + spring-jdbc + ${org.springframework.version} + + + org.springframework + spring-beans + ${org.springframework.version} + + + org.springframework + spring-aop + ${org.springframework.version} + + + org.springframework + spring-tx + ${org.springframework.version} + + + org.springframework + spring-expression + ${org.springframework.version} + + + + org.springframework + spring-web + ${org.springframework.version} + + + org.springframework + spring-webmvc + ${org.springframework.version} + + + + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + + javax.servlet + jstl + 1.2 + runtime + + + + + + com.google.guava + guava + 14.0.1 + + + + + + org.slf4j + slf4j-api + ${org.slf4j.version} + + + ch.qos.logback + logback-classic + ${logback.version} + + + + org.slf4j + jcl-over-slf4j + ${org.slf4j.version} + + + + org.slf4j + log4j-over-slf4j + ${org.slf4j.version} + + + + + + junit + junit-dep + ${junit.version} + test + + + + org.hamcrest + hamcrest-core + ${org.hamcrest.version} + test + + + org.hamcrest + hamcrest-library + ${org.hamcrest.version} + test + + + + org.mockito + mockito-core + ${mockito.version} + test + + + + + + spring-security-mvc-basic-auth + + + src/main/resources + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 1.7 + 1.7 + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin.version} + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + + + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + ${cargo-maven2-plugin.version} + + true + + jetty8x + embedded + + + + + + + 8082 + + + + + + + + + + + + 4.0.5.RELEASE + 3.2.4.RELEASE + + + 4.3.5.Final + 5.1.30 + + + 1.7.6 + 1.1.1 + + + 5.1.1.Final + + + 17.0 + 3.3.2 + + + 1.3 + 4.11 + 1.9.5 + + 4.3.2 + 4.3.3 + + 2.3.1 + + + 3.1 + 2.4 + 2.17 + 2.6 + 1.4.8 + + + + diff --git a/spring-security-ldap/src/main/java/org/baeldung/persistence/service/FooService.java b/spring-security-ldap/src/main/java/org/baeldung/persistence/service/FooService.java new file mode 100644 index 0000000000..02db7a733a --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/persistence/service/FooService.java @@ -0,0 +1,23 @@ +package org.baeldung.persistence.service; + +import org.baeldung.web.dto.Foo; +import org.springframework.stereotype.Service; + +@Service +public class FooService { + + public FooService() { + super(); + } + + // API + + public Foo getById(final Long id) { + return null; + } + + public Long create(final Foo resource) { + return null; + } + +} diff --git a/spring-security-ldap/src/main/java/org/baeldung/security/basic/MyBasicAuthenticationEntryPoint.java b/spring-security-ldap/src/main/java/org/baeldung/security/basic/MyBasicAuthenticationEntryPoint.java new file mode 100644 index 0000000000..968237227f --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/security/basic/MyBasicAuthenticationEntryPoint.java @@ -0,0 +1,31 @@ +package org.baeldung.security.basic; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint; +import org.springframework.stereotype.Component; + +@Component +public class MyBasicAuthenticationEntryPoint extends BasicAuthenticationEntryPoint { + + @Override + public void commence(final HttpServletRequest request, final HttpServletResponse response, final AuthenticationException authException) throws IOException, ServletException { + response.addHeader("WWW-Authenticate", "Basic realm=\"" + getRealmName() + "\""); + response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); + final PrintWriter writer = response.getWriter(); + writer.println("HTTP Status " + HttpServletResponse.SC_UNAUTHORIZED + " - " + authException.getMessage()); + } + + @Override + public void afterPropertiesSet() throws Exception { + setRealmName("Baeldung"); + super.afterPropertiesSet(); + } + +} diff --git a/spring-security-ldap/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-ldap/src/main/java/org/baeldung/spring/MvcConfig.java new file mode 100644 index 0000000000..74c11478ee --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/spring/MvcConfig.java @@ -0,0 +1,39 @@ +package org.baeldung.spring; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.view.InternalResourceViewResolver; +import org.springframework.web.servlet.view.JstlView; + +@Configuration +@EnableWebMvc +public class MvcConfig extends WebMvcConfigurerAdapter { + + public MvcConfig() { + super(); + } + + // API + + @Override + public void addViewControllers(final ViewControllerRegistry registry) { + super.addViewControllers(registry); + + registry.addViewController("/homepage.html"); + } + + @Bean + public ViewResolver viewResolver() { + final InternalResourceViewResolver bean = new InternalResourceViewResolver(); + + bean.setViewClass(JstlView.class); + bean.setPrefix("/WEB-INF/view/"); + bean.setSuffix(".jsp"); + + return bean; + } +} \ No newline at end of file diff --git a/spring-security-ldap/src/main/java/org/baeldung/spring/PersistenceConfig.java b/spring-security-ldap/src/main/java/org/baeldung/spring/PersistenceConfig.java new file mode 100644 index 0000000000..4ea0053f48 --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/spring/PersistenceConfig.java @@ -0,0 +1,14 @@ +package org.baeldung.spring; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan("org.baeldung.persistence") +public class PersistenceConfig { + + public PersistenceConfig() { + super(); + } + +} diff --git a/spring-security-ldap/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-ldap/src/main/java/org/baeldung/spring/SecSecurityConfig.java new file mode 100644 index 0000000000..4ce80dab9f --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/spring/SecSecurityConfig.java @@ -0,0 +1,16 @@ +package org.baeldung.spring; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.ImportResource; + +@Configuration +@ImportResource({ "classpath:webSecurityConfig.xml" }) +@ComponentScan("org.baeldung.security") +public class SecSecurityConfig { + + public SecSecurityConfig() { + super(); + } + +} diff --git a/spring-security-ldap/src/main/java/org/baeldung/spring/WebConfig.java b/spring-security-ldap/src/main/java/org/baeldung/spring/WebConfig.java new file mode 100644 index 0000000000..fa6f5f6d56 --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/spring/WebConfig.java @@ -0,0 +1,17 @@ +package org.baeldung.spring; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +@Configuration +@ComponentScan("org.baeldung.web") +public class WebConfig extends WebMvcConfigurerAdapter { + + public WebConfig() { + super(); + } + + // API + +} \ No newline at end of file diff --git a/spring-security-ldap/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-ldap/src/main/java/org/baeldung/web/controller/FooController.java new file mode 100644 index 0000000000..daa797ee36 --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/web/controller/FooController.java @@ -0,0 +1,74 @@ +package org.baeldung.web.controller; + +import java.net.URI; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.baeldung.persistence.service.FooService; +import org.baeldung.web.dto.Foo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationEventPublisher; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.util.UriComponentsBuilder; +import org.springframework.web.util.UriTemplate; + +import com.google.common.base.Preconditions; + +@Controller +@RequestMapping(value = "/foo") +public class FooController { + + @Autowired + private ApplicationEventPublisher eventPublisher; + + @Autowired + private FooService service; + + public FooController() { + super(); + } + + // API + + @RequestMapping(value = "/{id}", method = RequestMethod.GET) + @ResponseBody + public Foo findOne(@PathVariable("id") final Long id, final UriComponentsBuilder uriBuilder, final HttpServletResponse response) { + return new Foo(); + } + + @RequestMapping(value = "admin/foo/{id}", method = RequestMethod.GET) + @ResponseBody + public Foo get(@PathVariable("id") final Long id, final HttpServletRequest request, final HttpServletResponse response) { + final Foo resourceById = Preconditions.checkNotNull(service.getById(id)); + + eventPublisher.publishEvent(new SingleResourceRetrieved(this, request, response)); + return resourceById; + } + + @RequestMapping(value = "admin/foo", method = RequestMethod.POST) + @ResponseStatus(HttpStatus.CREATED) + public void create(@RequestBody final Foo resource, final HttpServletRequest request, final HttpServletResponse response) { + Preconditions.checkNotNull(resource); + final Long idOfCreatedResource = service.create(resource); + + eventPublisher.publishEvent(new ResourceCreated(this, request, response, idOfCreatedResource)); + } + + @RequestMapping(value = "admin", method = RequestMethod.GET) + @ResponseStatus(value = HttpStatus.NO_CONTENT) + public void adminRoot(final HttpServletRequest request, final HttpServletResponse response) { + final String rootUri = request.getRequestURL().toString(); + + final URI fooUri = new UriTemplate("{rootUri}/{resource}").expand(rootUri, "foo"); + final String linkToFoo = LinkUtil.createLinkHeader(fooUri.toASCIIString(), "collection"); + response.addHeader("Link", linkToFoo); + } +} diff --git a/spring-security-ldap/src/main/java/org/baeldung/web/controller/LinkUtil.java b/spring-security-ldap/src/main/java/org/baeldung/web/controller/LinkUtil.java new file mode 100644 index 0000000000..a41ebb5a5c --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/web/controller/LinkUtil.java @@ -0,0 +1,30 @@ +package org.baeldung.web.controller; + +import javax.servlet.http.HttpServletResponse; + +/** + * Provides some constants and utility methods to build a Link Header to be stored in the {@link HttpServletResponse} object + */ +public final class LinkUtil { + + private LinkUtil() { + throw new AssertionError(); + } + + // + + /** + * Creates a Link Header to be stored in the {@link HttpServletResponse} to provide Discoverability features to the user + * + * @param uri + * the base uri + * @param rel + * the relative path + * + * @return the complete url + */ + public static String createLinkHeader(final String uri, final String rel) { + return "<" + uri + ">; rel=\"" + rel + "\""; + } + +} diff --git a/spring-security-ldap/src/main/java/org/baeldung/web/controller/ResourceCreated.java b/spring-security-ldap/src/main/java/org/baeldung/web/controller/ResourceCreated.java new file mode 100644 index 0000000000..a677888101 --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/web/controller/ResourceCreated.java @@ -0,0 +1,35 @@ +package org.baeldung.web.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.context.ApplicationEvent; + +public class ResourceCreated extends ApplicationEvent { + private final HttpServletResponse response; + private final HttpServletRequest request; + private final long idOfNewResource; + + public ResourceCreated(final Object source, final HttpServletRequest request, final HttpServletResponse response, final long idOfNewResource) { + super(source); + + this.request = request; + this.response = response; + this.idOfNewResource = idOfNewResource; + } + + // API + + public HttpServletResponse getResponse() { + return response; + } + + public HttpServletRequest getRequest() { + return request; + } + + public long getIdOfNewResource() { + return idOfNewResource; + } + +} diff --git a/spring-security-ldap/src/main/java/org/baeldung/web/controller/ResourceCreatedDiscoverabilityListener.java b/spring-security-ldap/src/main/java/org/baeldung/web/controller/ResourceCreatedDiscoverabilityListener.java new file mode 100644 index 0000000000..8d19ef82fc --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/web/controller/ResourceCreatedDiscoverabilityListener.java @@ -0,0 +1,35 @@ +package org.baeldung.web.controller; + +import java.net.URI; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; +import org.springframework.web.util.UriTemplate; + +import com.google.common.base.Preconditions; +import com.google.common.net.HttpHeaders; + +@Component +class ResourceCreatedDiscoverabilityListener implements ApplicationListener { + + @Override + public void onApplicationEvent(final ResourceCreated resourceCreatedEvent) { + Preconditions.checkNotNull(resourceCreatedEvent); + + final HttpServletRequest request = resourceCreatedEvent.getRequest(); + final HttpServletResponse response = resourceCreatedEvent.getResponse(); + final long idOfNewResource = resourceCreatedEvent.getIdOfNewResource(); + + addLinkHeaderOnResourceCreation(request, response, idOfNewResource); + } + + void addLinkHeaderOnResourceCreation(final HttpServletRequest request, final HttpServletResponse response, final long idOfNewResource) { + final String requestUrl = request.getRequestURL().toString(); + final URI uri = new UriTemplate("{requestUrl}/{idOfNewResource}").expand(requestUrl, idOfNewResource); + response.setHeader(HttpHeaders.LOCATION, uri.toASCIIString()); + } + +} \ No newline at end of file diff --git a/spring-security-ldap/src/main/java/org/baeldung/web/controller/SingleResourceRetrieved.java b/spring-security-ldap/src/main/java/org/baeldung/web/controller/SingleResourceRetrieved.java new file mode 100644 index 0000000000..3de7918105 --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/web/controller/SingleResourceRetrieved.java @@ -0,0 +1,29 @@ +package org.baeldung.web.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.context.ApplicationEvent; + +public class SingleResourceRetrieved extends ApplicationEvent { + private final HttpServletResponse response; + private final HttpServletRequest request; + + public SingleResourceRetrieved(final Object source, final HttpServletRequest request, final HttpServletResponse response) { + super(source); + + this.request = request; + this.response = response; + } + + // API + + public HttpServletResponse getResponse() { + return response; + } + + public HttpServletRequest getRequest() { + return request; + } + +} diff --git a/spring-security-ldap/src/main/java/org/baeldung/web/controller/SingleResourceRetrievedDiscoverabilityListener.java b/spring-security-ldap/src/main/java/org/baeldung/web/controller/SingleResourceRetrievedDiscoverabilityListener.java new file mode 100644 index 0000000000..45cd7c4d13 --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/web/controller/SingleResourceRetrievedDiscoverabilityListener.java @@ -0,0 +1,32 @@ +package org.baeldung.web.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +import com.google.common.base.Preconditions; + +@Component +class SingleResourceRetrievedDiscoverabilityListener implements ApplicationListener { + + @Override + public void onApplicationEvent(final SingleResourceRetrieved resourceRetrievedEvent) { + Preconditions.checkNotNull(resourceRetrievedEvent); + + final HttpServletRequest request = resourceRetrievedEvent.getRequest(); + final HttpServletResponse response = resourceRetrievedEvent.getResponse(); + addLinkHeaderOnSingleResourceRetrieval(request, response); + } + + void addLinkHeaderOnSingleResourceRetrieval(final HttpServletRequest request, final HttpServletResponse response) { + final StringBuffer requestURL = request.getRequestURL(); + final int positionOfLastSlash = requestURL.lastIndexOf("/"); + final String uriForResourceCreation = requestURL.substring(0, positionOfLastSlash); + + final String linkHeaderValue = LinkUtil.createLinkHeader(uriForResourceCreation, "collection"); + response.addHeader("Link", linkHeaderValue); + } + +} \ No newline at end of file diff --git a/spring-security-ldap/src/main/java/org/baeldung/web/controller/TestController.java b/spring-security-ldap/src/main/java/org/baeldung/web/controller/TestController.java new file mode 100644 index 0000000000..f68cfb2eb7 --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/web/controller/TestController.java @@ -0,0 +1,28 @@ +package org.baeldung.web.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class TestController { + + public TestController() { + super(); + } + + // API + + @RequestMapping("/permitAll") + @ResponseBody + public String permitAll() { + return "Permit All"; + } + + @RequestMapping("/securityNone") + @ResponseBody + public String securityNone() { + return "Security None"; + } + +} diff --git a/spring-security-ldap/src/main/java/org/baeldung/web/dto/Foo.java b/spring-security-ldap/src/main/java/org/baeldung/web/dto/Foo.java new file mode 100644 index 0000000000..352045989d --- /dev/null +++ b/spring-security-ldap/src/main/java/org/baeldung/web/dto/Foo.java @@ -0,0 +1,11 @@ +package org.baeldung.web.dto; + +import java.io.Serializable; + +public class Foo implements Serializable { + + public Foo() { + super(); + } + +} diff --git a/spring-security-ldap/src/main/resources/logback.xml b/spring-security-ldap/src/main/resources/logback.xml new file mode 100644 index 0000000000..1146dade63 --- /dev/null +++ b/spring-security-ldap/src/main/resources/logback.xml @@ -0,0 +1,20 @@ + + + + + web - %date [%thread] %-5level %logger{36} - %message%n + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-security-ldap/src/main/resources/webSecurityConfig.xml b/spring-security-ldap/src/main/resources/webSecurityConfig.xml new file mode 100644 index 0000000000..e5310da187 --- /dev/null +++ b/spring-security-ldap/src/main/resources/webSecurityConfig.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-security-ldap/src/main/webapp/WEB-INF/mvc-servlet.xml b/spring-security-ldap/src/main/webapp/WEB-INF/mvc-servlet.xml new file mode 100644 index 0000000000..d6e8f7549a --- /dev/null +++ b/spring-security-ldap/src/main/webapp/WEB-INF/mvc-servlet.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/spring-security-ldap/src/main/webapp/WEB-INF/view/homepage.jsp b/spring-security-ldap/src/main/webapp/WEB-INF/view/homepage.jsp new file mode 100644 index 0000000000..7cc14b5dcd --- /dev/null +++ b/spring-security-ldap/src/main/webapp/WEB-INF/view/homepage.jsp @@ -0,0 +1,7 @@ + + + + +

This is the body of the sample view

+ + \ No newline at end of file diff --git a/spring-security-ldap/src/main/webapp/WEB-INF/web.xml b/spring-security-ldap/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..08183daa24 --- /dev/null +++ b/spring-security-ldap/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,42 @@ + + + Spring Security Basic Auth Application + + + contextClass + org.springframework.web.context.support.AnnotationConfigWebApplicationContext + + + contextConfigLocation + org.baeldung.spring + + + + org.springframework.web.context.ContextLoaderListener + + + + mvc + org.springframework.web.servlet.DispatcherServlet + 1 + + + mvc + / + + + + springSecurityFilterChain + org.springframework.web.filter.DelegatingFilterProxy + + + springSecurityFilterChain + /* + + + + index.html + + + \ No newline at end of file diff --git a/spring-security-ldap/src/test/resources/.gitignore b/spring-security-ldap/src/test/resources/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/spring-security-ldap/src/test/resources/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file