| 
					
				 | 
			
			
				@@ -4,6 +4,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package es.uv.garcosda.config; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.sql.DataSource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.context.annotation.Bean; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.context.annotation.Configuration; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.config.annotation.web.builders.HttpSecurity; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -11,12 +14,17 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.crypto.password.PasswordEncoder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.web.SecurityFilterChain; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.security.web.util.matcher.AntPathRequestMatcher; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @Configuration 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @EnableWebSecurity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class WebSecurityConfig { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private DataSource dataSource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Bean 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public PasswordEncoder passwordEncoder() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return new BCryptPasswordEncoder(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -42,9 +50,18 @@ public class WebSecurityConfig { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	        	.logoutRequestMatcher(new AntPathRequestMatcher("/logout")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	        	.logoutSuccessUrl("/login?logout") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	        	.deleteCookies("my-remember-me-cookie") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	            .permitAll(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	            .permitAll() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            .and() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	        .exceptionHandling() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	        	.accessDeniedPage("/403"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return http.build(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	PersistentTokenRepository persistentTokenRepository(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	JdbcTokenRepositoryImpl tokenRepositoryImpl = new JdbcTokenRepositoryImpl(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	tokenRepositoryImpl.setDataSource(dataSource); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    	return tokenRepositoryImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |