Use xml / javaconfig folders for samples

Fixes gh-3752
This commit is contained in:
Joe Grandja 2016-04-11 10:47:06 -04:00 committed by Rob Winch
parent 2c85fb05d0
commit 945a21a3fb
543 changed files with 828 additions and 430 deletions

View File

@ -62,7 +62,7 @@ ext.javaProjects = subprojects.findAll { project -> project.name != 'docs' && pr
ext.sampleProjects = subprojects.findAll { project -> project.name.startsWith('spring-security-samples') }
ext.itestProjects = subprojects.findAll { project -> project.name.startsWith('itest') }
ext.coreModuleProjects = javaProjects - sampleProjects - itestProjects
ext.aspectjProjects = [project(':spring-security-aspects'), project(':spring-security-samples-aspectj-xml'), project(':spring-security-samples-aspectj-jc')]
ext.aspectjProjects = [project(':spring-security-aspects'), project(':spring-security-samples-xml-aspectj'), project(':spring-security-samples-javaconfig-aspectj')]
configure(allprojects - javaProjects) {
task afterEclipseImport {
@ -83,7 +83,7 @@ configure(allprojects - javaProjects) {
}
}
configure(subprojects - coreModuleProjects - project(':spring-security-samples-messages-jc') - project(':spring-security-bom')) {
configure(subprojects - coreModuleProjects - project(':spring-security-samples-javaconfig-messages') - project(':spring-security-bom')) {
tasks.findByPath("artifactoryPublish")?.enabled = false
sonarqube {
skipProject = true

View File

@ -1,7 +1,7 @@
= Creating a Custom Login Form
:author: Rob Winch
:starter-appname: hellomvc-jc
:completed-appname: form-jc
:starter-appname: javaconfig/hellomvc
:completed-appname: javaconfig/form
:include-dir: _includes
This guide builds off of link:hellomvc.html[Hello Spring MVC Security Java Config] to explain how to configure and use a custom login form with Spring Security Java Configuration.
@ -133,7 +133,7 @@ Within Spring Web MVC there are two steps to creating our login page:
== Configuring a login view controller
Within Spring Web MVC, the first step is to ensure that we have a controller that can point to our view. Since our project adds the *messages-jc* project as a dependency and it contains a view controller for */login* we do not need to create a controller within our application. For reference, you can see the configuration below:
Within Spring Web MVC, the first step is to ensure that we have a controller that can point to our view. Since our project adds the *javaconfig/messages* project as a dependency and it contains a view controller for */login* we do not need to create a controller within our application. For reference, you can see the configuration below:
[source,java]
----

View File

@ -1,7 +1,7 @@
= Hello Spring MVC Security Java Config
:author: Rob Winch
:starter-appname: insecuremvc
:completed-appname: hellomvc-jc
:completed-appname: javaconfig/hellomvc
:include-dir: _includes
:hello-include-dir: _hello-includes
@ -45,7 +45,7 @@ The `MessageSecurityWebApplicationInitializer` will automatically register the s
=== Verify SecurityConfig is loaded
Just because <<security-config-java,SecurityConfig>> exists, does not mean that our Spring application knows about it. In this instance, our Spring root application context is initialized using MessageWebApplicationInitializer which is included with our spring-security-samples-messages-jc project. You can find a snippet of it below:
Just because <<security-config-java,SecurityConfig>> exists, does not mean that our Spring application knows about it. In this instance, our Spring root application context is initialized using MessageWebApplicationInitializer which is included with our spring-security-samples-javaconfig-messages project. You can find a snippet of it below:
[[message-web-application-inititializer-java]]
.MessageWebApplicationInitializer.java
@ -63,7 +63,7 @@ public class MessageWebApplicationInitializer extends
}
----
You will notice it is loading the `RootConfiguration` class which is also included in our spring-security-samples-messages-jc project.
You will notice it is loading the `RootConfiguration` class which is also included in our spring-security-samples-javaconfig-messages project.
[[root-configuration-java]]
.RootConfiguration.java
@ -85,7 +85,7 @@ include::{hello-include-dir}/exploring-the-secured-application.asc[]
Now that we have authenticated, let's see how our application is displaying the username if the user is authenticated.
.messages-jc/src/main/resources/views/layout.html
.messages/src/main/resources/views/layout.html
[source,html]
----
<div th:if="${#httpServletRequest.remoteUser != null}">
@ -103,7 +103,7 @@ WARNING: The Thymeleaf ensures the username is escaped to avoid http://en.wikipe
We can view the user name, but how are we able to log out? Below you can see how we are able to log out.
.messages-jc/src/main/resources/views/layout.html
.messages/src/main/resources/views/layout.html
[source,html]
----
<form th:action="@{/logout}" method="post">

View File

@ -1,7 +1,7 @@
= Hello Spring Security Java Config
:author: Rob Winch
:starter-appname: insecure
:completed-appname: helloworld-jc
:completed-appname: javaconfig/helloworld
:include-dir: _includes
:hello-include-dir: _hello-includes

View File

@ -4,7 +4,7 @@
Spring Security 4 added support for securing http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html[Spring's WebSocket support].
This section describes how to use Spring Security's WebSocket support.
NOTE: You can find a complete working sample of WebSocket security in samples/chat-jc.
NOTE: You can find a complete working sample of WebSocket security in samples/javaconfig/chat.
.Direct JSR-356 Support
****

View File

@ -766,7 +766,7 @@ public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception
[[jc-authentication-jdbc]]
==== JDBC Authentication
You can find the updates to suppport JDBC based authentication. The example below assumes that you have already defined a `DataSource` within your application. The https://github.com/spring-projects/spring-security/tree/master/samples/jdbc-jc[jdbc-jc sample] provides a complete example of using JDBC based authentication.
You can find the updates to suppport JDBC based authentication. The example below assumes that you have already defined a `DataSource` within your application. The https://github.com/spring-projects/spring-security/tree/master/samples/javaconfig/jdbc[jdbc-javaconfig] sample provides a complete example of using JDBC based authentication.
[source,java]
----
@ -786,7 +786,7 @@ public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception
==== LDAP Authentication
You can find the updates to suppport LDAP based authentication. The https://github.com/spring-projects/spring-security/tree/master/samples/ldap-jc[ldap-jc sample] provides a complete example of using LDAP based authentication.
You can find the updates to suppport LDAP based authentication. The https://github.com/spring-projects/spring-security/tree/master/samples/javaconfig/ldap[ldap-javaconfig] sample provides a complete example of using LDAP based authentication.
[source,java]
----
@ -2728,7 +2728,7 @@ If authentication fails, the configured `AuthenticationFailureHandler` will be i
[[servletapi]]
== Servlet API integration
This section describes how Spring Security is integrated with the Servlet API. The https://github.com/spring-projects/spring-security/tree/master/samples/servletapi-xml[servletapi-xml] sample application demonstrates the usage of each of these methods.
This section describes how Spring Security is integrated with the Servlet API. The https://github.com/spring-projects/spring-security/tree/master/samples/xml/servletapi[servletapi-xml] sample application demonstrates the usage of each of these methods.
[[servletapi-25]]
@ -5252,7 +5252,7 @@ We've assumed here that the <<ns-config,security namespace>> is being used for c
==== Java EE Container Authentication
The class `J2eePreAuthenticatedProcessingFilter` will extract the username from the `userPrincipal` property of the `HttpServletRequest`. Use of this filter would usually be combined with the use of Java EE roles as described above in <<j2ee-preauth-details>>.
There is a sample application in the codebase which uses this approach, so get hold of the code from github and have a look at the application context file if you are interested. The code is in the `samples/preauth-xml` directory.
There is a sample application in the codebase which uses this approach, so get hold of the code from github and have a look at the application context file if you are interested. The code is in the `samples/xml/preauth` directory.
[[ldap]]

View File

@ -2,10 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-samples-aspectj-jc</artifactId>
<version>4.1.0.RC1</version>
<name>spring-security-samples-aspectj-jc</name>
<description>spring-security-samples-aspectj-jc</description>
<artifactId>spring-security-samples-javaconfig-aspectj</artifactId>
<version>4.1.0.BUILD-SNAPSHOT</version>
<name>spring-security-samples-javaconfig-aspectj</name>
<description>spring-security-samples-javaconfig-aspectj</description>
<url>http://spring.io/spring-security</url>
<organization>
<name>spring.io</name>
@ -45,13 +45,13 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -71,7 +71,7 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-aspects</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
@ -112,8 +112,8 @@
</dependencies>
<repositories>
<repository>
<id>spring-milestone</id>
<url>https://repo.spring.io/milestone</url>
<id>spring-snapshot</id>
<url>https://repo.spring.io/snapshot</url>
</repository>
</repositories>
<build>

View File

@ -2,11 +2,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-samples-chat-jc</artifactId>
<version>4.1.0.RC1</version>
<artifactId>spring-security-samples-javaconfig-chat</artifactId>
<version>4.1.0.BUILD-SNAPSHOT</version>
<packaging>war</packaging>
<name>spring-security-samples-chat-jc</name>
<description>spring-security-samples-chat-jc</description>
<name>spring-security-samples-javaconfig-chat</name>
<description>spring-security-samples-javaconfig-chat</description>
<url>http://spring.io/spring-security</url>
<organization>
<name>spring.io</name>
@ -133,25 +133,25 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-data</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-messaging</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -244,8 +244,8 @@
</dependencies>
<repositories>
<repository>
<id>spring-milestone</id>
<url>https://repo.spring.io/milestone</url>
<id>spring-snapshot</id>
<url>https://repo.spring.io/snapshot</url>
</repository>
</repositories>
<build>

View File

@ -2252,7 +2252,7 @@ table th[class*="span"],
*margin-right: .3em;
line-height: 14px;
vertical-align: text-top;
background-image: url("../../../../../../messages-jc/src/main/resources/resources/img/glyphicons-halflings.png");
background-image: url("../../../../../../../messages/src/main/resources/resources/img/glyphicons-halflings.png");
background-position: 14px 14px;
background-repeat: no-repeat;
}
@ -2272,7 +2272,7 @@ table th[class*="span"],
.dropdown-menu > .active > a > [class*=" icon-"],
.dropdown-submenu:hover > a > [class^="icon-"],
.dropdown-submenu:hover > a > [class*=" icon-"] {
background-image: url("../../../../../../messages-jc/src/main/resources/resources/img/glyphicons-halflings-white.png");
background-image: url("../../../../../../../messages/src/main/resources/resources/img/glyphicons-halflings-white.png");
}
.icon-glass {

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -6,7 +6,7 @@ dependencies {
'javax.servlet.jsp:jsp-api:2.1'
compile project(":spring-security-config"),
project(":spring-security-samples-messages-jc"),
project(":spring-security-samples-javaconfig-messages"),
project(":spring-security-core"),
project(":spring-security-web"),
"org.springframework:spring-webmvc:$springVersion",

View File

@ -2,11 +2,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-samples-rememberme-jc</artifactId>
<version>4.1.0.RC1</version>
<artifactId>spring-security-samples-javaconfig-concurrency</artifactId>
<version>4.1.0.BUILD-SNAPSHOT</version>
<packaging>war</packaging>
<name>spring-security-samples-rememberme-jc</name>
<description>spring-security-samples-rememberme-jc</description>
<name>spring-security-samples-javaconfig-concurrency</name>
<description>spring-security-samples-javaconfig-concurrency</description>
<url>http://spring.io/spring-security</url>
<organization>
<name>spring.io</name>
@ -91,25 +91,25 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-samples-messages-jc</artifactId>
<version>4.1.0.RC1</version>
<artifactId>spring-security-samples-javaconfig-messages</artifactId>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -191,8 +191,8 @@
</dependencies>
<repositories>
<repository>
<id>spring-milestone</id>
<url>https://repo.spring.io/milestone</url>
<id>spring-snapshot</id>
<url>https://repo.spring.io/snapshot</url>
</repository>
</repositories>
<build>

View File

@ -2,10 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-samples-data-jc</artifactId>
<version>4.1.0.RC1</version>
<name>spring-security-samples-data-jc</name>
<description>spring-security-samples-data-jc</description>
<artifactId>spring-security-samples-javaconfig-data</artifactId>
<version>4.1.0.BUILD-SNAPSHOT</version>
<name>spring-security-samples-javaconfig-data</name>
<description>spring-security-samples-javaconfig-data</description>
<url>http://spring.io/spring-security</url>
<organization>
<name>spring.io</name>
@ -81,13 +81,13 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-data</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -135,8 +135,8 @@
</dependencies>
<repositories>
<repository>
<id>spring-milestone</id>
<url>https://repo.spring.io/milestone</url>
<id>spring-snapshot</id>
<url>https://repo.spring.io/snapshot</url>
</repository>
</repositories>
<build>

View File

@ -6,7 +6,7 @@ dependencies {
'javax.servlet.jsp:jsp-api:2.1'
compile project(":spring-security-config"),
project(":spring-security-samples-messages-jc"),
project(":spring-security-samples-javaconfig-messages"),
project(":spring-security-core"),
project(":spring-security-web"),
"org.springframework:spring-webmvc:$springVersion",

View File

@ -2,11 +2,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-samples-jdbc-jc</artifactId>
<version>4.1.0.RC1</version>
<artifactId>spring-security-samples-javaconfig-form</artifactId>
<version>4.1.0.BUILD-SNAPSHOT</version>
<packaging>war</packaging>
<name>spring-security-samples-jdbc-jc</name>
<description>spring-security-samples-jdbc-jc</description>
<name>spring-security-samples-javaconfig-form</name>
<description>spring-security-samples-javaconfig-form</description>
<url>http://spring.io/spring-security</url>
<organization>
<name>spring.io</name>
@ -91,25 +91,25 @@
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-samples-messages-jc</artifactId>
<version>4.1.0.RC1</version>
<artifactId>spring-security-samples-javaconfig-messages</artifactId>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.1.0.RC1</version>
<version>4.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -245,8 +245,8 @@
</dependencies>
<repositories>
<repository>
<id>spring-milestone</id>
<url>https://repo.spring.io/milestone</url>
<id>spring-snapshot</id>
<url>https://repo.spring.io/snapshot</url>
</repository>
</repositories>
<build>

Some files were not shown because too many files have changed in this diff Show More