Ignore:
Timestamp:
01/05/22 15:57:29 (3 years ago)
Author:
NikolaCenevski <cenevskinikola@…>
Branches:
master
Children:
6fa3d09
Parents:
881a233
Message:

part 2

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  
    33import it.finki.charitable.entities.UserRole;
    44import it.finki.charitable.services.UserService;
     5import org.springframework.beans.factory.annotation.Autowired;
    56import org.springframework.context.annotation.Configuration;
    67import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
    78import org.springframework.security.config.annotation.web.builders.HttpSecurity;
    89import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
    9 import org.springframework.security.core.Authentication;
    1010import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
    1111import org.springframework.security.web.DefaultRedirectStrategy;
     
    1414import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
    1515
    16 import javax.servlet.ServletException;
    17 import javax.servlet.http.HttpServletRequest;
    18 import javax.servlet.http.HttpServletResponse;
    19 import java.io.IOException;
    20 
    2116@Configuration
    2217public class SecurityConfig extends WebSecurityConfigurerAdapter {
     18
     19    @Autowired
     20    private UserO2AuthService userO2AuthService;
     21    @Autowired
     22    private O2AuthSuccessHandler o2AuthSuccessHandler;
    2323
    2424    private final UserService userService;
     
    4141            "/album/**",
    4242            "/post",
    43             "/post-photos/**"
     43            "/post-photos/**",
     44            "/oauth2/authorization/google"
    4445    };
    4546
     
    5859                .successHandler(authenticationSuccessHandler)
    5960                .and()
     61                .oauth2Login()
     62                .loginPage("/login")
     63                .userInfoEndpoint()
     64                .userService(userO2AuthService)
     65                .and()
     66                .successHandler(o2AuthSuccessHandler)
     67                .and()
    6068                .logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
    6169                .logoutSuccessUrl("/").deleteCookies("remember-me")
     
    7381    };
    7482
     83
     84
    7585    @Override
    7686    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
Note: See TracChangeset for help on using the changeset viewer.