Search in sources :

Example 11 with SimpleBranch

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

the class MetricService method addBranch.

public void addBranch(String branchDn, String ou) {
    if (getEntryManager().hasBranchesSupport(branchDn)) {
        SimpleBranch branch = new SimpleBranch();
        branch.setOrganizationalUnitName(ou);
        branch.setDn(branchDn);
        getEntryManager().persist(branch);
    }
}
Also used : SimpleBranch(io.jans.orm.model.base.SimpleBranch)

Example 12 with SimpleBranch

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

the class RegistrationPersistenceService method addBranch.

public void addBranch(final String baseDn) {
    SimpleBranch branch = new SimpleBranch();
    branch.setOrganizationalUnitName("fido2_register");
    branch.setDn(baseDn);
    persistenceEntryManager.persist(branch);
}
Also used : SimpleBranch(io.jans.orm.model.base.SimpleBranch)

Example 13 with SimpleBranch

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

the class AuthenticationPersistenceService method addBranch.

public void addBranch(final String baseDn) {
    SimpleBranch branch = new SimpleBranch();
    branch.setOrganizationalUnitName("fido2_auth");
    branch.setDn(baseDn);
    persistenceEntryManager.persist(branch);
}
Also used : SimpleBranch(io.jans.orm.model.base.SimpleBranch)

Example 14 with SimpleBranch

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

the class AuthenticationPersistenceService method cleanup.

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

        @Override
        public void performAction(List<Fido2AuthenticationEntry> entries) {
            for (Fido2AuthenticationEntry p : entries) {
                log.debug("Removing Fido2 authentication 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, Fido2AuthenticationEntry.class, getExpiredAuthenticationFilter(baseDn), SearchScope.SUB, new String[] { "jansCodeChallenge", "creationDate" }, cleanerAuthenticationBatchService, 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(getDnForUser(null), SimpleBranch.class, getEmptyAuthenticationBranchFilter(), SearchScope.SUB, new String[] { "ou" }, cleanerBranchBatchService, 0, 0, batchSize);
    }
}
Also used : SimpleBranch(io.jans.orm.model.base.SimpleBranch) ProcessBatchOperation(io.jans.orm.model.ProcessBatchOperation) Fido2AuthenticationEntry(io.jans.fido2.model.entry.Fido2AuthenticationEntry) List(java.util.List) Fido2RuntimeException(io.jans.fido2.exception.Fido2RuntimeException)

Example 15 with SimpleBranch

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

the class ClientAuthorizationsService method addBranch.

public void addBranch() {
    SimpleBranch branch = new SimpleBranch();
    branch.setOrganizationalUnitName("authorizations");
    branch.setDn(createDn(null));
    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