Skip to content

Commit

Permalink
Merge pull request #11 from Staketab/dev
Browse files Browse the repository at this point in the history
fix problem with filter
  • Loading branch information
sineDtS authored Feb 23, 2024
2 parents 518ab7e + 0482b6a commit 96e4cc4
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
@Slf4j
public class ApiKeyRequestFilter extends GenericFilterBean {
private final ApiKeyRepository apiKeyRepository;
public static final String API_CREATE = "/domains/save";
public static final String API_UPDATE = "/domains/edit";
public static final String API_CREATE = "/api/domains/save";
public static final String API_UPDATE = "/api/domains/edit";

public ApiKeyRequestFilter(ApiKeyRepository apiKeyRepository) {
this.apiKeyRepository = apiKeyRepository;
Expand All @@ -32,12 +32,11 @@ public ApiKeyRequestFilter(ApiKeyRepository apiKeyRepository) {
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) servletRequest;
String path = req.getRequestURI();
System.out.println("path: " + path);
String key = req.getHeader(API_KEY_HEADER) == null ? "" : req.getHeader(API_KEY_HEADER);

if(!path.startsWith(API_CREATE) && !path.startsWith(API_UPDATE)){
System.out.println("in if");
filterChain.doFilter(servletRequest, servletResponse);
return;
}

log.debug("Trying authorize with x-api-key: " + key);
Expand Down

0 comments on commit 96e4cc4

Please sign in to comment.