[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:
parent
7befda7f22
commit
5bc7d85eee
|
@ -7,7 +7,7 @@
|
|||
<artifactId>spring-security-mvc-boot</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>spring-security-mvc-boot</name>
|
||||
<packaging>pom</packaging>
|
||||
<packaging>war</packaging>
|
||||
<description>Spring Security MVC Boot</description>
|
||||
|
||||
<parent>
|
||||
|
@ -46,6 +46,20 @@
|
|||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-data</artifactId>
|
||||
</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>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
|
@ -214,13 +228,22 @@
|
|||
</profile>
|
||||
</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>
|
||||
<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>
|
||||
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.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>
|
|
@ -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() {
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:persistence-h2.properties")
|
||||
@PropertySource({"classpath:persistence-h2.properties", "classpath:application-defaults.properties"})
|
||||
@EnableJpaRepositories(basePackages = { "com.baeldung.data.repositories" })
|
||||
@EnableWebMvc
|
||||
@Import(SpringSecurityConfig.class)
|
|
@ -3,8 +3,10 @@ package org.baeldung.custom;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:application-defaults.properties")
|
||||
public class Application extends SpringBootServletInitializer {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
|
@ -3,8 +3,10 @@ package org.baeldung.ip;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:application-defaults.properties")
|
||||
public class IpApplication extends SpringBootServletInitializer {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(IpApplication.class, args);
|
|
@ -2,10 +2,12 @@ package org.baeldung.jdbcauthentication.h2;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableWebSecurity
|
||||
@PropertySource("classpath:application-defaults.properties")
|
||||
public class H2JdbcAuthenticationApplication {
|
||||
|
||||
public static void main(String[] args) {
|
|
@ -1,9 +1,11 @@
|
|||
package com.baeldung.jdbcauthentication.mysql;
|
||||
package org.baeldung.jdbcauthentication.mysql;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:application-mysql.properties")
|
||||
public class MySqlJdbcAuthenticationApplication {
|
||||
|
||||
public static void main(String[] args) {
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.jdbcauthentication.mysql.config;
|
||||
package org.baeldung.jdbcauthentication.mysql.config;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.jdbcauthentication.mysql.web;
|
||||
package org.baeldung.jdbcauthentication.mysql.web;
|
||||
|
||||
import java.security.Principal;
|
||||
|
|
@ -1,9 +1,11 @@
|
|||
package com.baeldung.jdbcauthentication.postgre;
|
||||
package org.baeldung.jdbcauthentication.postgre;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:application-postgre.properties")
|
||||
public class PostgreJdbcAuthenticationApplication {
|
||||
|
||||
public static void main(String[] args) {
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.jdbcauthentication.postgre.config;
|
||||
package org.baeldung.jdbcauthentication.postgre.config;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.jdbcauthentication.postgre.web;
|
||||
package org.baeldung.jdbcauthentication.postgre.web;
|
||||
|
||||
import java.security.Principal;
|
||||
|
|
@ -2,8 +2,10 @@ package org.baeldung.multipleauthproviders;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:application-defaults.properties")
|
||||
// @ImportResource({ "classpath*:spring-security-multiple-auth-providers.xml" })
|
||||
public class MultipleAuthProvidersApplication {
|
||||
public static void main(String[] args) {
|
|
@ -2,8 +2,10 @@ package org.baeldung.multipleentrypoints;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:application-defaults.properties")
|
||||
// @ImportResource({"classpath*:spring-security-multiple-entry.xml"})
|
||||
public class MultipleEntryPointsApplication {
|
||||
public static void main(String[] args) {
|
|
@ -3,8 +3,10 @@ package org.baeldung.multiplelogin;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:application-defaults.properties")
|
||||
@ComponentScan("org.baeldung.multiplelogin")
|
||||
public class MultipleLoginApplication {
|
||||
public static void main(String[] args) {
|
|
@ -2,8 +2,10 @@ package org.baeldung.ssl;
|
|||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@SpringBootApplication
|
||||
@PropertySource("classpath:application-defaults.properties")
|
||||
public class HttpsEnabledApplication {
|
||||
|
||||
public static void main(String... args) {
|
|
@ -1,4 +1,3 @@
|
|||
server.port=8082
|
||||
spring.datasource.driver-class-name=org.h2.Driver
|
||||
spring.datasource.url=jdbc:h2:mem:security_permission;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
|
||||
spring.datasource.username=sa
|
||||
|
@ -8,7 +7,7 @@ spring.jpa.database=H2
|
|||
spring.jpa.show-sql=false
|
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
|
||||
|
||||
logging.level.org.springframework.security.web.FilterChainProxy=DEBUG
|
||||
#logging.level.org.springframework.security.web.FilterChainProxy=DEBUG
|
||||
|
||||
spring.h2.console.enabled=true
|
||||
spring.h2.console.path=/h2-console
|
|
@ -1,8 +1,9 @@
|
|||
server.port=8082
|
||||
|
||||
spring.datasource.platform=mysql
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/jdbc_authentication
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=pass
|
||||
|
||||
spring.datasource.initialization-mode=always
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
|
||||
spring.profiles.active=mysql
|
|
@ -1,5 +1,4 @@
|
|||
server.port=8082
|
||||
|
||||
spring.datasource.platform=postgre
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/jdbc_authentication
|
||||
spring.datasource.username=postgres
|
||||
spring.datasource.password=pass
|
|
@ -0,0 +1 @@
|
|||
server.port=8082
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue