diff --git a/oak-auth-external/pom.xml b/oak-auth-external/pom.xml
index 3c88129..566cd9e 100644
--- a/oak-auth-external/pom.xml
+++ b/oak-auth-external/pom.xml
@@ -27,6 +27,7 @@
../oak-parent/pom.xml
+ 1.0.19.1-SNAPSHOT
oak-auth-external
Oak External Authentication Support
bundle
@@ -103,7 +104,7 @@
org.apache.jackrabbit
oak-core
- ${project.version}
+ 1.0.19
@@ -144,7 +145,7 @@
org.apache.jackrabbit
oak-core
- ${project.version}
+ 1.0.19
tests
test
diff --git a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/SyncedIdentityImpl.java b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/SyncedIdentityImpl.java
index 74d8010..630a791 100644
--- a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/SyncedIdentityImpl.java
+++ b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/SyncedIdentityImpl.java
@@ -61,4 +61,15 @@ public class SyncedIdentityImpl implements SyncedIdentity {
public long lastSynced() {
return lastSynced;
}
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder("SyncedIdentityImpl{");
+ sb.append("id='").append(id).append('\'');
+ sb.append(", ref=").append(ref);
+ sb.append(", isGroup=").append(isGroup);
+ sb.append(", lastSynced=").append(lastSynced);
+ sb.append('}');
+ return sb.toString();
+ }
}
\ No newline at end of file
diff --git a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/jmx/SyncMBeanImpl.java b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/jmx/SyncMBeanImpl.java
index 42d5d19..1dcff87 100644
--- a/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/jmx/SyncMBeanImpl.java
+++ b/oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/jmx/SyncMBeanImpl.java
@@ -163,9 +163,7 @@ public class SyncMBeanImpl implements SynchronizationMBean {
SyncResult r = context.sync(userId);
systemSession.save();
result.add(getJSONString(r));
- } catch (SyncException e) {
- log.warn("Error while syncing user {}", userId, e);
- } catch (RepositoryException e) {
+ } catch (Exception e) {
log.warn("Error while syncing user {}", userId, e);
}
}
@@ -190,9 +188,8 @@ public class SyncMBeanImpl implements SynchronizationMBean {
SyncResult r = context.sync(id.getId());
systemSession.save();
list.add(getJSONString(r));
- } catch (SyncException e) {
- list.add(getJSONString(id, e));
- } catch (RepositoryException e) {
+ } catch (Exception e) {
+ log.error("Error while syncing user {}", id, e);
list.add(getJSONString(id, e));
}
}
@@ -228,9 +225,8 @@ public class SyncMBeanImpl implements SynchronizationMBean {
} catch (ExternalIdentityException e) {
log.warn("error while fetching the external identity {}", externalId, e);
list.add(getJSONString(ref, e));
- } catch (SyncException e) {
- list.add(getJSONString(ref, e));
- } catch (RepositoryException e) {
+ } catch (Exception e) {
+ log.error("Error while syncing user {}", ref, e);
list.add(getJSONString(ref, e));
}
}
@@ -251,10 +247,18 @@ public class SyncMBeanImpl implements SynchronizationMBean {
try {
SyncResult r = context.sync(user);
systemSession.save();
+ if (r.getIdentity() == null) {
+ r = new SyncResultImpl(
+ new SyncedIdentityImpl(user.getId(), user.getExternalId(), false, -1),
+ SyncResult.Status.NO_SUCH_IDENTITY
+ );
+ log.warn("sync failed. {}", r.getIdentity());
+ } else {
+ log.info("synced {}", r.getIdentity());
+ }
list.add(getJSONString(r));
- } catch (SyncException e) {
- list.add(getJSONString(user.getExternalId(), e));
- } catch (RepositoryException e) {
+ } catch (Exception e) {
+ log.error("Error while syncing user {}", user, e);
list.add(getJSONString(user.getExternalId(), e));
}
}
@@ -275,16 +279,18 @@ public class SyncMBeanImpl implements SynchronizationMBean {
while (iter.hasNext()) {
SyncedIdentity id = iter.next();
if (isMyIDP(id)) {
- ExternalIdentity extId = idp.getIdentity(id.getExternalIdRef());
- if (extId == null) {
- list.add(id.getId());
+ try {
+ ExternalIdentity extId = idp.getIdentity(id.getExternalIdRef());
+ if (extId == null) {
+ list.add(id.getId());
+ }
+ } catch (Exception e) {
+ log.error("Error while syncing identity {}", id, e);
}
}
}
} catch (RepositoryException e) {
log.error("Error while listing orphaned users", e);
- } catch (ExternalIdentityException e) {
- log.error("Error while fetching external identity", e);
}
return list.toArray(new String[list.size()]);
}
@@ -301,9 +307,7 @@ public class SyncMBeanImpl implements SynchronizationMBean {
SyncResult r = context.sync(userId);
systemSession.save();
result.add(getJSONString(r));
- } catch (SyncException e) {
- log.warn("Error while syncing user {}", userId, e);
- } catch (RepositoryException e) {
+ } catch (Exception e) {
log.warn("Error while syncing user {}", userId, e);
}
}