Skip to content

Commit

Permalink
fix: cleanup the CertificateOrAuthProtectedEndpoints security config
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Salac <[email protected]>
  • Loading branch information
richard-salac committed Feb 5, 2025
1 parent b1ad98f commit 7d8edfe
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -502,15 +502,6 @@ class CertificateOrAuthProtectedEndpoints {
private final CompoundAuthProvider compoundAuthProvider;
private final AuthenticationProvider tokenAuthenticationProvider;

private final String[] protectedEndpoints = {
SafResourceAccessController.FULL_CONTEXT_PATH,
"/application",
"/gateway/conformance",
"/gateway/api/v1/conformance",
"/gateway/validate",
"/gateway/api/v1/validate"
};

@Bean
public SecurityFilterChain certificateOrAuthEndpointsFilterChain(HttpSecurity http) throws Exception {
baseConfigure(
Expand All @@ -529,7 +520,7 @@ public SecurityFilterChain certificateOrAuthEndpointsFilterChain(HttpSecurity ht
// filter out API ML certificate
.addFilterBefore(reversedCategorizeCertFilter(), org.springframework.security.web.authentication.preauth.x509.X509AuthenticationFilter.class);
} else {
http.addFilterAfter(new CategorizeCertsFilter(publicKeyCertificatesBase64, certificateValidator), org.springframework.security.web.authentication.preauth.x509.X509AuthenticationFilter.class);
http.x509(x509 -> x509.userDetailsService(x509UserDetailsService())); // default x509 filter, authenticates trusted cert
}

return http.authenticationProvider(compoundAuthProvider) // for authenticating credentials
Expand Down Expand Up @@ -558,7 +549,7 @@ private BasicContentFilter basicFilter(AuthenticationManager authenticationManag
authenticationManager,
handlerInitializer.getAuthenticationFailureHandler(),
handlerInitializer.getResourceAccessExceptionHandler(),
protectedEndpoints);
new String[] {"/"});
}

/**
Expand All @@ -570,7 +561,7 @@ private CookieContentFilter cookieFilter(AuthenticationManager authenticationMan
handlerInitializer.getAuthenticationFailureHandler(),
handlerInitializer.getResourceAccessExceptionHandler(),
authConfigurationProperties,
protectedEndpoints);
new String[] {"/"});
}

/**
Expand All @@ -581,7 +572,7 @@ private BearerContentFilter bearerContentFilter(AuthenticationManager authentica
authenticationManager,
handlerInitializer.getAuthenticationFailureHandler(),
handlerInitializer.getResourceAccessExceptionHandler(),
protectedEndpoints);
new String[] {"/"});
}
}

Expand Down

0 comments on commit 7d8edfe

Please sign in to comment.