@Test public void testLogout() { accountResource.uriInfo = new ResteasyUriInfo("account/logout", "", ""); Response response = accountResource.logout(); verify(authenticatedAccount).setAuthenticatedAccount(null); verify(authenticatedAccount).setAuthenticatedUsername(null); assertThat(response.getStatus()).isEqualTo(200); }
@POST @Path("/logout") public Response logout() { authenticatedAccount.setAuthenticatedAccount(null); authenticatedAccount.setAuthenticatedUsername(null); NewCookie cookie = generateCookie(COOKIE_MIN_AGE, ""); return Response.ok().cookie(cookie).build(); }
AccountResourceImpl { @POST @Path("/logout") public Response logout() { authenticatedAccount.setAuthenticatedAccount(null); authenticatedAccount.setAuthenticatedUsername(null); NewCookie cookie = generateCookie(COOKIE_MIN_AGE, ""); return Response.ok().cookie(cookie).build(); } }
AccountResourceImpl { @POST @Path("/logout") public Response logout() { authenticatedAccount.setAuthenticatedAccount(null); authenticatedAccount.setAuthenticatedUsername(null); NewCookie cookie = generateCookie(COOKIE_MIN_AGE, ""); return Response.ok().cookie(cookie).build(); } @Inject  AccountResourceImpl(AccountService accountService,
        AuthenticatedAccount authenticatedAccount,
        Event<AccountCreated> accountCreatedEvent); @SuppressWarnings("unused")  AccountResourceImpl(); }
AccountResourceImpl { @POST @Path("/logout") public Response logout() { authenticatedAccount.setAuthenticatedAccount(null); authenticatedAccount.setAuthenticatedUsername(null); NewCookie cookie = generateCookie(COOKIE_MIN_AGE, ""); return Response.ok().cookie(cookie).build(); } @Inject  AccountResourceImpl(AccountService accountService,
        AuthenticatedAccount authenticatedAccount,
        Event<AccountCreated> accountCreatedEvent); @SuppressWarnings("unused")  AccountResourceImpl(); @GET @CheckRole("admin") List<AccountDto> getAllAccounts(@QueryParam("enabledOnly") boolean enabledOnly); @ValidatePayload(AccountDto.class) @POST @CheckRole("admin") Response registerNewAccount(AccountDto accountDto); @ValidatePayload(AccountDto.class) @PUT @CheckRole("admin") Response updateAccount(AccountDto accountDto); @POST @Path("/login") Response login(@HeaderParam("Authorization") String authHeader); @POST @Path("/logout") Response logout(); }
AccountResourceImpl { @POST @Path("/logout") public Response logout() { authenticatedAccount.setAuthenticatedAccount(null); authenticatedAccount.setAuthenticatedUsername(null); NewCookie cookie = generateCookie(COOKIE_MIN_AGE, ""); return Response.ok().cookie(cookie).build(); } @Inject  AccountResourceImpl(AccountService accountService,
        AuthenticatedAccount authenticatedAccount,
        Event<AccountCreated> accountCreatedEvent); @SuppressWarnings("unused")  AccountResourceImpl(); @GET @CheckRole("admin") List<AccountDto> getAllAccounts(@QueryParam("enabledOnly") boolean enabledOnly); @ValidatePayload(AccountDto.class) @POST @CheckRole("admin") Response registerNewAccount(AccountDto accountDto); @ValidatePayload(AccountDto.class) @PUT @CheckRole("admin") Response updateAccount(AccountDto accountDto); @POST @Path("/login") Response login(@HeaderParam("Authorization") String authHeader); @POST @Path("/logout") Response logout(); final static String AUTH_HEADER; }