1. https://console.developers.google.com/ Google Cloud Platform 하나의 계정으로 모든 Google 서비스를 Google Cloud Platform을 사용하려면 로그인하세요. accounts.google.com 여기 접속해서 새 프로젝트를 만들어 준다. 사용자 인증 정보에서 이름과 리디렉션 URI를 입력해준다. URI의 login부터 google까지는 고정. 만들면 클라이언트 ID와 비밀번호를 준다. 2. 스프링부트 OAuth2 Client를 pom.xml에 추가해준다. org.springframework.boot spring-boot-starter-oauth2-client 3. application.yml 수정 security: oauth2: client..
취업 준비/Spring security
1. admin, manager 계정 만들고 권한 DB에서 바꿔주기 2. SecurityConfig 수정 package com.pure.security.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import o..
1. loginForm 수정 로그인 페이지 로그인 회원가입 /login 주소로 로그인을 실행할 것이므로 action에 /login을 넣어준다. input text의 name을 꼭 username으로 해주어야 한다. (시큐리티 기본설정이기 때문. 바꿀 수 있음.) 2. SecurityConfig 수정 package com.pure.security.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; im..
1. 로그인, 회원가입 폼 만들기 templates 아래에 loginForm.html을 만든다. 로그인 페이지 로그인 joinForm.html 회원가입 페이지 회원가입 2. User 정보를 저장할 User 오브젝트를 만든다. package com.pure.security.model; import java.sql.Timestamp; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import org.hibernate.annotations.CreationTimestamp; import lombok.Da..
1. com.pure.security.config 안에 SecurityConfig.java를 만든다. package com.pure.security.config; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.We..
1. MySQL에서 security 이름으로 DB 생성 2. spring_security이름으로 스프링 스타터 프로젝트 생성 3. application.yml 작성 application.properties를 .yml로 변경 후 작성 server: port: 8080 servlet: context-path: / encoding: charset: UTF-8 enabled: true force: true spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/security?serverTimezone=Asia/Seoul username: pure password: pure1234 mvc: vi..