@Test public void positiveWhitelistAuthroizationTest() { SimpleWhitelistAuthorizer auth = new SimpleWhitelistAuthorizer(); Map<String, Object> conf = ConfigUtils.readStormConfig(); conf.put(SimpleWhitelistAuthorizer.WHITELIST_USERS_CONF, Arrays.asList("user")); auth.prepare(conf); ReqContext context = new ReqContext(mkSubject("user")); assertTrue(auth.permit(context, "activate", conf)); }
@Test public void negativeWhitelistAuthroizationTest() { SimpleWhitelistAuthorizer auth = new SimpleWhitelistAuthorizer(); Map<String, Object> conf = ConfigUtils.readStormConfig(); auth.prepare(conf); ReqContext context = new ReqContext(mkSubject("user")); assertFalse(auth.permit(context, "activate", conf)); }