Posts
Q&A
์ปค์คํ ํํฐ ์ ์ฉ ์๋จ
@Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { AuthenticationManager authenticationManager = http.getSharedObject(AuthenticationManager.class); return http .csrf(AbstractHttpConfigurer::disable) .sessionManagement((sessionManagement) -> sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS) ) .formLogin(withDefaults()) .httpBasic(withDefaults()) .addFilter(corsConfig.corsFilter()) .addFilter(new JwtAuthenticationFilter(authenticationManager)) .addFilter(new JwtAuthorizationFilter(authenticationManager, userRepository)) .authorizeRequests(requests -> requests .requestMatchers("/user/**").authenticated() .requestMatchers("/admin/**").access("hasAuthority('ADMIN')") .anyRequest().permitAll() ) .build(); }์ปค์คํ ํํฐ๋ฅผ ์ ์ฉ ์ํ๊ณ ์ปค์คํ ํํฐ์ ์ฝ๋๋ฅผ filterchain์ ์์ฑํ๋ฉด ์ด๋จ๊น ์ถ์ด์์ ๊ฐ์ด ์์ฑํด๋ณด์์์ผ๋, ๋นจ๊ฐ ์ค์ ์ ๋จ์ง๋ง ๋๋ฒ๊น ํด๋ณด๋ authenticationManager๊ฐ null์ด๋ผ๊ณ ๋์์์ต๋๋ค..
- Likes
- 0
- Comments
- 1
- Viewcount
- 966
Q&A
[Google oauth2 ๊ด๋ จ] The dependencies of some of the beans in the application context form a cycle
SecurityConfig์ ์๋ PasswordEncoder ์์ฑ์ ์ฝ๋๋ฅผ Application.java๋ก ์ฎ๊ฒจ์ฃผ๋ ์๋ฌ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค!
- Likes
- 0
- Comments
- 1
- Viewcount
- 901
Q&A
๋ก๊ทธ์ธ ์ฌ๋ฐ๋ฅด๊ฒ ํด๋ login?error๋ก ๊ฐ๋๋ค
์์๋์ต๋๋ค...loadUserByUsername ์ ๋ฉ์๋๋ UserDetailsService์ ์ ์๋ ๋ฉ์๋์์๊ทธ๋์ ์์ด๋๋ฅผ username, ๋น๋ฐ๋ฒํธ๋ password๊ฐ ์๋ ๋ค๋ฅธ ์ด๋ฆ, ๋ค๋ฅธ ๊ฑธ ๋ฐ์ ๊ฒฝ์ฐ config์ ์ด๋ฅผ ๋ช ์ํด์ค์ผ ํฉ๋๋ค.๋ช ์ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์์. .usernameParameter("userEmail") .passwordParameter("userPassword")์ ๋ username์ด ์๋ userEmailpassword๊ฐ ์๋ userPassword๋ผ๋ ์ด๋ฆ์ผ๋ก ๊ฐ์ ๋ฐ์ต๋๋ค. password๋ผ๋ ์ด๋ฆ์ ํด๋นํ๋ ๊ฐ์ด ์์ผ๋ ๋ก๊ทธ์ธ์ด ์๋๋ ๊ฑฐ์์..ํํํํ
- Likes
- 0
- Comments
- 1
- Viewcount
- 1.4K




