Closed snanoh closed 2 years ago
Spring + Security + Jwt + H2 Database로 간단한 인증 구현
access_token : 접근 제어 토큰 (만료 기준 30분) refresh_token : Access_token 만료시 재발급용 Token (만료 기준 7일)
Request example
{ "email" : "jisun.noh@naver.com", "password" : "1234" }
Response example
{ "grantType": "bearer", "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiYXV0aCI6IlJPTEVfVVNFUiIsImV4cCI6MTY1NzE4OTk2N30.Mya_Jy7c3p7fUOVE0wmWj0cz_t6iXrFYkCNPL58Mn0k", "refreshToken": "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NTc3OTQxNjd9.JUb9pTbHs4OUqdA2bXnkdaZbxsMN7iIYGC9_aoJ3uF0", "accessTokenExpiresIn": 1657189967878 }
"ok"
{ "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiYXV0aCI6IlJPTEVfVVNFUiIsImV4cCI6MTY1NzE4OTk2N30.Mya_Jy7c3p7fUOVE0wmWj0cz_t6iXrFYkCNPL58Mn0k", "refreshToken": "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NTc3OTQxOTh9.NqcP3FNk-Uhy9MVSHi1iVRifch-j63Xt4t2DRtTEF_Q" }
{ "grantType": "bearer", "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiYXV0aCI6IlJPTEVfVVNFUiIsImV4cCI6MTY1NzE5MDAxOX0.dm-Fk5nPQA6L5p5lLnjkUsRypOLivRf8ovY0Oa45G-k", "refreshToken": "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NTc3OTQyMTl9.gRSviAowlxMK0Z4WwVFQ9YrI7V8RMcag5pp5vB2aZow", "accessTokenExpiresIn": 1657190019762 }
email=jisun.noh@naver.com
jisun.noh@naver.com
admin
insert into member (id, authority, password, email) values (1, 'ROLE_USER' , '$2a$10$3rMLv8cHccukZl8XAwJ.1.fX895FHAa186Hw3iESKJUdATWxALd.6', 'jisun.noh@naver.com'); insert into member (id, authority, password, email) values (1, 'ROLE_ADMIN' , '$2a$10$3rMLv8cHccukZl8XAwJ.1.fX895FHAa186Hw3iESKJUdATWxALd.6', 'admin@naver.com');
Spring + Jwt
Introduction
Spring + Security + Jwt + H2 Database로 간단한 인증 구현
JWT 인증 FLOW
access_token : 접근 제어 토큰 (만료 기준 30분) refresh_token : Access_token 만료시 재발급용 Token (만료 기준 7일)
정상 요청
Access Token 만료
Refresh Token 만료
API 명세서
로그인
Request example
Response example
회원가입
Request example
Response example
Token 재발급
Request example
Response example
User 조회 (테스트용)
Request example
Response example
Admin User 조회 (테스트용)
Response example
H2 Database Data Query