cancel
Showing results for 
Search instead for 
Did you mean: 

The client is unauthorized due to authentication in my Spring Boot Test

sngermiyanoglu
Node Clone

Hi,

I have a problem about running any test of AppApplicationTests.

When I run with docker and try any request, I cannot have any issue.

org.neo4j.driver.exceptions.AuthenticationException: The client is unauthorized due to authentication failure.

How can I fix this codes snippet shown below.

@DynamicPropertySource
static void properties(DynamicPropertyRegistry registry) {
registry.add("spring.neo4j.authentication.username", () -> "neo4j");
registry.add("spring.neo4j.authentication.password", () -> "123456");
registry.add("spring.neo4j.uri", () -> container.getBoltUrl());
}

Here is my repository : Project Link 

1 ACCEPTED SOLUTION

sngermiyanoglu
Node Clone

Here is the solution

The issue disappeared when the password changed to ``````container.getAdminPassword()``

 

@DynamicPropertySource
static void properties(DynamicPropertyRegistry registry) {
    registry.add("spring.neo4j.authentication.username", () -> "neo4j");
    registry.add("spring.neo4j.authentication.password", () -> container.getAdminPassword());
    registry.add("spring.neo4j.uri", () -> container.getBoltUrl());
}

 

View solution in original post

1 REPLY 1

sngermiyanoglu
Node Clone

Here is the solution

The issue disappeared when the password changed to ``````container.getAdminPassword()``

 

@DynamicPropertySource
static void properties(DynamicPropertyRegistry registry) {
    registry.add("spring.neo4j.authentication.username", () -> "neo4j");
    registry.add("spring.neo4j.authentication.password", () -> container.getAdminPassword());
    registry.add("spring.neo4j.uri", () -> container.getBoltUrl());
}