// Path: src/main/java/org/wickedsource/gitanizer/mirror/git/PublicGitRepositoryResolver.java
// @Component
// public class PublicGitRepositoryResolver extends AbstractGitRepositoryResolver {
// 
//     @Autowired
//     public PublicGitRepositoryResolver(WorkdirConfiguration workdirConfiguration, MirrorRepository mirrorRepository) {
//         super(workdirConfiguration, mirrorRepository);
//     }
// 
//     protected boolean isAuthorizedForMirror(Mirror mirror) {
//         return !mirror.isGitRepositoryRestricted();
//     }
// }
// 
// Path: src/main/java/org/wickedsource/gitanizer/mirror/git/SecureGitRepositoryResolver.java
// @Component
// public class SecureGitRepositoryResolver extends AbstractGitRepositoryResolver {
// 
//     @Autowired
//     public SecureGitRepositoryResolver(WorkdirConfiguration workdirConfiguration, MirrorRepository mirrorRepository) {
//         super(workdirConfiguration, mirrorRepository);
//     }
// 
//     protected boolean isAuthorizedForMirror(Mirror mirror) {
//         SecurityContext securityContext = SecurityContextHolder.getContext();
//         if (securityContext == null) {
//             return false;
//         }
//         Authentication authentication = securityContext.getAuthentication();
//         if (authentication == null) {
//             return false;
//         }
// 
//         String requiredRole = GitanizerSecurityConfiguration.getAuthorityNameForMirror(mirror.getId());
//         for (GrantedAuthority auth : authentication.getAuthorities()) {
//             if (requiredRole.equals(auth.getAuthority())) {
//                 return true;
//             }
//         }
// 
//         return false;
//     }
// 
// }


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.wickedsource.gitanizer.mirror.git.PublicGitRepositoryResolver;
import org.wickedsource.gitanizer.mirror.git.SecureGitRepositoryResolver;
package org.wickedsource.gitanizer.core.thymeleaf;


@Configuration
public class ResourcesConfiguration extends WebMvcConfigurerAdapter {

    private SecureGitRepositoryResolver secureGitRepositoryResolver;

    private PublicGitRepositoryResolver publicGitRepositoryResolver;

    @Autowired
// Path: src/main/java/org/wickedsource/gitanizer/mirror/git/PublicGitRepositoryResolver.java
// @Component
// public class PublicGitRepositoryResolver extends AbstractGitRepositoryResolver {
// 
//     @Autowired
//     public PublicGitRepositoryResolver(WorkdirConfiguration workdirConfiguration, MirrorRepository mirrorRepository) {
//         super(workdirConfiguration, mirrorRepository);
//     }
// 
//     protected boolean isAuthorizedForMirror(Mirror mirror) {
//         return !mirror.isGitRepositoryRestricted();
//     }
// }
// 
// Path: src/main/java/org/wickedsource/gitanizer/mirror/git/SecureGitRepositoryResolver.java
// @Component
// public class SecureGitRepositoryResolver extends AbstractGitRepositoryResolver {
// 
//     @Autowired
//     public SecureGitRepositoryResolver(WorkdirConfiguration workdirConfiguration, MirrorRepository mirrorRepository) {
//         super(workdirConfiguration, mirrorRepository);
//     }
// 
//     protected boolean isAuthorizedForMirror(Mirror mirror) {
//         SecurityContext securityContext = SecurityContextHolder.getContext();
//         if (securityContext == null) {
//             return false;
//         }
//         Authentication authentication = securityContext.getAuthentication();
//         if (authentication == null) {
//             return false;
//         }
// 
//         String requiredRole = GitanizerSecurityConfiguration.getAuthorityNameForMirror(mirror.getId());
//         for (GrantedAuthority auth : authentication.getAuthorities()) {
//             if (requiredRole.equals(auth.getAuthority())) {
//                 return true;
//             }
//         }
// 
//         return false;
//     }
// 
// }


// Path: src/main/java/org/wickedsource/gitanizer/core/thymeleaf/ResourcesConfiguration.java
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.wickedsource.gitanizer.mirror.git.PublicGitRepositoryResolver;
import org.wickedsource.gitanizer.mirror.git.SecureGitRepositoryResolver;

package org.wickedsource.gitanizer.core.thymeleaf;


@Configuration
public class ResourcesConfiguration extends WebMvcConfigurerAdapter {

    private SecureGitRepositoryResolver secureGitRepositoryResolver;

    private PublicGitRepositoryResolver publicGitRepositoryResolver;

    @Autowired
    public ResourcesConfiguration(SecureGitRepositoryResolver secureGitRepositoryResolver, PublicGitRepositoryResolver publicGitRepositoryResolver) {