728x90 분류 전체보기183 스프링부트와 aws로 혼자 구현하는 웹서비스 - 로그인 문제 이 화면에서 구글 or 네이버 로그인을 하면 Logged in as "홍길동" 이렇게 나와야 한다. 근데 로그인 했는데 바뀌는게 없어서 db에는 세션이랑 user가 잘 등록됐는지 확인해보았다. 음.. 조회해 보니 잘 뜨는데? 수많은 구글링 및 깃허브 이슈탭에서 비슷한 문제를 겪은 분들의 해결 방법을 참고해봐도 해결 불가 그럼 내가 쌩뚱맞은 곳에서 실수 했다는 것일텐데. 곰곰 생각해보니 db에 값은 잘 저장됐다는 거면 Naver or Google에서 로그인 하여 넘어온 값들을 잘 저장했다는 것은 맞으나 해당 값을 불러오는 과정에서 문제가 생겼다는 것. 그렇기에 컨트롤러 부분에서 값들을 먼저 찍어보는 선택을 했다. indexController 부분에서 user가 null이 아닐경우에 해당하는 부분에 Sess.. 2023. 9. 8. [오류 해결] Method springSecurityFilterChain in org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration required a bean of type 'org.springframework.security.oauth2.client.registration.ClientRegistrationRepository' .. "스프링부트와 AWS로 혼자 구현하는 웹 서비스" 책의 구글 로그인을 구현하는 과정에서 문제가 생겼다. 직관적으로 보니까 필요한 빈인 ClientRegistrationRepository라는 친구가 안 보인다는 말인 거 같은데 이전에 구글로부터 클라이언트 ID와 암호를 부여받았는데 거기서 문제가 생겼나 보니 spring.security.oauth2.client.registration.google.client-id=클라이언트아이디 spring.security.oauth2.client.registration.google.client-secret=암호 spring.security.oauth2.client.registration.google.scope=profile,email 다음과 같이 문제 없이 잘 들어간 것.. 2023. 9. 6. spring.security.oauth2.client.registration.google.scope=profile,email spring.security.oauth2.client.registration.google.client-id=클라이언트_id spring.security.oauth2.client.registration.google.client-secret=클라이언트 보안 비밀 spring.security.oauth2.client.registration.google.scope=profile,email application-oauth.properties 파일에 위 코드에서 scope 부분에 profile, email만 기재하는 이유는? 기본값 자체를 openid, profile, email 이 3개를 등록해놨는데 openid의 경우 scope에 기재하면 open id provider라고 인식 그렇게 되면 open id pro.. 2023. 9. 6. Uncaught ReferenceError: JSon is not defined 오류 해결 스프링 부트와 AWS로 혼자 구현하는 웹 서비스 - 이동욱 에 기재되어있는 코드를 실행하다 문제가 생겨 개발자 도구를 확인해보았다. 등록 버튼을 누를 때, "Uncaught ReferenceError: JSon is not defined" 다음과 같은 문제가 발생. 등록 버튼을 눌렀을 때, 서버로 해당 작성한 값들(String 타입 변수들)이 넘겨가 객체로 저장하여 지정한 url로 해당 데이터와 함께 response를 하는 구조. 근데 해당 데이터가 json 타입으로 전환이 되지 않아 로직 수행이 안돼서 발생하는 것으로 확인. 코드 상 무엇이 문제인가 보니.. 이친구가 문제였군.. Json이 아니라 JSON.stringify()이다. 간단 문제 해결~ 2023. 9. 5. 의존성 주입(DI) 정리 및 후기 필드 주입 @Controller Public class Controller{ @Autowired private Service service; } 코드가 간결하지만 외부 변경 불가 테스트하기 어렵다. final을 못 쓴다. DI에 지나친 의존성 수정자 주입 @Controller Public class Controller{ private Service service; @Autowired public void setController(Service service){ this.service = service; } } 선택, 변경 가능성이 있는 의존관계 객체가 변경될 필요성이 있을 때만 사용 생성자 주입 @Controller Public class Controller{ @Autowired private Servi.. 2023. 9. 1. 생성자 어노테이션에 대해 알아보자(ex. @NoArgsConstructor) @AllArgsContructor class에서 선언된 모든 변수를 설정해주는 생성자 자동 생성 @AllArgsContructor public class Member{ private final Long idx; @notNull String phone; String etc; } //위 어노테이션을 통해 다음과 같은 생성자를 직접 만들어 주지 않아도 생성. public Member(Long idx, String phone, String etc){ this.idx = idx; this.phone = phone; this.etc = etc; } @NoArgsContructor 기본 생성자를 만드는 annotation @NoArgsContructor public class Member{ private final .. 2023. 9. 1. 이전 1 2 3 4 5 6 ··· 31 다음 728x90