Search in sources :

Example 6 with SimpleBranch

use of io.jans.orm.model.base.SimpleBranch in project jans by JanssenProject.

the class UmaPctService method addBranch.

public void addBranch() {
    SimpleBranch branch = new SimpleBranch();
    branch.setOrganizationalUnitName("pct");
    branch.setDn(branchBaseDn());
    ldapEntryManager.persist(branch);
}
Also used : SimpleBranch(io.jans.orm.model.base.SimpleBranch)

Example 7 with SimpleBranch

use of io.jans.orm.model.base.SimpleBranch in project jans by JanssenProject.

the class UmaResourceService method addBranch.

public void addBranch() {
    SimpleBranch branch = new SimpleBranch();
    branch.setOrganizationalUnitName("resources");
    branch.setDn(getDnForResource(null));
    ldapEntryManager.persist(branch);
}
Also used : SimpleBranch(io.jans.orm.model.base.SimpleBranch)

Example 8 with SimpleBranch

use of io.jans.orm.model.base.SimpleBranch in project jans by JanssenProject.

the class RegistrationPersistenceService method cleanup.

public void cleanup(Date now, int batchSize) {
    // Cleaning expired entries
    BatchOperation<Fido2RegistrationEntry> cleanerRegistrationBatchService = new ProcessBatchOperation<Fido2RegistrationEntry>() {

        @Override
        public void performAction(List<Fido2RegistrationEntry> entries) {
            for (Fido2RegistrationEntry p : entries) {
                log.debug("Removing Fido2 registration entry: {}, Creation date: {}", p.getChallange(), p.getCreationDate());
                try {
                    persistenceEntryManager.remove(p);
                } catch (Exception e) {
                    log.error("Failed to remove entry", e);
                }
            }
        }
    };
    String baseDn = getDnForUser(null);
    persistenceEntryManager.findEntries(baseDn, Fido2RegistrationEntry.class, getExpiredRegistrationFilter(baseDn), SearchScope.SUB, new String[] { "jansCodeChallenge", "creationDate" }, cleanerRegistrationBatchService, 0, 0, batchSize);
    String branchDn = getDnForUser(null);
    if (persistenceEntryManager.hasBranchesSupport(branchDn)) {
        // Cleaning empty branches
        BatchOperation<SimpleBranch> cleanerBranchBatchService = new ProcessBatchOperation<SimpleBranch>() {

            @Override
            public void performAction(List<SimpleBranch> entries) {
                for (SimpleBranch p : entries) {
                    try {
                        persistenceEntryManager.remove(p);
                    } catch (Exception e) {
                        log.error("Failed to remove entry", e);
                    }
                }
            }
        };
        persistenceEntryManager.findEntries(branchDn, SimpleBranch.class, getEmptyRegistrationBranchFilter(), SearchScope.SUB, new String[] { "ou" }, cleanerBranchBatchService, 0, 0, batchSize);
    }
}
Also used : Fido2RegistrationEntry(io.jans.fido2.model.entry.Fido2RegistrationEntry) SimpleBranch(io.jans.orm.model.base.SimpleBranch) ProcessBatchOperation(io.jans.orm.model.ProcessBatchOperation) List(java.util.List) Fido2RuntimeException(io.jans.fido2.exception.Fido2RuntimeException)

Example 9 with SimpleBranch

use of io.jans.orm.model.base.SimpleBranch in project jans by JanssenProject.

the class UmaPermissionService method addBranch.

public void addBranch(String clientDn) {
    final SimpleBranch branch = new SimpleBranch();
    branch.setOrganizationalUnitName(ORGUNIT_OF_RESOURCE_PERMISSION);
    branch.setDn(getBranchDn(clientDn));
    ldapEntryManager.persist(branch);
}
Also used : SimpleBranch(io.jans.orm.model.base.SimpleBranch)

Example 10 with SimpleBranch

use of io.jans.orm.model.base.SimpleBranch in project jans by JanssenProject.

the class UmaRptService method addBranch.

public void addBranch() {
    final SimpleBranch branch = new SimpleBranch();
    branch.setOrganizationalUnitName(ORGUNIT_OF_RPT);
    branch.setDn(branchDn());
    ldapEntryManager.persist(branch);
}
Also used : SimpleBranch(io.jans.orm.model.base.SimpleBranch)

Aggregations

SimpleBranch (io.jans.orm.model.base.SimpleBranch)16 Fido2RuntimeException (io.jans.fido2.exception.Fido2RuntimeException)2 EntryPersistenceException (io.jans.orm.exception.EntryPersistenceException)2 ProcessBatchOperation (io.jans.orm.model.ProcessBatchOperation)2 List (java.util.List)2 Fido2AuthenticationEntry (io.jans.fido2.model.entry.Fido2AuthenticationEntry)1 Fido2RegistrationEntry (io.jans.fido2.model.entry.Fido2RegistrationEntry)1 MetricEntry (io.jans.model.metric.ldap.MetricEntry)1 DuplicateEntryException (io.jans.orm.exception.operation.DuplicateEntryException)1 SearchException (io.jans.orm.exception.operation.SearchException)1 DefaultBatchOperation (io.jans.orm.model.DefaultBatchOperation)1