1. token 로그인 방식을 위한 SpringbootApi 수정
- pom.xml 라이브러리 추가
<!-- Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<!-- JPA (for token login) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- UNIT TEST -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
- 아래의 파일 추가
- DB에 Member 테이블 생성
create table member(
id bigint primary key AUTO_INCREMENT,
email varchar(300),
password varchar(3000)
)
2. token 로그인 방식을 위한 postman import
- 받은 collection과 Enviroment 임포트
- SpringbootApi.postman_collection.json
- SpringbootApi[local].postman_environment.json
- post 방식으로 아이디와 비밀번호를 생성
- post 방식으로 로그인을 하면 토큰이 생성
- Authorization Type = Bearer Token으로 변경하면 글을 확인 할 수 있다
'Springboot' 카테고리의 다른 글
2021-10-25 (Springboot - JPA - CRUD(1) ) (0) | 2021.10.25 |
---|---|
2021-10-20 (Springboot - /authenticate (Sequence Diagram)) (0) | 2021.10.21 |
2021-10-07 (Springboot - board테이블 - 글읽기 수정 ) (0) | 2021.10.07 |
2021-10-07 (Springboot - board테이블 - 글읽기 수정 ) (0) | 2021.10.07 |
2021-10-06 (Springboot - comment테이블 - 댓글 쓰기 수정) (0) | 2021.10.06 |