Package org.apache.jackrabbit.oak.spi.security.authentication.external

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncException


            } else if (type.isInstance(authorizable)) {
                //noinspection unchecked
                return (T) authorizable;
            } else {
                log.error("Unable to process external {}: {}. Colliding authorizable exists in repository.", type.getSimpleName(), external.getId());
                throw new SyncException("Unexpected authorizable: " + authorizable);
            }
        }
View Full Code Here


     * @throws SyncException if an error occurs
     */
    private void syncUser(@Nonnull ExternalUser user) throws SyncException {
        Root root = getRoot();
        if (root == null) {
            throw new SyncException("Cannot synchronize user. root == null");
        }
        UserManager userManager = getUserManager();
        if (userManager == null) {
            throw new SyncException("Cannot synchronize user. userManager == null");
        }

        int numAttempt = 0;
        while (numAttempt++ < MAX_SYNC_ATTEMPTS) {
            SyncContext context = null;
            try {
                DebugTimer timer = new DebugTimer();
                context = syncHandler.createContext(idp, userManager, new ValueFactoryImpl(root, NamePathMapper.DEFAULT));
                context.sync(user);
                timer.mark("sync");
                root.commit();
                timer.mark("commit");
                if (log.isDebugEnabled()) {
                    log.debug("syncUser({}) {}", user.getId(), timer.getString());
                }
                return;
            } catch (CommitFailedException e) {
                log.warn("User synchronization failed during commit: {}. (attempt {}/{})", e.toString(), numAttempt, MAX_SYNC_ATTEMPTS);
                root.refresh();
            } finally {
                if (context != null) {
                    context.close();
                }
            }
        }
        throw new SyncException("User synchronization failed during commit after " + MAX_SYNC_ATTEMPTS + " attempts");
    }
View Full Code Here

    private void validateUser(@Nonnull String id) throws SyncException {
        SyncContext context = null;
        try {
            Root root = getRoot();
            if (root == null) {
                throw new SyncException("Cannot synchronize user. root == null");
            }
            UserManager userManager = getUserManager();
            if (userManager == null) {
                throw new SyncException("Cannot synchronize user. userManager == null");
            }
            DebugTimer timer = new DebugTimer();
            context = syncHandler.createContext(idp, userManager, new ValueFactoryImpl(root, NamePathMapper.DEFAULT));
            context.sync(id);
            timer.mark("sync");
            root.commit();
            timer.mark("commit");
            if (log.isDebugEnabled()) {
                log.debug("validateUser({}) {}", id, timer.getString());
            }
        } catch (CommitFailedException e) {
            throw new SyncException("User synchronization failed during commit.", e);
        } finally {
            if (context != null) {
                context.close();
            }
        }
View Full Code Here

                            return repository.login(null, null);
                        }
                    }
                });
            } catch (PrivilegedActionException e) {
                throw new SyncException(e);
            }
            try {
                context = handler.createContext(idp, userMgr = ((JackrabbitSession) systemSession).getUserManager(), systemSession.getValueFactory());
            } catch (Exception e) {
                systemSession.logout();
                throw new SyncException(e);
            }

            log.info("Created delegatee for SyncMBean with session: {} {}", systemSession, systemSession.getUserID());
        }
View Full Code Here

                if (created) {
                    ret.setStatus(SyncResult.Status.ADD);
                }
                return ret;
            } catch (RepositoryException e) {
                throw new SyncException(e);
            }
        }
View Full Code Here

                if (log.isDebugEnabled()) {
                    log.debug("sync({}) -> {} {}", id, ref.getString(), timer.getString());
                }
                return ret;
            } catch (RepositoryException e) {
                throw new SyncException(e);
            } catch (ExternalIdentityException e) {
                throw new SyncException(e);
            }
        }
View Full Code Here

            } else if (type.isInstance(authorizable)) {
                //noinspection unchecked
                return (T) authorizable;
            } else {
                log.error("Unable to process external {}: {}. Colliding authorizable exists in repository.", type.getSimpleName(), external.getId());
                throw new SyncException("Unexpected authorizable: " + authorizable);
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.