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에러 : 인증했는데 권한은 없다라는 의미