private boolean addOwnerIfRequired(ApplicationWithPrograms input, Collection<ApplicationId> allAppVersionsAppIds) throws IOException, AlreadyExistsException { // if allAppVersionsAppIds.isEmpty() is true that means this app is an entirely new app and no other version // exists so we should add the owner information in owner store if one was provided if (allAppVersionsAppIds.isEmpty() && input.getOwnerPrincipal() != null) { ownerAdmin.add(input.getApplicationId(), input.getOwnerPrincipal()); return true; } return false; }
private boolean addOwnerIfRequired(ApplicationWithPrograms input, Collection<ApplicationId> allAppVersionsAppIds) throws IOException, AlreadyExistsException { // if allAppVersionsAppIds.isEmpty() is true that means this app is an entirely new app and no other version // exists so we should add the owner information in owner store if one was provided if (allAppVersionsAppIds.isEmpty() && input.getOwnerPrincipal() != null) { ownerAdmin.add(input.getApplicationId(), input.getOwnerPrincipal()); return true; } return false; }
ownerAdmin.add(streamId, new KerberosPrincipalId(specifiedOwnerPrincipal));
LOG.trace("Adding owner for dataset {}", name); KerberosPrincipalId owner = new KerberosPrincipalId(ownerPrincipal); ownerAdmin.add(datasetId, owner); LOG.trace("Added owner {} for dataset {}", owner, name);
LOG.trace("Adding owner for dataset {}", name); KerberosPrincipalId owner = new KerberosPrincipalId(ownerPrincipal); ownerAdmin.add(datasetId, owner); LOG.trace("Added owner {} for dataset {}", owner, name);
@Test public void testDefaultUGIProviderWithHDFSFiles() throws Exception { // create a location on hdfs for keytabs Location hdfsKeytabDir = locationFactory.create("keytabs"); // set in the cConf so that later it can be used to fetch the keytabs for the given principal setKeytabDir(hdfsKeytabDir.toURI().toString()); Location aliceRemoteKeytabFile = copyFileToHDFS(hdfsKeytabDir, aliceKeytabFile); Location bobRemoteKeytabFile = copyFileToHDFS(hdfsKeytabDir, bobKeytabFile); OwnerAdmin ownerAdmin = getOwnerAdmin(); DefaultUGIProvider provider = new DefaultUGIProvider(cConf, locationFactory, ownerAdmin, namespaceClient); // add some entity owners ownerAdmin.add(aliceEntity, aliceKerberosPrincipalId); ownerAdmin.add(bobEntity, bobKerberosPrincipalId); // Try with keytab file on hdfs ImpersonationRequest aliceImpRequest = new ImpersonationRequest(aliceEntity, ImpersonatedOpType.OTHER); ImpersonationRequest bobImpRequest = new ImpersonationRequest(bobEntity, ImpersonatedOpType.OTHER); UGIWithPrincipal aliceUGIWithPrincipal = verifyAndGetUGI(provider, aliceKerberosPrincipalId, aliceImpRequest); UGIWithPrincipal bobUGIWithPrincipal = verifyAndGetUGI(provider, bobKerberosPrincipalId, bobImpRequest); // delete bob's keytab file on hdfs Assert.assertTrue(bobRemoteKeytabFile.delete()); // verify caching by ensuring that we are able to fetch bob's ugi even after delete but not after invalidating the // cache verifyCaching(provider, aliceImpRequest, bobImpRequest, aliceUGIWithPrincipal, bobUGIWithPrincipal); // cleanup ownerAdmin.delete(aliceEntity); ownerAdmin.delete(bobEntity); }
ownerAdmin.add(aliceEntity, aliceKerberosPrincipalId);