1
Spring Bootでは、RESTful APIで失敗した認証用の属性をログに記録する最良の方法は何ですか?つまり、ユーザーがadminロールを持っていない場合、デフォルトでSpringはこのメソッドへのアクセスに失敗したログ:私はApplicationListener<AuthorizedEvent>
を使用してみましたSpring起動時のRESTful API
@PreAuthorize("hasAuthority('admin')")
@RequestMapping(value = "/getVersion", method = RequestMethod.GET)
public ResponseEntity<?> printVersion() {
logger.info("Received get request for version");
return new ResponseEntity<String>(applicationDetails.getAppVersion(), HttpStatus.OK);
}
をし、同様のアプローチがApplicationListener<AbstractAuthenticationEvent>
のために働く一方で、AuthorizedEvents
のために動作するようには思えません。
http://stackoverflow.com/questions/35426100/spring-boot-spring-security-authorization-success-audit ...これは関連しています – moraygrieve