LoginAllowedSecurityService implements SecurityService { @Override public Authentication getAuthentication(String authenticationToken) { Authentication auth = new Authentication(); auth.setAuthorizations(new BaseAuthorization[]{new LoginAuthorization()}); auth.setUserId("anonymous"); return auth; }  @Override String getId(); @Override Authentication getAuthentication(String authenticationToken);  }
@Test public void testLoginAllowedService() { LoginAllowedSecurityService service = new LoginAllowedSecurityService(); Authentication auth = service.getAuthentication("bla"); Assert.assertNotNull(auth); Assert.assertEquals(1, auth.getAuthorizations().length); BaseAuthorization authorization = auth.getAuthorizations()[0]; Assert.assertTrue(authorization.isCommandAuthorized(LoginRequest.COMMAND)); Assert.assertTrue(authorization.isCommandAuthorized(LogoutRequest.COMMAND)); Assert.assertFalse(authorization.isCommandAuthorized("command.staticsecurity.Other")); }