Merge pull request #8886 from Maiklins/JAVA-841-Standardize-packages-spring-security-mvc-boot

JAVA-841 standardize packages spring security mvc boot
This commit is contained in:
Josh Cummings 2020-03-19 11:55:47 -06:00 committed by GitHub
commit af27b7f8a0
93 changed files with 175 additions and 191 deletions

View File

@ -222,10 +222,10 @@
</profiles>
<properties>
<start-class>org.baeldung.custom.Application</start-class>
<start-class>com.baeldung.roles.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> -->
<!--<start-class>com.baeldung.roles.voter.VoterApplication</start-class> -->
<taglibs-standard.version>1.1.2</taglibs-standard.version>
<cargo-maven2-plugin.version>1.6.1</cargo-maven2-plugin.version>

View File

@ -1,4 +1,4 @@
package com.baeldung;
package com.baeldung.relationships;
import java.util.Properties;
@ -19,7 +19,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@SpringBootApplication
@PropertySource({"classpath:persistence-h2.properties", "classpath:application-defaults.properties"})
@EnableJpaRepositories(basePackages = { "com.baeldung.data.repositories" })
@EnableJpaRepositories(basePackages = {"com.baeldung.relationships.repositories"})
@EnableWebMvc
@Import(SpringSecurityConfig.class)
public class AppConfig extends WebMvcConfigurerAdapter {
@ -41,7 +41,7 @@ public class AppConfig extends WebMvcConfigurerAdapter {
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "com.baeldung.models" });
em.setPackagesToScan(new String[] { "com.baeldung.relationships.models" });
em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
em.setJpaProperties(additionalProperties());
return em;

View File

@ -1,4 +1,4 @@
package com.baeldung;
package com.baeldung.relationships;
import javax.annotation.PostConstruct;
import javax.sql.DataSource;
@ -18,8 +18,8 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
import org.springframework.web.context.WebApplicationContext;
import com.baeldung.security.AuthenticationSuccessHandlerImpl;
import com.baeldung.security.CustomUserDetailsService;
import com.baeldung.relationships.security.AuthenticationSuccessHandlerImpl;
import com.baeldung.relationships.security.CustomUserDetailsService;
@Configuration
@EnableWebSecurity

View File

@ -1,4 +1,4 @@
package com.baeldung.models;
package com.baeldung.relationships.models;
import java.util.HashSet;
import java.util.Set;

View File

@ -1,11 +1,11 @@
package com.baeldung.data.repositories;
package com.baeldung.relationships.repositories;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.baeldung.models.Tweet;
import com.baeldung.relationships.models.Tweet;
public interface TweetRepository extends PagingAndSortingRepository<Tweet, Long> {

View File

@ -1,18 +1,15 @@
package com.baeldung.data.repositories;
package com.baeldung.relationships.repositories;
import java.util.Date;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.baeldung.models.AppUser;
import com.baeldung.relationships.models.AppUser;
public interface UserRepository extends CrudRepository<AppUser, Long> {
AppUser findByUsername(String username);

View File

@ -1,4 +1,4 @@
package com.baeldung.security;
package com.baeldung.relationships.security;
import java.util.Collection;
import java.util.Collections;
@ -8,7 +8,7 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.baeldung.models.AppUser;
import com.baeldung.relationships.models.AppUser;
public class AppUserPrincipal implements UserDetails {

View File

@ -1,4 +1,4 @@
package com.baeldung.security;
package com.baeldung.relationships.security;
import java.io.IOException;
import java.util.Date;
@ -12,7 +12,7 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.stereotype.Component;
import com.baeldung.data.repositories.UserRepository;
import com.baeldung.relationships.repositories.UserRepository;
@Component
public class AuthenticationSuccessHandlerImpl implements AuthenticationSuccessHandler {

View File

@ -1,4 +1,4 @@
package com.baeldung.security;
package com.baeldung.relationships.security;
import javax.annotation.PostConstruct;
@ -9,8 +9,8 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.web.context.WebApplicationContext;
import com.baeldung.data.repositories.UserRepository;
import com.baeldung.models.AppUser;
import com.baeldung.relationships.repositories.UserRepository;
import com.baeldung.relationships.models.AppUser;
@Service
public class CustomUserDetailsService implements UserDetailsService {

View File

@ -1,4 +1,4 @@
package com.baeldung.util;
package com.baeldung.relationships.util;
import java.util.ArrayList;
import java.util.Collection;
@ -10,8 +10,8 @@ import java.util.stream.IntStream;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.baeldung.models.AppUser;
import com.baeldung.models.Tweet;
import com.baeldung.relationships.models.AppUser;
import com.baeldung.relationships.models.Tweet;
public class DummyContentUtil {

View File

@ -1,4 +1,4 @@
package org.baeldung.custom;
package com.baeldung.roles.custom;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -7,7 +7,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication
@ComponentScan("org.baeldung.custom")
@ComponentScan("com.baeldung.roles.custom")
@PropertySource("classpath:application-defaults.properties")
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {

View File

@ -1,7 +1,7 @@
package org.baeldung.custom.config;
package com.baeldung.roles.custom.config;
import org.baeldung.custom.security.CustomMethodSecurityExpressionHandler;
import org.baeldung.custom.security.CustomPermissionEvaluator;
import com.baeldung.roles.custom.security.CustomMethodSecurityExpressionHandler;
import com.baeldung.roles.custom.security.CustomPermissionEvaluator;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;

View File

@ -1,4 +1,4 @@
package org.baeldung.custom.config;
package com.baeldung.roles.custom.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package org.baeldung.custom.config;
package com.baeldung.roles.custom.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,16 +1,16 @@
package org.baeldung.custom.persistence;
package com.baeldung.roles.custom.persistence;
import java.util.Arrays;
import java.util.HashSet;
import javax.annotation.PostConstruct;
import org.baeldung.custom.persistence.dao.OrganizationRepository;
import org.baeldung.custom.persistence.dao.PrivilegeRepository;
import org.baeldung.custom.persistence.dao.UserRepository;
import org.baeldung.custom.persistence.model.Organization;
import org.baeldung.custom.persistence.model.Privilege;
import org.baeldung.custom.persistence.model.User;
import com.baeldung.roles.custom.persistence.dao.OrganizationRepository;
import com.baeldung.roles.custom.persistence.dao.PrivilegeRepository;
import com.baeldung.roles.custom.persistence.dao.UserRepository;
import com.baeldung.roles.custom.persistence.model.Organization;
import com.baeldung.roles.custom.persistence.model.Privilege;
import com.baeldung.roles.custom.persistence.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

View File

@ -1,6 +1,6 @@
package org.baeldung.custom.persistence.dao;
package com.baeldung.roles.custom.persistence.dao;
import org.baeldung.custom.persistence.model.Organization;
import com.baeldung.roles.custom.persistence.model.Organization;
import org.springframework.data.jpa.repository.JpaRepository;
public interface OrganizationRepository extends JpaRepository<Organization, Long> {

View File

@ -1,6 +1,6 @@
package org.baeldung.custom.persistence.dao;
package com.baeldung.roles.custom.persistence.dao;
import org.baeldung.custom.persistence.model.Privilege;
import com.baeldung.roles.custom.persistence.model.Privilege;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PrivilegeRepository extends JpaRepository<Privilege, Long> {

View File

@ -1,6 +1,6 @@
package org.baeldung.custom.persistence.dao;
package com.baeldung.roles.custom.persistence.dao;
import org.baeldung.custom.persistence.model.User;
import com.baeldung.roles.custom.persistence.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.transaction.annotation.Transactional;

View File

@ -1,4 +1,4 @@
package org.baeldung.custom.persistence.model;
package com.baeldung.roles.custom.persistence.model;
import javax.persistence.Column;
import javax.persistence.Entity;

View File

@ -1,4 +1,4 @@
package org.baeldung.custom.persistence.model;
package com.baeldung.roles.custom.persistence.model;
import javax.persistence.Column;
import javax.persistence.Entity;

View File

@ -1,4 +1,4 @@
package org.baeldung.custom.persistence.model;
package com.baeldung.roles.custom.persistence.model;
import javax.persistence.Column;
import javax.persistence.Entity;

View File

@ -1,4 +1,4 @@
package org.baeldung.custom.security;
package com.baeldung.roles.custom.security;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler;

View File

@ -1,6 +1,6 @@
package org.baeldung.custom.security;
package com.baeldung.roles.custom.security;
import org.baeldung.custom.persistence.model.User;
import com.baeldung.roles.custom.persistence.model.User;
import org.springframework.security.access.expression.SecurityExpressionRoot;
import org.springframework.security.access.expression.method.MethodSecurityExpressionOperations;
import org.springframework.security.core.Authentication;

View File

@ -1,11 +1,11 @@
package org.baeldung.custom.security;
package com.baeldung.roles.custom.security;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.baeldung.custom.persistence.model.User;
import com.baeldung.roles.custom.persistence.model.User;
import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.access.expression.method.MethodSecurityExpressionOperations;
import org.springframework.security.access.hierarchicalroles.RoleHierarchy;

View File

@ -1,7 +1,7 @@
package org.baeldung.custom.security;
package com.baeldung.roles.custom.security;
import org.baeldung.custom.persistence.dao.UserRepository;
import org.baeldung.custom.persistence.model.User;
import com.baeldung.roles.custom.persistence.dao.UserRepository;
import com.baeldung.roles.custom.persistence.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;

View File

@ -1,11 +1,11 @@
package org.baeldung.custom.security;
package com.baeldung.roles.custom.security;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.baeldung.custom.persistence.model.Privilege;
import org.baeldung.custom.persistence.model.User;
import com.baeldung.roles.custom.persistence.model.Privilege;
import com.baeldung.roles.custom.persistence.model.User;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

View File

@ -1,9 +1,9 @@
package org.baeldung.custom.web;
package com.baeldung.roles.custom.web;
import org.baeldung.custom.persistence.dao.OrganizationRepository;
import org.baeldung.custom.persistence.model.Foo;
import org.baeldung.custom.persistence.model.Organization;
import org.baeldung.custom.security.MyUserPrincipal;
import com.baeldung.roles.custom.persistence.dao.OrganizationRepository;
import com.baeldung.roles.custom.persistence.model.Foo;
import com.baeldung.roles.custom.persistence.model.Organization;
import com.baeldung.roles.custom.security.MyUserPrincipal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;

View File

@ -1,4 +1,4 @@
package org.baeldung.ip;
package com.baeldung.roles.ip;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -7,7 +7,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
@SpringBootApplication
@ComponentScan("org.baeldung.ip")
@ComponentScan("com.baeldung.ip")
@PropertySource("classpath:application-defaults.properties")
public class IpApplication extends SpringBootServletInitializer {
public static void main(String[] args) {

View File

@ -1,4 +1,4 @@
package org.baeldung.ip.config;
package com.baeldung.roles.ip.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

View File

@ -1,11 +1,11 @@
package org.baeldung.ip.web;
package com.baeldung.roles.ip.web;
import java.util.List;
import javax.servlet.Filter;
import javax.servlet.http.HttpServletRequest;
import org.baeldung.custom.persistence.model.Foo;
import com.baeldung.roles.custom.persistence.model.Foo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.web.FilterChainProxy;

View File

@ -1,7 +1,7 @@
package org.baeldung.rolesauthorities;
package com.baeldung.roles.rolesauthorities;
import org.baeldung.rolesauthorities.model.User;
import org.baeldung.rolesauthorities.persistence.UserRepository;
import com.baeldung.roles.rolesauthorities.model.User;
import com.baeldung.roles.rolesauthorities.persistence.UserRepository;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;

View File

@ -1,13 +1,13 @@
package org.baeldung.rolesauthorities;
package com.baeldung.roles.rolesauthorities;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.baeldung.rolesauthorities.model.Role;
import org.baeldung.rolesauthorities.model.User;
import org.baeldung.rolesauthorities.persistence.UserRepository;
import com.baeldung.roles.rolesauthorities.model.Role;
import com.baeldung.roles.rolesauthorities.model.User;
import com.baeldung.roles.rolesauthorities.persistence.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

View File

@ -1,4 +1,4 @@
package org.baeldung.rolesauthorities;
package com.baeldung.roles.rolesauthorities;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan("org.baeldung.rolesauthorities")
@ComponentScan("com.baeldung.rolesauthorities")
public class RolesAuthoritiesApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
System.setProperty("spring.profiles.default", "rolesauthorities");

View File

@ -1,4 +1,4 @@
package org.baeldung.rolesauthorities.config;
package com.baeldung.roles.rolesauthorities.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,7 +1,7 @@
package org.baeldung.rolesauthorities.config;
package com.baeldung.roles.rolesauthorities.config;
import org.baeldung.rolesauthorities.CustomAuthenticationProvider;
import org.baeldung.rolesauthorities.persistence.UserRepository;
import com.baeldung.roles.rolesauthorities.CustomAuthenticationProvider;
import com.baeldung.roles.rolesauthorities.persistence.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@ -18,7 +18,7 @@ import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
@Configuration
@ComponentScan(basePackages = { "org.baeldung.rolesauthorities" })
@ComponentScan(basePackages = {"com.baeldung.rolesauthorities"})
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@ -76,7 +76,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
public DaoAuthenticationProvider authProvider() {
final CustomAuthenticationProvider authProvider
final CustomAuthenticationProvider authProvider
= new CustomAuthenticationProvider(userRepository, userDetailsService);
authProvider.setPasswordEncoder(encoder());
return authProvider;

View File

@ -1,4 +1,4 @@
package org.baeldung.rolesauthorities.model;
package com.baeldung.roles.rolesauthorities.model;
import java.util.Collection;

View File

@ -1,4 +1,4 @@
package org.baeldung.rolesauthorities.model;
package com.baeldung.roles.rolesauthorities.model;
import java.util.Collection;

View File

@ -0,0 +1,9 @@
package com.baeldung.roles.rolesauthorities.persistence;
import com.baeldung.roles.rolesauthorities.model.User;
public interface IUserService {
User findUserByEmail(String email);
}

View File

@ -1,6 +1,6 @@
package org.baeldung.rolesauthorities.persistence;
package com.baeldung.roles.rolesauthorities.persistence;
import org.baeldung.rolesauthorities.model.Privilege;
import com.baeldung.roles.rolesauthorities.model.Privilege;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PrivilegeRepository extends JpaRepository<Privilege, Long> {

View File

@ -1,6 +1,6 @@
package org.baeldung.rolesauthorities.persistence;
package com.baeldung.roles.rolesauthorities.persistence;
import org.baeldung.rolesauthorities.model.Role;
import com.baeldung.roles.rolesauthorities.model.Role;
import org.springframework.data.jpa.repository.JpaRepository;
public interface RoleRepository extends JpaRepository<Role, Long> {

View File

@ -1,13 +1,13 @@
package org.baeldung.rolesauthorities.persistence;
package com.baeldung.roles.rolesauthorities.persistence;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.baeldung.rolesauthorities.model.Privilege;
import org.baeldung.rolesauthorities.model.Role;
import org.baeldung.rolesauthorities.model.User;
import com.baeldung.roles.rolesauthorities.model.Privilege;
import com.baeldung.roles.rolesauthorities.model.Role;
import com.baeldung.roles.rolesauthorities.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

View File

@ -1,6 +1,6 @@
package org.baeldung.rolesauthorities.persistence;
package com.baeldung.roles.rolesauthorities.persistence;
import org.baeldung.rolesauthorities.model.User;
import com.baeldung.roles.rolesauthorities.model.User;
import org.springframework.data.jpa.repository.JpaRepository;
public interface UserRepository extends JpaRepository<User, Long> {

View File

@ -1,8 +1,8 @@
package org.baeldung.rolesauthorities.persistence;
package com.baeldung.roles.rolesauthorities.persistence;
import javax.transaction.Transactional;
import org.baeldung.rolesauthorities.model.User;
import com.baeldung.roles.rolesauthorities.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@ -1,4 +1,4 @@
package org.baeldung.voter;
package com.baeldung.roles.voter;
import java.time.LocalDateTime;
import java.util.Collection;

View File

@ -1,4 +1,4 @@
package org.baeldung.voter;
package com.baeldung.roles.voter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@EnableAutoConfiguration
@ComponentScan(basePackages = { "org.baeldung.voter" })
@ComponentScan(basePackages = {"com.baeldung.voter"})
public class VoterApplication {
public static void main(String[] args) {

View File

@ -1,10 +1,8 @@
package org.baeldung.voter;
package com.baeldung.roles.voter;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
/**
* Created by ambrusadrianz on 30/09/2016.

View File

@ -1,4 +1,4 @@
package org.baeldung.voter;
package com.baeldung.roles.voter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -15,7 +15,6 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.access.expression.WebExpressionVoter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import java.util.Arrays;
import java.util.List;

View File

@ -1,7 +1,4 @@
package org.baeldung.voter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
package com.baeldung.roles.voter;
/**
* Created by ambrusadrianz on 09/10/2016.

View File

@ -1,9 +0,0 @@
package org.baeldung.rolesauthorities.persistence;
import org.baeldung.rolesauthorities.model.User;
public interface IUserService {
User findUserByEmail(String email);
}

View File

@ -22,12 +22,12 @@
<beans:bean class="org.springframework.security.web.access.expression.WebExpressionVoter"/>
<beans:bean class="org.springframework.security.access.vote.AuthenticatedVoter"/>
<beans:bean class="org.springframework.security.access.vote.RoleVoter"/>
<beans:bean class="org.baeldung.voter.MinuteBasedVoter"/>
<beans:bean class="com.baeldung.roles.voter.MinuteBasedVoter"/>
</beans:list>
</beans:constructor-arg>
</beans:bean>
<beans:bean id="minuteBasedVoter" class="org.baeldung.voter.MinuteBasedVoter"/>
<beans:bean id="minuteBasedVoter" class="com.baeldung.roles.voter.MinuteBasedVoter"/>
<authentication-manager>
<authentication-provider>

View File

@ -1,12 +1,11 @@
package com.baeldung.relationships;
import com.baeldung.AppConfig;
import com.baeldung.data.repositories.TweetRepository;
import com.baeldung.data.repositories.UserRepository;
import com.baeldung.models.AppUser;
import com.baeldung.models.Tweet;
import com.baeldung.security.AppUserPrincipal;
import com.baeldung.util.DummyContentUtil;
import com.baeldung.relationships.repositories.TweetRepository;
import com.baeldung.relationships.repositories.UserRepository;
import com.baeldung.relationships.models.AppUser;
import com.baeldung.relationships.models.Tweet;
import com.baeldung.relationships.security.AppUserPrincipal;
import com.baeldung.relationships.util.DummyContentUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

View File

@ -1,6 +1,6 @@
package org.baeldung;
package com.baeldung.roles;
import org.baeldung.custom.Application;
import com.baeldung.roles.custom.Application;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;

View File

@ -1,9 +1,9 @@
package org.baeldung.web;
package com.baeldung.roles.web;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.baeldung.custom.persistence.model.Foo;
import com.baeldung.roles.custom.persistence.model.Foo;
import io.restassured.RestAssured;
import io.restassured.authentication.FormAuthConfig;
@ -13,7 +13,7 @@ import io.restassured.specification.RequestSpecification;
import org.junit.Test;
import org.springframework.http.MediaType;
// In order to execute these tests, org.baeldung.custom.Application needs to be running.
// In order to execute these tests, com.baeldung.custom.Application needs to be running.
public class ApplicationLiveTest {
@Test

View File

@ -1,4 +1,4 @@
package org.baeldung.web;
package com.baeldung.roles.web;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@ -7,8 +7,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import org.apache.http.HttpHeaders;
import org.baeldung.custom.Application;
import org.baeldung.custom.persistence.model.Foo;
import com.baeldung.roles.custom.Application;
import com.baeldung.roles.custom.persistence.model.Foo;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
@ -59,7 +59,7 @@ public class CustomUserDetailsServiceIntegrationTest {
@WithAnonymousUser
public void givenAnonymous_whenRequestFoo_thenRetrieveUnauthorized() throws Exception {
this.mvc.perform(get("/foos/1").with(csrf()))
.andExpect(status().isFound());
.andExpect(status().isFound());
}
@Test

View File

@ -1,4 +1,4 @@
package org.baeldung.web;
package com.baeldung.roles.web;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@ -8,7 +8,7 @@ import io.restassured.response.Response;
import org.junit.Test;
// In order to execute these tests, org.baeldung.ip.IpApplication needs to be running.
// In order to execute these tests, com.baeldung.ip.IpApplication needs to be running.
public class IpLiveTest {
@Test

View File

@ -222,16 +222,15 @@
</profiles>
<properties>
<start-class>org.baeldung.custom.Application</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> -->
<!-- <start-class>com.baeldung.jdbcauthentication.postgre.PostgreJdbcAuthenticationApplication</start-class>-->
<!--This runs the example with the multiple logins application -->
<start-class>com.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> -->
<!--<start-class>com.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> -->
<!-- <start-class>com.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>

View File

@ -1,4 +1,4 @@
package org.baeldung.jdbcauthentication.h2;
package com.baeldung.jdbcauthentication.h2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package org.baeldung.jdbcauthentication.mysql;
package com.baeldung.jdbcauthentication.mysql;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package org.baeldung.jdbcauthentication.postgre;
package com.baeldung.jdbcauthentication.postgre;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package org.baeldung.multipleauthproviders;
package com.baeldung.multipleauthproviders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

View File

@ -1,4 +1,4 @@
package org.baeldung.multipleauthproviders;
package com.baeldung.multipleauthproviders;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package org.baeldung.multipleauthproviders;
package com.baeldung.multipleauthproviders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

View File

@ -1,4 +1,4 @@
package org.baeldung.multipleentrypoints;
package com.baeldung.multipleentrypoints;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package org.baeldung.multipleentrypoints;
package com.baeldung.multipleentrypoints;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package org.baeldung.multipleentrypoints;
package com.baeldung.multipleentrypoints;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -1,4 +1,4 @@
package org.baeldung.multiplelogin;
package com.baeldung.multiplelogin;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -7,7 +7,6 @@ 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) {
SpringApplication.run(MultipleLoginApplication.class, args);

View File

@ -1,4 +1,4 @@
package org.baeldung.multiplelogin;
package com.baeldung.multiplelogin;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -6,14 +6,12 @@ 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.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
import org.springframework.context.annotation.ComponentScan;
@EnableWebMvc
@Configuration
@ComponentScan("org.baeldung.controller")
public class MultipleLoginMvcConfig implements WebMvcConfigurer {
public MultipleLoginMvcConfig() {

View File

@ -1,4 +1,4 @@
package org.baeldung.multiplelogin;
package com.baeldung.multiplelogin;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -1,4 +1,4 @@
package org.baeldung.multiplelogin;
package com.baeldung.multiplelogin;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,4 +1,4 @@
package org.baeldung.ssl;
package com.baeldung.ssl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -1,4 +1,4 @@
package org.baeldung.ssl;
package com.baeldung.ssl;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;

View File

@ -1,8 +1,7 @@
package org.baeldung.ssl;
package com.baeldung.ssl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class WelcomeController {

View File

@ -1,6 +1,5 @@
package org.baeldung.jdbcauthentication.h2;
package com.baeldung.jdbcauthentication.h2;
import org.baeldung.jdbcauthentication.h2.H2JdbcAuthenticationApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;

View File

@ -1,4 +1,4 @@
package org.baeldung.jdbcauthentication.h2.web;
package com.baeldung.jdbcauthentication.h2.web;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

View File

@ -1,4 +1,4 @@
package org.baeldung.jdbcauthentication.mysql.web;
package com.baeldung.jdbcauthentication.mysql.web;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

View File

@ -1,4 +1,4 @@
package org.baeldung.jdbcauthentication.postgre.web;
package com.baeldung.jdbcauthentication.postgre.web;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;

View File

@ -1,10 +1,10 @@
package org.baeldung.web;
package com.baeldung.web;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.baeldung.ssl.HttpsEnabledApplication;
import com.baeldung.ssl.HttpsEnabledApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;

View File

@ -1,10 +1,10 @@
package org.baeldung.web;
package com.baeldung.web;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Collections;
import org.baeldung.multipleauthproviders.MultipleAuthProvidersApplication;
import com.baeldung.multipleauthproviders.MultipleAuthProvidersApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package org.baeldung.web;
package com.baeldung.web;
import org.junit.Before;
import org.junit.Test;
@ -15,7 +15,7 @@ import org.springframework.web.context.WebApplicationContext;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import org.baeldung.multipleentrypoints.MultipleEntryPointsApplication;
import com.baeldung.multipleentrypoints.MultipleEntryPointsApplication;
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*;