본문 바로가기

SpringBoot15

Spring Boot Security Oauth2Login (SNS Login) 구현 - application-oauth.properties #Naver spring.security.oauth2.client.registration.naver.client-id= spring.security.oauth2.client.registration.naver.client-secret= spring.security.oauth2.client.registration.naver.client-name=Naver spring.security.oauth2.client.registration.naver.authorization-grant-type=authorization_code spring.security.oauth2.client.registration.naver.redirect-uri=http://localho.. 2022. 9. 20.
Spring Boot 회원정보 출력 (2) 비동기 통신 Ajax - myPage.html 내 정보 아아디 : 이름 : 이메일 : 생일 : 닉네임 : 성별 : 전화번호 : 팀 : 해당 html이 로드 되면 바로 ajax요청이 서버로 가게된다 - UserController @PostMapping("/thymeleaf/myPage") @ResponseBody public ResponseEntity userInformation( @AuthenticationPrincipal PrincipalDetails principalDetails) { if (principalDetails != null) { ResponseUserInfoDTO userInfoDTO = userService.getUserInfo(principalDetails.getUserInfo()); return Resp.. 2022. 9. 15.
Spring Boot 회원정보 출력 (1) 비동기 통신 Ajax - index.html TeamUP! 게시판 SNS 로그인 일반 로그인 회원가입 인덱스 페이지에서 로그인 상태라면 html 의 id 태그 "login/mypage"부분과 "join/logout"부분이 ajax의 done부분으로 인해 바뀌게 된다 저게 가능한 이유는 인덱스 페이지를 읽을 때 ajax요청으로 서버에서 현재 로그인 된 사용자의 아이디 값을 찾아온다. 이 때 ajax의 dataType부분이 json이므로 json 으로 응답이 오지 않거나 done부분의 if문을 만족하지 않을 때는 실행하지 않고 그대로 밑의 html들을 읽는다. - 비로그인 상태 만약 회원이 로그인을 한 상태라면 이런식으로 렌더링이 된다. 여기서 마이페이지로 이동하게 되면 위 코드에 의해서 이런식으로 회원 아이디가 출력이 된다 -.. 2022. 9. 15.
SpringBoot thymeleaf Ajax 비통기 통신 parsererror 이슈 해결 - login.html 아아디 : 비밀번호 : ajax 통신 부분을 보면 응답 데이터 타입을 JSON으로 설정 해둔 상태로 로그인 요청을 보냈다. (dataType : JSON) - AuthenticationFilter @Override protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException { System.out.println("successfulAuthentication 실행 - 인증이 완료 됨 시도중"); PrincipalDetails principalDetails .. 2022. 9. 8.