// Path: src/main/java/com/github/mkopylec/errorest/configuration/ErrorestProperties.java
// @ConfigurationProperties("errorest")
// public class ErrorestProperties {
// 
//     /**
//      * HTTP response body format.
//      */
//     private ResponseBodyFormat responseBodyFormat = FULL;
//     /**
//      * Properties responsible for handling validation errors.
//      */
//     private BeanValidationError beanValidationError = new BeanValidationError();
//     /**
//      * Properties responsible for handling 4xx HTTP errors.
//      */
//     private HttpClientError httpClientError = new HttpClientError();
// 
//     public ResponseBodyFormat getResponseBodyFormat() {
//         return responseBodyFormat;
//     }
// 
//     public void setResponseBodyFormat(ResponseBodyFormat responseBodyFormat) {
//         this.responseBodyFormat = responseBodyFormat;
//     }
// 
//     public BeanValidationError getBeanValidationError() {
//         return beanValidationError;
//     }
// 
//     public void setBeanValidationError(BeanValidationError beanValidationError) {
//         this.beanValidationError = beanValidationError;
//     }
// 
//     public HttpClientError getHttpClientError() {
//         return httpClientError;
//     }
// 
//     public void setHttpClientError(HttpClientError httpClientError) {
//         this.httpClientError = httpClientError;
//     }
// 
//     public enum ResponseBodyFormat {
//         WITHOUT_DESCRIPTIONS, FULL
//     }
// 
//     public static class BeanValidationError {
// 
//         /**
//          * Validation errors logging level.
//          */
//         private LoggingLevel loggingLevel = WARN;
// 
//         public LoggingLevel getLoggingLevel() {
//             return loggingLevel;
//         }
// 
//         public void setLoggingLevel(LoggingLevel loggingLevel) {
//             this.loggingLevel = loggingLevel;
//         }
//     }
// 
//     public static class HttpClientError {
// 
//         /**
//          * HTTP 4xx errors logging level.
//          */
//         private LoggingLevel loggingLevel = WARN;
// 
//         public LoggingLevel getLoggingLevel() {
//             return loggingLevel;
//         }
// 
//         public void setLoggingLevel(LoggingLevel loggingLevel) {
//             this.loggingLevel = loggingLevel;
//         }
//     }
// }
// 
// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/security/AccessDeniedErrorDataProvider.java
// public class AccessDeniedErrorDataProvider extends SecurityErrorDataProvider<AccessDeniedException> {
// 
//     public AccessDeniedErrorDataProvider(ErrorestProperties errorestProperties) {
//         super(errorestProperties);
//     }
// 
//     @Override
//     protected HttpStatus getResponseHttpStatus() {
//         return FORBIDDEN;
//     }
// 
//     @Override
//     protected String getErrorDescription(String requestHeaders) {
//         return "Access denied for request with headers: " + requestHeaders;
//     }
// }
// 
// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/security/AuthenticationErrorDataProvider.java
// public class AuthenticationErrorDataProvider extends SecurityErrorDataProvider<AuthenticationException> {
// 
//     public AuthenticationErrorDataProvider(ErrorestProperties errorestProperties) {
//         super(errorestProperties);
//     }
// 
//     @Override
//     protected HttpStatus getResponseHttpStatus() {
//         return UNAUTHORIZED;
//     }
// 
//     @Override
//     protected String getErrorDescription(String requestHeaders) {
//         return "Authentication failed for request with headers: " + requestHeaders;
//     }
// }


import com.github.mkopylec.errorest.configuration.ErrorestProperties;
import com.github.mkopylec.errorest.handling.errordata.security.AccessDeniedErrorDataProvider;
import com.github.mkopylec.errorest.handling.errordata.security.AuthenticationErrorDataProvider;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.core.AuthenticationException;
package com.github.mkopylec.errorest.handling.errordata;


public class SecurityErrorDataProviderContext extends ErrorDataProviderContext {

    public SecurityErrorDataProviderContext(ErrorestProperties errorestProperties) {
        super(errorestProperties);
    }

    @Override
    public <T extends Throwable> ErrorDataProvider getErrorDataProvider(T ex) {
        if (ex instanceof AccessDeniedException) {
// Path: src/main/java/com/github/mkopylec/errorest/configuration/ErrorestProperties.java
// @ConfigurationProperties("errorest")
// public class ErrorestProperties {
// 
//     /**
//      * HTTP response body format.
//      */
//     private ResponseBodyFormat responseBodyFormat = FULL;
//     /**
//      * Properties responsible for handling validation errors.
//      */
//     private BeanValidationError beanValidationError = new BeanValidationError();
//     /**
//      * Properties responsible for handling 4xx HTTP errors.
//      */
//     private HttpClientError httpClientError = new HttpClientError();
// 
//     public ResponseBodyFormat getResponseBodyFormat() {
//         return responseBodyFormat;
//     }
// 
//     public void setResponseBodyFormat(ResponseBodyFormat responseBodyFormat) {
//         this.responseBodyFormat = responseBodyFormat;
//     }
// 
//     public BeanValidationError getBeanValidationError() {
//         return beanValidationError;
//     }
// 
//     public void setBeanValidationError(BeanValidationError beanValidationError) {
//         this.beanValidationError = beanValidationError;
//     }
// 
//     public HttpClientError getHttpClientError() {
//         return httpClientError;
//     }
// 
//     public void setHttpClientError(HttpClientError httpClientError) {
//         this.httpClientError = httpClientError;
//     }
// 
//     public enum ResponseBodyFormat {
//         WITHOUT_DESCRIPTIONS, FULL
//     }
// 
//     public static class BeanValidationError {
// 
//         /**
//          * Validation errors logging level.
//          */
//         private LoggingLevel loggingLevel = WARN;
// 
//         public LoggingLevel getLoggingLevel() {
//             return loggingLevel;
//         }
// 
//         public void setLoggingLevel(LoggingLevel loggingLevel) {
//             this.loggingLevel = loggingLevel;
//         }
//     }
// 
//     public static class HttpClientError {
// 
//         /**
//          * HTTP 4xx errors logging level.
//          */
//         private LoggingLevel loggingLevel = WARN;
// 
//         public LoggingLevel getLoggingLevel() {
//             return loggingLevel;
//         }
// 
//         public void setLoggingLevel(LoggingLevel loggingLevel) {
//             this.loggingLevel = loggingLevel;
//         }
//     }
// }
// 
// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/security/AccessDeniedErrorDataProvider.java
// public class AccessDeniedErrorDataProvider extends SecurityErrorDataProvider<AccessDeniedException> {
// 
//     public AccessDeniedErrorDataProvider(ErrorestProperties errorestProperties) {
//         super(errorestProperties);
//     }
// 
//     @Override
//     protected HttpStatus getResponseHttpStatus() {
//         return FORBIDDEN;
//     }
// 
//     @Override
//     protected String getErrorDescription(String requestHeaders) {
//         return "Access denied for request with headers: " + requestHeaders;
//     }
// }
// 
// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/security/AuthenticationErrorDataProvider.java
// public class AuthenticationErrorDataProvider extends SecurityErrorDataProvider<AuthenticationException> {
// 
//     public AuthenticationErrorDataProvider(ErrorestProperties errorestProperties) {
//         super(errorestProperties);
//     }
// 
//     @Override
//     protected HttpStatus getResponseHttpStatus() {
//         return UNAUTHORIZED;
//     }
// 
//     @Override
//     protected String getErrorDescription(String requestHeaders) {
//         return "Authentication failed for request with headers: " + requestHeaders;
//     }
// }


// Path: src/main/java/com/github/mkopylec/errorest/handling/errordata/SecurityErrorDataProviderContext.java
import com.github.mkopylec.errorest.configuration.ErrorestProperties;
import com.github.mkopylec.errorest.handling.errordata.security.AccessDeniedErrorDataProvider;
import com.github.mkopylec.errorest.handling.errordata.security.AuthenticationErrorDataProvider;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.core.AuthenticationException;

package com.github.mkopylec.errorest.handling.errordata;


public class SecurityErrorDataProviderContext extends ErrorDataProviderContext {

    public SecurityErrorDataProviderContext(ErrorestProperties errorestProperties) {
        super(errorestProperties);
    }

    @Override
    public <T extends Throwable> ErrorDataProvider getErrorDataProvider(T ex) {
        if (ex instanceof AccessDeniedException) {
            return new AccessDeniedErrorDataProvider(errorestProperties);