diff --git a/spring-session-samples/spring-session-sample-boot-jdbc-json-attribute/src/main/resources/application.properties b/spring-session-samples/spring-session-sample-boot-jdbc-json-attribute/src/main/resources/application.properties index e8e848d11..8b21caa8f 100644 --- a/spring-session-samples/spring-session-sample-boot-jdbc-json-attribute/src/main/resources/application.properties +++ b/spring-session-samples/spring-session-sample-boot-jdbc-json-attribute/src/main/resources/application.properties @@ -1,3 +1,4 @@ +spring.security.user.name=rüdiger spring.security.user.password=password spring.session.jdbc.schema=classpath:schema.sql spring.session.jdbc.initialize-schema=always diff --git a/spring-session-samples/spring-session-sample-boot-jdbc-json-attribute/src/test/java/sample/JdbcJsonAttributeTests.java b/spring-session-samples/spring-session-sample-boot-jdbc-json-attribute/src/test/java/sample/JdbcJsonAttributeTests.java index d285d015a..6ca6bb1b8 100644 --- a/spring-session-samples/spring-session-sample-boot-jdbc-json-attribute/src/test/java/sample/JdbcJsonAttributeTests.java +++ b/spring-session-samples/spring-session-sample-boot-jdbc-json-attribute/src/test/java/sample/JdbcJsonAttributeTests.java @@ -47,7 +47,7 @@ void setup() { @Test void loginShouldSaveSecurityContextAsJson() throws Exception { - Cookie sessionCookie = this.mvc.perform(formLogin().user("user").password("password")) + Cookie sessionCookie = this.mvc.perform(formLogin().user("rĂ¼diger").password("password")) .andExpect(authenticated()) .andReturn() .getResponse() @@ -62,20 +62,20 @@ void loginShouldSaveSecurityContextAsJson() throws Exception { SecurityContext securityContext = this.objectMapperWithModules.readValue((String) attributeBytes, SecurityContext.class); assertThat(securityContext).isNotNull(); - assertThat(securityContext.getAuthentication().getName()).isEqualTo("user"); + assertThat(securityContext.getAuthentication().getName()).isEqualTo("rĂ¼diger"); } @Test void loginWhenQueryUsingJsonbOperatorThenReturns() throws Exception { - this.mvc.perform(formLogin().user("user").password("password")).andExpect(authenticated()); + this.mvc.perform(formLogin().user("rĂ¼diger").password("password")).andExpect(authenticated()); Object attributeBytes = this.jdbcClient.queryForObject(""" SELECT attribute_bytes::text FROM spring_session_attributes - WHERE attribute_bytes -> 'authentication' -> 'principal' ->> 'username' = 'user' + WHERE attribute_bytes -> 'authentication' -> 'principal' ->> 'username' = 'rĂ¼diger' """, Object.class); SecurityContext securityContext = this.objectMapperWithModules.readValue((String) attributeBytes, SecurityContext.class); assertThat(securityContext).isNotNull(); - assertThat(securityContext.getAuthentication().getName()).isEqualTo("user"); + assertThat(securityContext.getAuthentication().getName()).isEqualTo("rĂ¼diger"); } }