org.apache.directory.server.core.CoreSession Java Examples
The following examples show how to use
org.apache.directory.server.core.CoreSession.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ApacheDirectoryPartitionManager.java From carbon-identity with Apache License 2.0 | 4 votes |
/** * @inheritDoc */ @Override public void addPartition(PartitionInfo partitionInformation) throws DirectoryServerException { try { JdbmPartition partition = createNewPartition(partitionInformation.getPartitionId(), partitionInformation.getRootDN()); this.directoryService.addPartition(partition); CoreSession adminSession = this.directoryService.getAdminSession(); if (!adminSession.exists(partition.getSuffixDn())) { addPartitionAttributes(partitionInformation.getRootDN(), partitionInformation. getObjectClasses(), partitionInformation.getRealm(), partitionInformation.getPreferredDomainComponent()); // Create user ou addUserStoreToPartition(partition.getSuffix()); // Create group ou addGroupStoreToPartition(partition.getSuffix()); //Creates the shared groups ou addSharedGroupToPartition(partition.getSuffix()); /*do not create admin user and admin group because it is anyway checked and created *in user core.*/ // create tenant administrator entry at the time of tenant-partition created. addAdmin(partitionInformation.getPartitionAdministrator(), partition.getSuffix(), partitionInformation.getRealm(), partitionInformation.isKdcEnabled()); addAdminGroup(partitionInformation.getPartitionAdministrator(), partition.getSuffix()); addAdminACLEntry(partitionInformation.getPartitionAdministrator().getAdminUserName(), partition.getSuffix()); this.directoryService.sync(); } } catch (Exception e) { String errorMessage = "Could not add the partition"; logger.error(errorMessage, e); throw new DirectoryServerException(errorMessage, e); } }
Example #2
Source File: EmbeddedADS.java From easybuggy with Apache License 2.0 | 2 votes |
/** * Returns the admin session to connect Embedded Apache Directory Server. * * @return The admin session */ public static CoreSession getAdminSession() throws Exception{ return service.getAdminSession(); }