Skip to content

Commit

Permalink
Be/cors (#101)
Browse files Browse the repository at this point in the history
* chore: 주석 추가

* fix: 잘못된 값 수정

* fix

* fix

* fix
  • Loading branch information
zzawang authored May 31, 2024
1 parent 4dfafcd commit 2d2815a
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.Iterator;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.web.servlet.HandlerInterceptor;

@RequiredArgsConstructor
Expand All @@ -31,6 +32,22 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
log.info("authorization - {}", authorization);
log.info("accessToken - {}", accessToken);

log.info("Method - {}", request.getMethod());
if (request.getMethod().equals(HttpMethod.OPTIONS.name())) {
return true;
}

Iterator<String> headerNames = request.getHeaderNames().asIterator();
while ((headerNames.hasNext())) {
String next = headerNames.next();
String header = request.getHeader(next);
log.info("{} header - {}", next, header);
}

log.info("bearer - {}", request.getHeader("Bearer"));
log.info("authorization - {}", authorization);
log.info("accessToken - {}", accessToken);

if (accessToken == null) {
throw new UnauthorizedException();
}
Expand Down

0 comments on commit 2d2815a

Please sign in to comment.