// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/security/ErrorestAccessDeniedHandler.java
// public class ErrorestAccessDeniedHandler implements AccessDeniedHandler {
// 
//     protected final ErrorDataProviderContext providerContext;
//     protected final ErrorsFactory errorsFactory;
//     protected final ErrorsHttpResponseSetter responseBodySetter;
// 
//     public ErrorestAccessDeniedHandler(ErrorDataProviderContext providerContext, ErrorsFactory errorsFactory, ErrorsHttpResponseSetter responseBodySetter) {
//         this.providerContext = providerContext;
//         this.errorsFactory = errorsFactory;
//         this.responseBodySetter = responseBodySetter;
//     }
// 
//     @Override
//     public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException ex) throws IOException, ServletException {
//         ErrorData errorData = getErrorData(ex, request);
//         Errors errors = errorsFactory.logAndCreateErrors(errorData);
//         responseBodySetter.setErrorsResponse(errors, errorData.getResponseStatus(), request, response);
//     }
// 
//     @SuppressWarnings("unchecked")
//     protected ErrorData getErrorData(AccessDeniedException ex, HttpServletRequest request) {
//         ErrorDataProvider provider = providerContext.getErrorDataProvider(ex);
//         return provider.getErrorData(ex, request);
//     }
// }
// 
// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/security/ErrorestAuthenticationEntryPoint.java
// public class ErrorestAuthenticationEntryPoint implements AuthenticationEntryPoint {
// 
//     protected final ErrorDataProviderContext providerContext;
//     protected final ErrorsFactory errorsFactory;
//     protected final ErrorsHttpResponseSetter responseBodySetter;
// 
//     public ErrorestAuthenticationEntryPoint(ErrorDataProviderContext providerContext, ErrorsFactory errorsFactory, ErrorsHttpResponseSetter responseBodySetter) {
//         this.providerContext = providerContext;
//         this.errorsFactory = errorsFactory;
//         this.responseBodySetter = responseBodySetter;
//     }
// 
//     @Override
//     public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException ex) throws IOException, ServletException {
//         ErrorData errorData = getErrorData(ex, request);
//         Errors errors = errorsFactory.logAndCreateErrors(errorData);
//         responseBodySetter.setErrorsResponse(errors, errorData.getResponseStatus(), request, response);
//     }
// 
//     @SuppressWarnings("unchecked")
//     protected ErrorData getErrorData(AuthenticationException ex, HttpServletRequest request) {
//         ErrorDataProvider provider = providerContext.getErrorDataProvider(ex);
//         return provider.getErrorData(ex, request);
//     }
// }


import com.github.mkopylec.errorest.handling.errordata.security.ErrorestAccessDeniedHandler;
import com.github.mkopylec.errorest.handling.errordata.security.ErrorestAuthenticationEntryPoint;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
package com.github.mkopylec.errorest.application;


@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/security/ErrorestAccessDeniedHandler.java
// public class ErrorestAccessDeniedHandler implements AccessDeniedHandler {
// 
//     protected final ErrorDataProviderContext providerContext;
//     protected final ErrorsFactory errorsFactory;
//     protected final ErrorsHttpResponseSetter responseBodySetter;
// 
//     public ErrorestAccessDeniedHandler(ErrorDataProviderContext providerContext, ErrorsFactory errorsFactory, ErrorsHttpResponseSetter responseBodySetter) {
//         this.providerContext = providerContext;
//         this.errorsFactory = errorsFactory;
//         this.responseBodySetter = responseBodySetter;
//     }
// 
//     @Override
//     public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException ex) throws IOException, ServletException {
//         ErrorData errorData = getErrorData(ex, request);
//         Errors errors = errorsFactory.logAndCreateErrors(errorData);
//         responseBodySetter.setErrorsResponse(errors, errorData.getResponseStatus(), request, response);
//     }
// 
//     @SuppressWarnings("unchecked")
//     protected ErrorData getErrorData(AccessDeniedException ex, HttpServletRequest request) {
//         ErrorDataProvider provider = providerContext.getErrorDataProvider(ex);
//         return provider.getErrorData(ex, request);
//     }
// }
// 
// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/security/ErrorestAuthenticationEntryPoint.java
// public class ErrorestAuthenticationEntryPoint implements AuthenticationEntryPoint {
// 
//     protected final ErrorDataProviderContext providerContext;
//     protected final ErrorsFactory errorsFactory;
//     protected final ErrorsHttpResponseSetter responseBodySetter;
// 
//     public ErrorestAuthenticationEntryPoint(ErrorDataProviderContext providerContext, ErrorsFactory errorsFactory, ErrorsHttpResponseSetter responseBodySetter) {
//         this.providerContext = providerContext;
//         this.errorsFactory = errorsFactory;
//         this.responseBodySetter = responseBodySetter;
//     }
// 
//     @Override
//     public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException ex) throws IOException, ServletException {
//         ErrorData errorData = getErrorData(ex, request);
//         Errors errors = errorsFactory.logAndCreateErrors(errorData);
//         responseBodySetter.setErrorsResponse(errors, errorData.getResponseStatus(), request, response);
//     }
// 
//     @SuppressWarnings("unchecked")
//     protected ErrorData getErrorData(AuthenticationException ex, HttpServletRequest request) {
//         ErrorDataProvider provider = providerContext.getErrorDataProvider(ex);
//         return provider.getErrorData(ex, request);
//     }
// }


// Path: src/test/java/com/github/mkopylec/errorest/application/SecurityConfiguration.java
import com.github.mkopylec.errorest.handling.errordata.security.ErrorestAccessDeniedHandler;
import com.github.mkopylec.errorest.handling.errordata.security.ErrorestAuthenticationEntryPoint;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;

package com.github.mkopylec.errorest.application;


@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    private final ErrorestAuthenticationEntryPoint authenticationEntryPoint;