@Test public void testSingleService() { WhiteboardUserAuthenticationFactory factory = createFactory(null, "test"); assertNotNull(factory.getAuthentication(getUserConfiguration(), root, "test")); assertNull(factory.getAuthentication(getUserConfiguration(), root, "another")); }
@Nullable @Override public Authentication getAuthentication(@NotNull UserConfiguration userConfiguration, @NotNull Root root, @Nullable String userId) { List<UserAuthenticationFactory> services = getServices(); if (services.isEmpty() && defaultFactory != null) { return defaultFactory.getAuthentication(userConfiguration, root, userId); } for (UserAuthenticationFactory factory : services) { Authentication authentication = factory.getAuthentication(userConfiguration, root, userId); if (authentication != null) { return authentication; } } return null; }
WhiteboardUserAuthenticationFactory extends AbstractServiceTracker<UserAuthenticationFactory> implements UserAuthenticationFactory { @Nullable @Override public Authentication getAuthentication(@NotNull UserConfiguration userConfiguration, @NotNull Root root, @Nullable String userId) { List<UserAuthenticationFactory> services = getServices(); if (services.isEmpty() && defaultFactory != null) { return defaultFactory.getAuthentication(userConfiguration, root, userId); } for (UserAuthenticationFactory factory : services) { Authentication authentication = factory.getAuthentication(userConfiguration, root, userId); if (authentication != null) { return authentication; } } return null; } }
WhiteboardUserAuthenticationFactory extends AbstractServiceTracker<UserAuthenticationFactory> implements UserAuthenticationFactory { @Nullable @Override public Authentication getAuthentication(@NotNull UserConfiguration userConfiguration, @NotNull Root root, @Nullable String userId) { List<UserAuthenticationFactory> services = getServices(); if (services.isEmpty() && defaultFactory != null) { return defaultFactory.getAuthentication(userConfiguration, root, userId); } for (UserAuthenticationFactory factory : services) { Authentication authentication = factory.getAuthentication(userConfiguration, root, userId); if (authentication != null) { return authentication; } } return null; } WhiteboardUserAuthenticationFactory(@Nullable UserAuthenticationFactory defaultFactory); }
WhiteboardUserAuthenticationFactory extends AbstractServiceTracker<UserAuthenticationFactory> implements UserAuthenticationFactory { @Nullable @Override public Authentication getAuthentication(@NotNull UserConfiguration userConfiguration, @NotNull Root root, @Nullable String userId) { List<UserAuthenticationFactory> services = getServices(); if (services.isEmpty() && defaultFactory != null) { return defaultFactory.getAuthentication(userConfiguration, root, userId); } for (UserAuthenticationFactory factory : services) { Authentication authentication = factory.getAuthentication(userConfiguration, root, userId); if (authentication != null) { return authentication; } } return null; } WhiteboardUserAuthenticationFactory(@Nullable UserAuthenticationFactory defaultFactory); @Nullable @Override Authentication getAuthentication(@NotNull UserConfiguration userConfiguration, @NotNull Root root, @Nullable String userId); }
WhiteboardUserAuthenticationFactory extends AbstractServiceTracker<UserAuthenticationFactory> implements UserAuthenticationFactory { @Nullable @Override public Authentication getAuthentication(@NotNull UserConfiguration userConfiguration, @NotNull Root root, @Nullable String userId) { List<UserAuthenticationFactory> services = getServices(); if (services.isEmpty() && defaultFactory != null) { return defaultFactory.getAuthentication(userConfiguration, root, userId); } for (UserAuthenticationFactory factory : services) { Authentication authentication = factory.getAuthentication(userConfiguration, root, userId); if (authentication != null) { return authentication; } } return null; } WhiteboardUserAuthenticationFactory(@Nullable UserAuthenticationFactory defaultFactory); @Nullable @Override Authentication getAuthentication(@NotNull UserConfiguration userConfiguration, @NotNull Root root, @Nullable String userId);  }