i created spring cloud application using consul services discovery/registry. have configured spring security follow:
@override protected void configure(httpsecurity http) throws exception { http .exceptionhandling() .authenticationentrypoint(myentrypoint()); http .authorizerequests() .antmatchers("/images/**").permitall() .antmatchers("/modules/**").permitall() .antmatchers("/vendor/**").permitall() .antmatchers("/views/**").permitall() .antmatchers("/index.html").permitall() .regexmatchers("/health").permitall()// consul check health .antmatchers("/api/**").authenticated() .antmatchers("/**").permitall(); http // login configuration .addfilterafter(springsecurityfilter(), basicauthenticationfilter.class); http //logout configuration .logout() .logoutsuccesshandler(logouthandler()); http.csrf().disable(); }
normally, using filter spring consul health check doesn't pass filter (public access).
but consul health check consul pass filter.
if use following url i'm redirected authentication page:
https://localhost:8181/health
Comments
Post a Comment