Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add enpoint to whitelist #76

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
"/webjars/**")
.permitAll()
// TODO list all the endpoint for the spotlightPublisherLambda
.antMatchers("/spotlight-batch/**").permitAll().anyRequest().authenticated())
.antMatchers("/spotlight-batch/**", "/spotlight-submissions/**").permitAll().anyRequest()
.authenticated())

.formLogin().disable().httpBasic().disable().logout().disable().csrf().disable().exceptionHandling()
.authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ public AuthorizationHeaderInterceptor(String expectedAuthorizationValue) {

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
log.info("Intercepting request: " + request.getRequestURI());
if (handler instanceof HandlerMethod) {
final HandlerMethod handlerMethod = (HandlerMethod) handler;
final Method method = handlerMethod.getMethod();

SpotlightPublisherHeaderValidator annotation = method
.getAnnotation(SpotlightPublisherHeaderValidator.class);
log.info("SpotlightPublisherHeaderValidator: " + annotation);

if (annotation != null) {
final String authorizationHeader = request.getHeader(HttpHeaders.AUTHORIZATION);
Expand Down