vaadin / quarkus

An extension to Quarkus to support Vaadin Flow
Apache License 2.0
28 stars 3 forks source link

Integrate Quarkus provided security into TestBench UI Unit testing mocks #141

Closed mshabarov closed 4 months ago

mshabarov commented 7 months ago

TestBench UI Unit testing framework has only an integration with Spring Security in SpringSecurityRequestCustomizer, but doesn't take into account Quarkus Security.

This lead to Vaadin routes/views aren't available in Quarkus Tests.

Quarkus add-on should take Quarkus security context/parameters into account in TestBench mocks:

  1. Quarkus SecurityIdentity bean can be used in custom implementation of MockRequestCustomizer to set the principal, roles and other attributes to Vaadin Request mocks.
  2. Integration for Quarkus AtTestSecurity annotation.
  3. Or, as an alternative, provide an API for developers in Quarkus add-on for setting these security attributes manually in test classes.

Originally reported in https://github.com/vaadin/quarkus/issues/121.

See workarounds https://github.com/vaadin/quarkus/issues/121#issuecomment-1639584694 and https://github.com/AliceAndTheBuilders/pro-starter-flow-quarkus/blob/32f23c27e1509d016002b5032f3d4d14f2d0df97/src/test/java/com/example/starter/pro/UIUnitTestHelper.java#L46