Skip to content

Commit

Permalink
#94 update README.md and link #94 and #180
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Dec 18, 2024
1 parent 3e9211f commit 7fb5eab
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions karibu-testing-v10-spring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ simple example projects that might help you get started.
Please see [t-shirt shop example](https://github.com/mvysny/t-shirt-shop-example) on
an example on how to use Karibu-Testing with a Spring app.

Note that Spring Security is not supported: Spring Security uses Servlet Filter
which requires Servlet Container to be up and running, yet Karibu-Testing doesn't
start any Servlet Container. See [Issue #47](https://github.com/mvysny/karibu-testing/issues/47)
for more details.

## Adding to your project

Add the following dependencies to your project's `pom.xml`:
Expand All @@ -34,3 +29,22 @@ The first dependency will add the Karibu-Testing core jar (`karibu-testing-v10`)
jar on top of that (`karibu-testing-v10-spring`); the second dependency
will add additional support for testing Vaadin 23 components such as `VirtualList`
and `MultiselectComboBox`.

## Spring Security

Spring Security is not supported out-of-the-box: Spring Security usually uses Servlet Filter
which requires Servlet Container to be up and running, yet Karibu-Testing doesn't
start any Servlet Container. See [Issue #47](https://github.com/mvysny/karibu-testing/issues/47)
for more details.

There are ways to enable Spring Security in Karibu's faked environment though, please
take a look at [issue #94](https://github.com/mvysny/karibu-testing/issues/94) and
[issue #180](https://github.com/mvysny/karibu-testing/issues/180). Namely, users
reported the following snippet to work - must be called before `MockVaadin.setup()`:
```kotlin
MockVaadin.mockRequestFactory = {
object : FakeRequest(it) {
override fun getUserPrincipal() = SecurityContextHolder.getContext().authentication
}
}
```

0 comments on commit 7fb5eab

Please sign in to comment.