0

I am trying to build a hawkBit instance with multiple Users. But everytime it throws an error like this:

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.897 s <<< FAILURE! - in org.eclipse.hawkbit.app.CorsTest
[ERROR] validateCorsRequest  Time elapsed: 0.028 s  <<< ERROR!
java.lang.IllegalStateException: Unable to create SecurityContext using @org.springframework.security.test.context.support.WithUserDetails(setupBefore=TEST_METHOD, userDetailsServiceBeanName=, value=admin)
Caused by: org.springframework.security.core.userdetails.UsernameNotFoundException: No such user

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   CorsTest.validateCorsRequest ยป IllegalState Unable to create SecurityContext u...
[INFO]
[ERROR] Tests run: 4, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for hawkBit :: Parent 0.3.0-SNAPSHOT:

...
[INFO] hawkBit :: Runtime ................................. SUCCESS [  0.038 s]
[INFO] hawkBit :: Runtime :: Update Server ................ FAILURE [ 25.548 s]
[INFO] hawkBit :: Test Report ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12:38 min
[INFO] Finished at: 2022-09-14T08:43:00+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project hawkbit-update-server: There are test failures.
[ERROR]
...

My application.properties look like this:

# User Security
spring.security.user.name=admin
spring.security.user.password={bcrypt}$2a$12$ycF.o9IdsOlvy/3ML1qFgunkPuQ9P/xl38mO2EJ2uukFwqqLtoQjS
spring.main.allow-bean-definition-overriding=true

# Http Encoding
server.servlet.encoding.charset=UTF-8
server.servlet.encoding.enabled=true
server.servlet.encoding.force=true

# DDI authentication configuration
hawkbit.server.ddi.security.authentication.anonymous.enabled=false
hawkbit.server.ddi.security.authentication.targettoken.enabled=true
hawkbit.server.ddi.security.authentication.gatewaytoken.enabled=false

# Optional events
hawkbit.server.repository.publish-target-poll-event=false

# Disable DMF
hawkbit.dmf.rabbitmq.enabled=false

# Define own users instead of default "admin" user:
hawkbit.server.im.users[0].username=hawkbit
hawkbit.server.im.users[0].password={bcrypt}$2a$12$uPxtF4ae46PikuLCtBuGaOffoQ.exaKFWh0TEeh47YH9kYP.z.03y
hawkbit.server.im.users[0].firstname=Eclipse
hawkbit.server.im.users[0].lastname=HawkBit
hawkbit.server.im.users[0].permissions=ALL

spring.profiles.active=mysql

# SSL

server.port=8443
hawkbit.artifact.url.protocols.download-http.protocol=https
hawkbit.artifact.url.protocols.download-http.port=8443
security.require-ssl=true
server.use-forward-headers=true

server.ssl.key-store=hb-cert.jks
server.ssl.key-password=hb-cert
server.ssl.key-store-password=hb-cert

Even if I try to run it without the

spring.security.user.name=admin
spring.security.user.password={bcrypt}$2a$12$ycF.o9IdsOlvy/3ML1qFgunkPuQ9P/xl38mO2EJ2uukFwqqLtoQjS

it throws this error. The bcryps hashes are all ok. The hash for admin is admin and forhawkbit is isAwesome!. I tried one or multiple users with changing the 0 to 1,2,... but it is always the same. Do you have any Ideas?

lreinecke
  • 1
  • 1

0 Answers0