본문 바로가기

전체 글78

VSCode와 GitHub 연동하기 Goal 1. VSCode 프로젝트에서 GitHub 레포지토리로 연동하는 방법 알아보기 VSCode - GitHub 연동하기 1. GitHub에서 새로운 레포지토리 만들기 (Respositories > New > Create repository) 2. VSCode에서 내가 GitHub로 올리고 싶은 폴더 열기 3. Source Control icon > Initialize Repository 만약 Initialize Repository가 뜨지 않는다면 Git Bash 터미널 창을 열고 "git init"을 해주면 된다. 4. 커밋할 메세지 적기 > Commit > Yes 5. 커밋이 끝나면 “…” 버튼 누르기 > Pull, Push > Push to… > Add Remote > 1번에서 만든 레포지토리 .. 2023. 3. 25.
README.md 파일에 테이블 만들기 Goal 1. README.md에 마크다운 언어를 이용해서 테이블 만들기 2. README.md 예시 보기 마크다운 테이블 만들기 헤더와 행 테이블은 헤더와 행으로 이루어져 있습니다. 헤더는 테이블의 제목들이 담긴 가장 위에 줄에 있는 행인데 마크다운 언어에서는 파이프 캐릭터를 이용하면 간단히 만들 수 있습니다. 파이프 캐릭터는 일반적으로 키보드에서 Enter 바로 위에 있는 역슬래시 버튼 \ 을 Shift + \ 하면 됩니다. 이름 기호 일반 슬래시 (slash) / 역슬래시 (back slash) \ 파이프 캐릭터 (pipe) | 헤더 마크다운 언어로는 아래와 같이 쓰면 됩니다. | 헤더1 | 헤더2 | 헤더3 | | --- | --- | --- | 정렬 왼쪽, 오른쪽, 가운데 정렬은 아래와 같이 점.. 2023. 3. 24.
[에러모음] java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String 에러 상황 자바에서 여러 로그인 API를 이용해 로그인을 구현하고자 할 때 구글, 페이스북, 네이버는 다 잘 됐는데 카카오 UserInfo.java만 이런 에러가 떴다. public class KakaoUserInfo implements OAuth2UserInfo { private Map attributes;// getAttributes() private Map attributesAccount;// getAttributes().get("kakao_account") private Map attributesProfile;// attributesAccount.get("profile") public KakaoUserInfo(Map attributes) { this.attributes = attributes; t.. 2023. 3. 23.
MTV 패턴 Goal 1. MTV 패턴 설명하기 2. 예시를 통해 MTV 패턴 알아보기 MTV 패턴이란? Model (모델) : 앱의 데이터와 관련된 기능을 다룸 Template (템플릿) : 사용자에게 보여지는 부분 View (뷰) : Model의 데이터를 Template에게 전달하고, Template의 필요한 요청을 처리하는 부분 Django에서는 MTV 패턴으로 전반적인 개발을 진행한다 (자바 스프링에 MVC 패턴이 있듯이). 이러한 개발 패턴을 통해 프로젝트의 복잡한 코드를 그룹지어 나누어 개발자들의 역할을 나누는데도 유용하게 쓰이고 추후에 프로그램의 유지보수와 다른 개발자가 보았을 때도 쉽게 코드 흐름을 파악할 수 있다. MTV 패턴 예시 Template은 우리가 흔히 보는 웹 페이지이다. 위 예제에서는 내.. 2023. 3. 22.
[에러모음] com.auth0.jwt.exceptions.AlgorithmMismatchException: The provided Algorithm doesn't match the one defined in the JWT's Header 에러 설명 자바 프로젝트에서 로그인을 구현하기 위해 시큐리티 필터를 통해 JWT 토큰을 생성하고 확인하는 과정에서 생긴 에러 JwtAuthenticationFilter.java @RequiredArgsConstructor public class JwtAuthenticationFilter extends UsernamePasswordAuthenticationFilter { private final AuthenticationManager authenticationManager; // /login 요청을 하면 사용자 정보를 인증하기 위해 실행되는 함수 @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServ.. 2023. 3. 21.
[에러모음] Failed to evaluate expression 'hasRole('ROLE_USER') or hasRole('ROLE_MANAGER') or hasROLE('ROLE_ADMIN')' 에러 설명 자바 프로젝트에서 SecurityConfig.java를 통해 시큐리티 필터를 거쳐 웹 페이지 접근할 때 생긴 에러 @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true) @RequiredArgsConstructor public class SecurityConfig extends WebSecurityConfigurerAdapter{ @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable(); http.sessionManagement().sessionC.. 2023. 3. 19.
[에러모음] The dependencies of some of the beans in the application context form a cycle 에러 설명 자바 프로젝트 중 2개의 클래스가 서로를 참조하는 형태를 가질 때 생기는 에러 SecurityConfig.java @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true) @RequiredArgsConstructor public class SecurityConfig extends WebSecurityConfigurerAdapter{ @Autowired private PrincipalOauth2UserService principalOauth2UserService; // 문제되는 부분 @Bean public BCryptPasswordEncoder encodePwd.. 2023. 3. 18.
네이버 로그인 API Goal 1. 네이버 로그인 API 사용하기 네이버 로그인 API 1. https://developers.naver.com/apps/#/register 네이버 로그인 하기 2. 애플리케이션 등록 (API 이용신청) > 칸 채워넣기 > 등록하기 3. 애플리케이션 정보 Client ID와 Client Secret을 application.properties에 채워넣기 4. 자바 프로젝트 application.properties에 네이버 로그인 관련 security 설정하기 # NAVER SECURITY spring.security.oauth2.client.registration.naver.client-id=클라이언트ID입력 spring.security.oauth2.client.registration.naver.. 2023. 3. 17.
Facebook 로그인 API Goal 1. 페이스북 로그인 API 사용하기 페이스북 로그인 API 1. https://developers.facebook.com/apps/ 에서 페이스북에 로그인하기 2. 페이스북 로그인 API 사용하기 > My Apps 3. 앱 만들기 4. 앱 타입 선택하기 > 다음 5. 앱 이름 쓰기 > 앱 만들기 6. Facebook 로그인 설정하기 > 웹 > 사이트 URL에 http://localhost:8080 쓰기 > 다음 > 다음 > 다음 > 돌아가기 7. 설정 > 기본 설정 > 앱 ID와 시크릿 코드 확인 8. App ID와 secret을 application.properties에 복붙하기 ## application.properties에 페이스북 로그인 API 설정 # SECURITY spring.se.. 2023. 3. 16.