[BAEL-3066] (Reverted and Redone) Spring Security: Exploring JDBC Authentication article (#7565)
* Revert "[BAEL-3066] Spring Security: Exploring JDBC Authentication (#7441)"
This reverts commit 5aecdeb021.
* Redone Spring-Security-Exploring-JDBC-Authentication code, now witout using submodules
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
<artifactId>spring-security-mvc-boot</artifactId>
|
<artifactId>spring-security-mvc-boot</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>spring-security-mvc-boot</name>
|
<name>spring-security-mvc-boot</name>
|
||||||
<packaging>pom</packaging>
|
<packaging>war</packaging>
|
||||||
<description>Spring Security MVC Boot</description>
|
<description>Spring Security MVC Boot</description>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
@@ -46,6 +46,20 @@
|
|||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-data</artifactId>
|
<artifactId>spring-security-data</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
<artifactId>hamcrest-core</artifactId>
|
<artifactId>hamcrest-core</artifactId>
|
||||||
@@ -214,13 +228,22 @@
|
|||||||
</profile>
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
|
|
||||||
<modules>
|
|
||||||
<module>spring-security-mvc-boot-default</module>
|
|
||||||
<module>spring-security-mvc-boot-mysql</module>
|
|
||||||
<module>spring-security-mvc-boot-postgre</module>
|
|
||||||
</modules>
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<start-class>org.baeldung.custom.Application</start-class>
|
||||||
|
<!--If you want to run the example with the voters comment the tag
|
||||||
|
above and uncomment the one below -->
|
||||||
|
<!--<start-class>org.baeldung.voter.VoterApplication</start-class> -->
|
||||||
|
<!--If you want to run the example with the multiple logins, comment
|
||||||
|
the tag above and uncomment the one below -->
|
||||||
|
<!--<start-class>org.baeldung.multiplelogin.MultipleLoginApplication</start-class> -->
|
||||||
|
<!--If you want to run the example with the multiple http elements,
|
||||||
|
comment the tag above and uncomment the one below -->
|
||||||
|
<!--<start-class>org.baeldung.multipleentrypoints.MultipleEntryPointsApplication</start-class> -->
|
||||||
|
<!--If you want to run the example with the Https enabled endpoints,
|
||||||
|
comment the tag above and uncomment the one below -->
|
||||||
|
<!-- <start-class>org.baeldung.ssl.HttpsEnabledApplication</start-class> -->
|
||||||
|
|
||||||
<taglibs-standard.version>1.1.2</taglibs-standard.version>
|
<taglibs-standard.version>1.1.2</taglibs-standard.version>
|
||||||
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
|
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>
|
||||||
<ehcache-core.version>2.6.11</ehcache-core.version>
|
<ehcache-core.version>2.6.11</ehcache-core.version>
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<artifactId>spring-security-mvc-boot-default</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<name>spring-security-mvc-boot-default</name>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<description>Spring Security MVC Boot</description>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>spring-security-mvc-boot</artifactId>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.h2database</groupId>
|
|
||||||
<artifactId>h2</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<start-class>org.baeldung.custom.Application</start-class>
|
|
||||||
<!--If you want to run the example with the voters comment the tag
|
|
||||||
above and uncomment the one below -->
|
|
||||||
<!--<start-class>org.baeldung.voter.VoterApplication</start-class> -->
|
|
||||||
<!--If you want to run the example with the multiple logins, comment
|
|
||||||
the tag above and uncomment the one below -->
|
|
||||||
<!--<start-class>org.baeldung.multiplelogin.MultipleLoginApplication</start-class> -->
|
|
||||||
<!--If you want to run the example with the multiple http elements,
|
|
||||||
comment the tag above and uncomment the one below -->
|
|
||||||
<!--<start-class>org.baeldung.multipleentrypoints.MultipleEntryPointsApplication</start-class>-->
|
|
||||||
<!--If you want to run the example with the Https enabled endpoints,
|
|
||||||
comment the tag above and uncomment the one below -->
|
|
||||||
<!-- <start-class>org.baeldung.ssl.HttpsEnabledApplication</start-class> -->
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<artifactId>spring-security-mvc-boot-mysql</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<name>spring-security-mvc-boot-mysql</name>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<description>Spring Security MVC Boot using MySQL</description>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>spring-security-mvc-boot</artifactId>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>..</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<artifactId>spring-security-mvc-boot-postgre</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<name>spring-security-mvc-boot-postgre</name>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<description>Spring Security MVC Boot using PostgreSQL</description>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>spring-security-mvc-boot</artifactId>
|
|
||||||
<groupId>com.baeldung</groupId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>..</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.postgresql</groupId>
|
|
||||||
<artifactId>postgresql</artifactId>
|
|
||||||
<scope>runtime</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
package com.baeldung.jdbcauthentication.postgre;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
import com.baeldung.jdbcauthentication.postgre.PostgreJdbcAuthenticationApplication;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest(classes = PostgreJdbcAuthenticationApplication.class)
|
|
||||||
public class SpringContextIntegrationTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -18,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@PropertySource("classpath:persistence-h2.properties")
|
@PropertySource({"classpath:persistence-h2.properties", "classpath:application-defaults.properties"})
|
||||||
@EnableJpaRepositories(basePackages = { "com.baeldung.data.repositories" })
|
@EnableJpaRepositories(basePackages = { "com.baeldung.data.repositories" })
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
@Import(SpringSecurityConfig.class)
|
@Import(SpringSecurityConfig.class)
|
||||||
+2
@@ -3,8 +3,10 @@ package org.baeldung.custom;
|
|||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@PropertySource("classpath:application-defaults.properties")
|
||||||
public class Application extends SpringBootServletInitializer {
|
public class Application extends SpringBootServletInitializer {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(Application.class, args);
|
SpringApplication.run(Application.class, args);
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user