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