# [Security] JWT ๊ตฌํ˜„ (1) - ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ
Study Repository

[Security] JWT ๊ตฌํ˜„ (1) - ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ

by rlaehddnd0422

์ด ์ „์— Security์— Jwt๋ฅผ ๋„์ž…ํ•˜์—ฌ Authentication & Authorization ๋ฐฉ์‹์€ ์ธ์ฆ ์•„ํ‚คํ…์ณ๋ฅผ ๋”ฐ๋ผ ์–ด๋–ค ํ๋ฆ„์œผ๋กœ ๋กœ์ง์ด ํ˜๋Ÿฌ๊ฐ€๋Š”์ง€ ์•Œ์•„๋ณด์•˜์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ์—๋Š” ์ด ์ „๊ณผ ์กฐ๊ธˆ ๋‹ค๋ฅธ ๋ฐฉ์‹์œผ๋กœ JWT๋ฅผ Security์— ๋„์ž…ํ•ด๋ณด๋„๋ก ํ•ฉ์‹œ๋‹ค.

ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ

  • Spring boot : 2.7.12 ver
  • dependencies์— ์ถ”๊ฐ€ํ•ด์ฃผ๊ณ  Generate
    • Spring Web
    • Spring Security
    • Validation
    • Spring Data Jpa
    • Lombok
    • H2 Database

 

API TEST

package dongwoongkim.jwttutiral2.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class HelloController {

    @GetMapping("/hello")
    public ResponseEntity<String> hello() {
        return ResponseEntity.ok("hello");
    }
}

 

  • Securiy๊ฐ€ ์ž๋™์œผ๋กœ ๋กœ๊ทธ์ธ ํŽ˜์ด์ง€๋ฅผ ๋„์›Œ์ค๋‹ˆ๋‹ค.
  • ๋กœ๊ทธ์—์„œ ์ธ์ฆํ‚ค๋ฅผ ์ฐพ์•„ ID์— user, PW์— ์ธ์ฆํ‚ค๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ์„ฑ๊ณต

 

 

<์ฐธ๊ณ  ์ž๋ฃŒ>

๋ณธ ํฌ์ŠคํŒ…์€ ์ •์€๊ตฌ๋‹˜์˜ Spring Boot JWT Tutorial ๊ฐ•์˜๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์ž‘์„ฑํ•˜์˜€์Šต๋‹ˆ๋‹ค.

 

[๋ฌด๋ฃŒ] Spring Boot JWT Tutorial - ์ธํ”„๋Ÿฐ | ๊ฐ•์˜

Spring Boot, Spring Security, JWT๋ฅผ ์ด์šฉํ•œ ํŠœํ† ๋ฆฌ์–ผ์„ ํ†ตํ•ด ์ธ์ฆ๊ณผ ์ธ๊ฐ€์— ๋Œ€ํ•œ ๊ธฐ์ดˆ ์ง€์‹์„ ์‰ฝ๊ณ  ๋น ๋ฅด๊ฒŒ ํ•™์Šตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค., - ๊ฐ•์˜ ์†Œ๊ฐœ | ์ธํ”„๋Ÿฐ

www.inflearn.com

 

๋ธ”๋กœ๊ทธ์˜ ์ •๋ณด

Study Repository

rlaehddnd0422

ํ™œ๋™ํ•˜๊ธฐ