Notice
Recent Posts
Recent Comments
Link
«   2026/04   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
Archives
Today
Total
관리 메뉴

memo6759 님의 블로그

2025-12-05(스프링 시큐리티) 본문

HDC 학습일지

2025-12-05(스프링 시큐리티)

heewon09 2025. 12. 6. 23:58

 

package com.example.springsecurity.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @GetMapping("/test")
    public String test(){
        return "스프링시큐리티";
    }
    //1. 누구나 접근 할 수 있는 컨트롤러
    @GetMapping("/")
    public String home(){
        return "누구나 접속할 수 있는 컨트롤러";
    }
    //2. 로그인한 유저만 접근 할 수 있는 컨트롤러(USER, ADMIN권한 모두 가능)
    @GetMapping("/user")
    public String user(){
        return "일반 회원이 사용할 수 있는 컨트롤러";
    }
    //3. 관리자만 접근할 수 있는 컨트롤러(ADMIN권한만 접근 가능)
    @GetMapping("/admin")
    public String admin(){
        return "관리자전용 컨트롤러";
    }
}

csrf disable 걸었던니 2번째 이미지 처럼 filter가 걸러진다
403에러 : 인증했는데 권한은 없다라는 의미