Authentication in integration tests in multitenancy application

IN the past I ran into issues with users testing as global admin in my multitenant setup. I there now enforce non-nullability on all my business entities.

I was using the generated AuthenticatedAsTestUser as documented. This of course no longer works and all my tests fail. I need to have a tenant user with full-access-role.

I see a few options in how to resolve this

  1. insert a tenant user, test|user
  2. mock out one of the security related classes.
  3. provide an additional AuthenticationProvider as a test component.

What is the recommended approach, and do you happen to have a sample?

:warning: UPDATE
I experimented a bit and changed my mind on how to solve this.

My initial concern was just to get an authenticated user. But If in option 2 and 3, there Is no actual user in the db and it will cause other problems.

In addition I also want to be able to write simple security tests by setting up

  1. user with a role, action allowed
  2. user without role action disallowed