List of usage examples for org.apache.hadoop.security.authorize ServiceAuthorizationManager refreshWithLoadedConfiguration
@Private public void refreshWithLoadedConfiguration(Configuration conf, PolicyProvider provider)
From source file:probos.TestStaticMethods.java
License:Open Source License
@Test public void testPolicy() throws Exception { Configuration c = new Configuration(); ServiceAuthorizationManager sam = new ServiceAuthorizationManager(); System.setProperty("hadoop.policy.file", "probos-policy.xml"); sam.refreshWithLoadedConfiguration(c, new ControllerPolicyProvider()); AccessControlList acl = sam.getProtocolsAcls(PBSClient.class); assertNotNull(acl);/*from w ww. ja va 2s .c o m*/ assertEquals("*", acl.getAclString()); assertTrue(acl .isUserAllowed(UserGroupInformation.createUserForTesting("testUser", new String[] { "mygroup" }))); sam.authorize(UserGroupInformation.getCurrentUser(), PBSClient.class, c, InetAddress.getLocalHost()); }