package com.bio.bio_backend.global.security;


import java.util.Arrays;
import java.util.regex.Pattern;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import jakarta.servlet.http.HttpServletRequest;

@Component
public class UriAllowFilter {
	
	@Autowired
//	ProgramService programService;
		
	public boolean authExceptionAllow(HttpServletRequest request)	{
		// 임시로 모든 요청 허용
		return true;
		
		// String[] allowUrl = programService.getAuthException();
		// boolean success = Arrays.stream(allowUrl).anyMatch(pattern -> matches(pattern, request.getRequestURI()));
        // return success;
	}
	
    boolean matches(String pattern, String uri) { 
        String regex = pattern.replace("/**", "(/.*)?").replace("*", ".*"); 
        return Pattern.matches(regex, uri);
    }    
}
