SpringBoot2로 Rest api 만들기(8) – SpringSecurity를 이용한 인증 및 권한부여
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.rest.api.controller.exception;
|
||||
|
||||
import com.rest.api.advice.exception.CAuthenticationEntryPointException;
|
||||
import com.rest.api.model.response.CommonResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping(value = "/exception")
|
||||
public class ExceptionController {
|
||||
|
||||
@GetMapping(value = "/entrypoint")
|
||||
public CommonResult entrypointException() {
|
||||
throw new CAuthenticationEntryPointException();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/accessdenied")
|
||||
public CommonResult accessdeniedException() {
|
||||
throw new AccessDeniedException("");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user