Changeset b8dc761 for src/main/java/it/finki/charitable/security
- Timestamp:
- 01/05/22 15:57:29 (3 years ago)
- Branches:
- master
- Children:
- 6fa3d09
- Parents:
- 881a233
- Location:
- src/main/java/it/finki/charitable/security
- Files:
-
- 3 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/charitable/security/SecurityConfig.java
r881a233 rb8dc761 3 3 import it.finki.charitable.entities.UserRole; 4 4 import it.finki.charitable.services.UserService; 5 import org.springframework.beans.factory.annotation.Autowired; 5 6 import org.springframework.context.annotation.Configuration; 6 7 import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; 7 8 import org.springframework.security.config.annotation.web.builders.HttpSecurity; 8 9 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 9 import org.springframework.security.core.Authentication;10 10 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 11 11 import org.springframework.security.web.DefaultRedirectStrategy; … … 14 14 import org.springframework.security.web.util.matcher.AntPathRequestMatcher; 15 15 16 import javax.servlet.ServletException;17 import javax.servlet.http.HttpServletRequest;18 import javax.servlet.http.HttpServletResponse;19 import java.io.IOException;20 21 16 @Configuration 22 17 public class SecurityConfig extends WebSecurityConfigurerAdapter { 18 19 @Autowired 20 private UserO2AuthService userO2AuthService; 21 @Autowired 22 private O2AuthSuccessHandler o2AuthSuccessHandler; 23 23 24 24 private final UserService userService; … … 41 41 "/album/**", 42 42 "/post", 43 "/post-photos/**" 43 "/post-photos/**", 44 "/oauth2/authorization/google" 44 45 }; 45 46 … … 58 59 .successHandler(authenticationSuccessHandler) 59 60 .and() 61 .oauth2Login() 62 .loginPage("/login") 63 .userInfoEndpoint() 64 .userService(userO2AuthService) 65 .and() 66 .successHandler(o2AuthSuccessHandler) 67 .and() 60 68 .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")) 61 69 .logoutSuccessUrl("/").deleteCookies("remember-me") … … 73 81 }; 74 82 83 84 75 85 @Override 76 86 protected void configure(AuthenticationManagerBuilder auth) throws Exception {
Note:
See TracChangeset
for help on using the changeset viewer.