Closed Darlynnnn closed 9 months ago
Same issue here
I'm using spring boot 3.1.5 and spring cloud 2022.0.3 and I was able to achieve the basic authentication for service registry.
This is my config on eureka
spring:
application:
name: test
security:
user:
name: test
password: test
server:
port: 8888
eureka:
client:
serviceUrl:
defaultZone: http://localhost:${server.port}/eureka/
instance:
preferIpAddress: true
instanceId: ${spring.application.name}:${random.int}
And this is the filterChain to disable the csrf
@Configuration
public class WebSecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http.csrf(AbstractHttpConfigurer::disable).securityMatcher("/eureka/**").build();
}
}
And these are the properties I'm passing from the service which is supposed to be registered in eureka
eureka.client.fetch-registry=true;
eureka.client.register-with-eureka=true;
eureka.client.service-url.default-zone=http://test:test@localhost:8888/eureka/
Even I am also facing same issue. I am stuck here from past 2 weeks. Need urgent help
Hello @Darlynnnn, @oluwatobiiloba, @Narendranath2, @yashkumar7889 , please see the proper configuration in the docs. You can also see a sample here. If you still have an issue after trying that, please provide a minimal, complete, verifiable example that reproduces the issue, as a link to a GitHub repo with an executable app. Please make sure to use Spring Boot 3.2.x
and Spring Cloud 2023.0.x
in your samples, as these are the only versions that are currently in OSS support.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
I got the solution. date 2/20/2024. Problem was that This guy(who asked the question) was using old video to learn spring microservice. In that video the video-maker uses old way to add security-filter-chain. But the way he disables csrf method is useless at this moment. So ,in short , problem is csfr. as this guy Narendranath2 shows you need to add .securityMatcher("/eureka/**") at the end of csrf method , otherwise the so-called issue happens
I have eureka server:
Config:
application.properties:
This "works" , go into localhost:8761, input eureka/password as name/password and im in.
Now i have client that i want to register in the eureka server.
I have this in application.properties:
Upon starting the app i receive:
*
*
I tried solution presented here e.g using
in server properties.
i have csrf disabled as most of the answers to this problem says its csrf problem,
i have tried to add custom restBean according to this post, e.g
in my client service, however the problem remains the same.
is there any solution to this problem or do i have to downgrade versions?
I am using:
for client as
for server with
Using code samples from docs and github results in the same error...
Thanks for help