0

I am trying to implement a Spring boot cloud config server.

My application.properties file:

#Server port
server.port=8888

#Git repo location.
spring.cloud.config.server.git.uri=/home/pawan/git/config-server-repo

#Disable security of the Management endpoint
management.security.enabled=false

Main class:

@EnableConfigServer
@SpringBootApplication
public class ConfigServer {

    public static void main(String[] args) {
        SpringApplication.run(ConfigServer.class, args);
    }
}

The problem is, when I am trying to hit the client config property from browser url like http://localhost:8888/client-config/test, I am being redirected to the login page.

config-server-browser-screenshot

Config Server startup log:

    > Task :bootRun
2019-07-10 16:14:29.117  INFO 8935 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a652cf6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.6.RELEASE)

2019-07-10 16:14:30.390  INFO 8935 --- [           main] com.bizlers.cloud.config.ConfigServer    : No active profile set, falling back to default profiles: default
2019-07-10 16:14:32.036  INFO 8935 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=6f9cbfc9-e5b5-3f1c-b6b3-2dde90ebde06
2019-07-10 16:14:32.107  INFO 8935 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a652cf6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-10 16:14:32.558  INFO 8935 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8888 (http)
2019-07-10 16:14:32.602  INFO 8935 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-07-10 16:14:32.603  INFO 8935 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.21]
2019-07-10 16:14:32.744  INFO 8935 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-07-10 16:14:32.744  INFO 8935 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2335 ms
2019-07-10 16:14:34.095  INFO 8935 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-07-10 16:14:34.638  INFO 8935 --- [           main] .s.s.UserDetailsServiceAutoConfiguration : 

Using generated security password: 844bac77-1ec4-4f76-bebc-0460c3b36e6f

2019-07-10 16:14:34.773  INFO 8935 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@1ab53860, org.springframework.security.web.context.SecurityContextPersistenceFilter@3ffd4b12, org.springframework.security.web.header.HeaderWriterFilter@274fdea6, org.springframework.security.web.csrf.CsrfFilter@5d7f8467, org.springframework.security.web.authentication.logout.LogoutFilter@2dd0a0d0, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@24a04257, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@633ddc0c, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@7b5ac347, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@6d6039df, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@2ad7bd26, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@76a6f045, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@57b9389f, org.springframework.security.web.session.SessionManagementFilter@2a484710, org.springframework.security.web.access.ExceptionTranslationFilter@3f6c2763, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@150d6eaf]
2019-07-10 16:14:34.808  INFO 8935 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2019-07-10 16:14:35.881  INFO 8935 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-07-10 16:14:36.223  INFO 8935 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8888 (http) with context path ''
2019-07-10 16:14:36.225  INFO 8935 --- [           main] com.bizlers.cloud.config.ConfigServer    : Started ConfigServer in 9.234 seconds (JVM running for 9.956)
2019-07-10 16:14:45.838  INFO 8935 --- [nio-8888-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-07-10 16:14:45.838  INFO 8935 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2019-07-10 16:14:45.849  INFO 8935 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 11 ms

I have also tried adding security.basic.enabled=false in the application.properties but it is not helping.

Dependencies:

  • springBootVersion = '2.1.6.RELEASE'
  • springCloudVersion = "Greenwich.SR1"
Marko Previsic
  • 1,820
  • 16
  • 30
Pawan
  • 1,183
  • 16
  • 29

1 Answers1

0

management.security.enabled was used with spring boot actuator version 1. Since Spring boot 2, you have to/can configure the security of your endpoint using :

<dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-security</artifactId>
</dependency>

See this link for more info : https://spring.io/guides/gs/securing-web/.

I suggest you to check your security config, one of rule requires an authenticated user.

RUARO Thibault
  • 2,672
  • 1
  • 9
  • 14
  • it's been a long time I had look on this question. I will try this solution as soon as I get some time and revert. – Pawan Jun 10 '20 at 10:56