Liftwizard supports the dynamic configuration of dropwizard-auth which enables using different authorization methods in production and tests, without adding conditionals - without adding any code at all. For example, we can configure impersonation authorization in tests with the following config. Setup To get started, add a dependency on and add to the registered bundles. Modify the application's configuration class to implement and add a dependency on if it does not already extend . Test configuration For tests, you'll typically want to use header-based impersonation. Add a dependency on . Add an list to containing just one filter, of type . Test code Impersonation authorization works well in tests that uses Dropwizard test utilities, like , , or . There is no change to test setup code, only to the test configuration file. The test code will include headers on client requests, like this. Whenever we use , some of our Jersey resource methods will be authenticated. The authenticated methods will be annotated with a security annotation such as . The user principal will be passed in as a parameter and annotated like . The header authorizer will take the string passed in the header ( in this example), remove its prefix (), and make that string accessible via . Since the header is sent on each request, we can write tests involving multiple users. For example, we can write a test that asserts: can create an entry, and gets HTTP 201 Created. cannot edit or delete the entry, and gets HTTP 403 Forbidden. can edit or delete the entry, and gets HTTP 200 OK. Production configuration The production authentication filter dependencies and configuration will depend on the method of authentication used in production. For example, the configuration to use Firebase for auth would look like this. { authFilters: [ { type: "header", header: "Authorization", prefix: "Impersonation", }, ], } liftwizard-bundle-auth-filter AuthFilterBundle AuthFilterFactoryProvider liftwizard-config-auth-filter AbstractLiftwizardConfiguration liftwizard-config-auth-filter-header <dependency> <groupId>io.liftwizard</groupId> <artifactId>liftwizard-config-auth-filter-header</artifactId> <scope>test</scope> </dependency> authFilters config-test.json5 header { authFilters: [ { type: "header", header: "Authorization", prefix: "Impersonation", }, ], } DropwizardAppExtension LiftwizardAppExtension DropwizardAppRule @Test void smokeTest() { Client client = this.appExtension.client(); Response response = client .target("http://localhost:{port}/api/example") .resolveTemplate("port", this.appExtension.getLocalPort()) .request() .header("Authorization", "Impersonation User ID") .get(); // add assertions here } dropwizard-auth @PermitAll @Auth Principal principal "Impersonation User ID" "User ID" principal.getName() User 1 User 2 User 1 { authFilters: [ { type: "firebase", databaseUrl: "https://example.firebaseio.com", firebaseConfig: "${FIREBASE_CONFIG}", }, ], }