use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class AuthenticationConfigurationImplTest method testGetLoginCtxProviderWhiteboard.
@Test
public void testGetLoginCtxProviderWhiteboard() {
SecurityProvider sp = Mockito.mock(SecurityProvider.class, Mockito.withSettings().extraInterfaces(WhiteboardAware.class));
when(((WhiteboardAware) sp).getWhiteboard()).thenReturn(new DefaultWhiteboard());
authConfiguration.setSecurityProvider(sp);
assertNotNull(authConfiguration.getLoginContextProvider(repo));
}
use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class LoginContextProviderImplTest method testGetLoginContextTwice.
@Test
public void testGetLoginContextTwice() throws Exception {
Configuration.setConfiguration(new Configuration() {
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String applicationName) {
return new AppConfigurationEntry[] { new AppConfigurationEntry(GuestLoginModule.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL, new HashMap()) };
}
});
LoginContextProvider provider = new LoginContextProviderImpl(AuthenticationConfiguration.DEFAULT_APP_NAME, ConfigurationParameters.EMPTY, getContentRepository(), getSecurityProvider(), new DefaultWhiteboard());
provider.getLoginContext(null, null);
LoginContext ctx = provider.getLoginContext(null, null);
ctx.login();
assertFalse(ctx.getSubject().getPublicCredentials(GuestCredentials.class).isEmpty());
}
use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class LoginContextProviderImplTest method testGetLoginContextWithConfigurationPreset.
@Test
public void testGetLoginContextWithConfigurationPreset() throws Exception {
Configuration.setConfiguration(new Configuration() {
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String applicationName) {
return new AppConfigurationEntry[] { new AppConfigurationEntry(GuestLoginModule.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL, new HashMap()) };
}
});
LoginContextProvider provider = new LoginContextProviderImpl(AuthenticationConfiguration.DEFAULT_APP_NAME, ConfigurationParameters.EMPTY, getContentRepository(), getSecurityProvider(), new DefaultWhiteboard());
LoginContext ctx = provider.getLoginContext(null, null);
ctx.login();
assertFalse(ctx.getSubject().getPublicCredentials(GuestCredentials.class).isEmpty());
}
use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class InternalSecurityProviderTest method testSetWhiteboard.
@Test
public void testSetWhiteboard() {
Whiteboard wb = new DefaultWhiteboard();
securityProvider.setWhiteboard(wb);
assertSame(wb, securityProvider.getWhiteboard());
}
use of org.apache.jackrabbit.oak.spi.whiteboard.DefaultWhiteboard in project jackrabbit-oak by apache.
the class RefreshOnGCTest method setup.
@Before
public void setup() throws Exception {
File directory = createTempFile(getClass().getSimpleName(), "test", new File("target"));
directory.delete();
directory.mkdir();
Whiteboard whiteboard = new DefaultWhiteboard();
gcMonitor = new GCMonitorTracker();
gcMonitor.start(whiteboard);
Oak oak = new Oak(createSegmentTarStore(directory, gcMonitor));
oak.with(whiteboard);
repository = new Jcr(oak).createRepository();
}
Aggregations