Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions spring-security-mvc-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
42 changes: 0 additions & 42 deletions spring-security-mvc-boot/spring-security-mvc-boot-default/pom.xml

This file was deleted.

28 changes: 0 additions & 28 deletions spring-security-mvc-boot/spring-security-mvc-boot-mysql/pom.xml

This file was deleted.

28 changes: 0 additions & 28 deletions spring-security-mvc-boot/spring-security-mvc-boot-postgre/pom.xml

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.jdbcauthentication.mysql.config;
package org.baeldung.jdbcauthentication.mysql.config;

import javax.sql.DataSource;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.jdbcauthentication.mysql.web;
package org.baeldung.jdbcauthentication.mysql.web;

import java.security.Principal;

Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.jdbcauthentication.postgre.config;
package org.baeldung.jdbcauthentication.postgre.config;

import javax.sql.DataSource;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.jdbcauthentication.postgre.web;
package org.baeldung.jdbcauthentication.postgre.web;

import java.security.Principal;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
server.port=8082
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.baeldung.jdbcauthentication.mysql;
package org.baeldung.jdbcauthentication.h2;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = MySqlJdbcAuthenticationApplication.class)
@SpringBootTest(classes = H2JdbcAuthenticationApplication.class)
public class SpringContextIntegrationTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.jdbcauthentication.mysql.web;
package org.baeldung.jdbcauthentication.mysql.web;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.jdbcauthentication.postgre.web;
package org.baeldung.jdbcauthentication.postgre.web;

import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;
Expand All @@ -10,7 +10,7 @@
* This Live Test requires:
* * a PostgreSQL instance running, that allows a 'root' user with password 'pass', and with a database named jdbc_authentication
* (e.g. with the following command `docker run -p 5432:5432 --name bael-postgre -e POSTGRES_PASSWORD=pass -e POSTGRES_DB=jdbc_authentication postgres:latest`)
* * the service up and running
* * the service up and running
*
*/
public class UserControllerLiveTest {
Expand Down