본문 바로가기

Dot ./에러 모음

[Spring Error] Spring Security Config 버전 문제

Spring Security Config 버전 문제

Error creating bean with name 'securityConfiguration'
: Unsatisfied dependency expressed through method 'setContentNegotationStrategy' parameter 0;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException
: Error creating bean with name

...

 

 

SpringSecurity + AWS Cognito connection error occurred in SecurityConfig

I am practicing AWS cognito linkage with springboot. However, a mysterious error occurred in securityconfig. I have no idea why the error occurred. Is the gradle setting wrong? here is the code.

stackoverflow.com

→ dependency문제이다. 스프링부트 버전을 최신으로 하니 작동되었다.

 

 

 

Security Config  람다식 오류 

   http.csrf()
                        .and()
//                        .authorizeRequests(
//                                authz -> authz.mvcMatchers("/")
//                                .permitAll()
//                                .anyRequest()
//                                .authenticated())
                        .authorizeRequests()
                        .mvcMatchers("/").permitAll().anyRequest().authenticated()
                        .and()
                        .oauth2Login()
            .and()
            .logout()
            .logoutSuccessUrl("/");
    }

 

 

 

스프링 시큐리티 요청 URI별 권한 처리할 때 문제상황 해결!

스프링 시큐리티 요청 URI별 권한 처리할 때 문제상황 해결! 스프링 시큐리티를 사용하는 프로젝트에서 /api/** 는 authenticated() 로 처리하고, /api/accounts 로 들어오는 POST 요청만 permitAll() 처리를 해

blog.junu.dev

→ 당시에는 람다식에서 걍 꺼내서 해결했지만 알아보니깐 결국에는 Springboot버전 문제였다. 주석처리한 코드는 2.3.4.RELEASE와 같은 상위버전에서만 지원되는 형식이었고 주석처리 안한 코드는 2.1.x.RELEASE와 같은 버전에서 지원해주는 형식이었다.