use of io.crnk.rs.internal.JaxrsModule in project crnk-framework by crnk-project.
the class CrnkFeature method configure.
@Override
public boolean configure(final FeatureContext context) {
boot.setPropertiesProvider(createPropertiesProvider(context));
if (securityEnabled) {
boot.addModule(new JaxrsModule(securityContext));
}
boot.boot();
parameterProviderRegistry = buildParameterProviderRegistry();
CrnkFilter crnkFilter = createCrnkFilter();
context.register(crnkFilter);
registerActionRepositories(context, boot);
return true;
}
use of io.crnk.rs.internal.JaxrsModule in project crnk-framework by crnk-project.
the class JaxrsModuleTest method testGetter.
@Test
public void testGetter() {
SecurityContext securityContext = Mockito.mock(SecurityContext.class);
JaxrsModule module = new JaxrsModule(securityContext);
Assert.assertEquals("jaxrs", module.getModuleName());
}
use of io.crnk.rs.internal.JaxrsModule in project crnk-framework by crnk-project.
the class JaxrsModuleTest method checkSecurityProviderRegistered.
@Test
public void checkSecurityProviderRegistered() {
SecurityContext securityContext = Mockito.mock(SecurityContext.class);
JaxrsModule module = new JaxrsModule(securityContext);
CrnkBoot boot = new CrnkBoot();
boot.addModule(module);
boot.boot();
SecurityProvider securityProvider = boot.getModuleRegistry().getSecurityProvider();
Assert.assertNotNull(securityProvider);
Mockito.when(securityContext.isUserInRole("admin")).thenReturn(true);
Assert.assertTrue(securityProvider.isUserInRole("admin"));
Assert.assertFalse(securityProvider.isUserInRole("other"));
}
use of io.crnk.rs.internal.JaxrsModule in project crnk-framework by crnk-project.
the class MetaModuleTest method setupBoot.
private void setupBoot() {
boot = new CrnkBoot();
boot.addModule(new JaxrsModule(null));
boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost"));
boot.addModule(metaModule);
boot.boot();
}
use of io.crnk.rs.internal.JaxrsModule in project crnk-framework by crnk-project.
the class ValidationMetaProviderTest method setup.
private void setup(boolean addValidationProvider) {
CrnkBoot boot = new CrnkBoot();
boot.addModule(new JaxrsModule(null));
boot.setServiceUrlProvider(new ConstantServiceUrlProvider("http://localhost"));
boot.setServiceDiscovery(new ReflectionsServiceDiscovery("io.crnk.validation.mock", new SampleJsonServiceLocator()));
boot.boot();
resourceMetaProvider = new ResourceMetaProvider();
lookup = new MetaLookup();
lookup.setModuleContext(boot.getModuleRegistry().getContext());
lookup.addProvider(resourceMetaProvider);
if (addValidationProvider) {
lookup.addProvider(new ValidationMetaProvider());
}
lookup.initialize();
}
Aggregations