use of ee.ria.xroad.common.identifier.SecurityCategoryId in project X-Road by nordic-institute.
the class ServerConfTest method getRequiredCategories.
/**
* Tests getting required categories.
*/
@Test
public void getRequiredCategories() {
ServiceId service1 = createTestServiceId(client(1), service(1, 1), SERVICE_VERSION);
Collection<SecurityCategoryId> securityCategories = ServerConf.getRequiredCategories(service1);
assertEquals(1, securityCategories.size());
assertEquals(SecurityCategoryId.create(XROAD_INSTANCE, SECURITY_CATEGORY + 1), securityCategories.iterator().next());
}
use of ee.ria.xroad.common.identifier.SecurityCategoryId in project X-Road by nordic-institute.
the class CachingServerConfTest method getRequiredCategories.
/**
* Tests getting required categories.
*/
@Test
public void getRequiredCategories() {
ServiceId service1 = createTestServiceId(client(1), service(1, 1), SERVICE_VERSION);
Collection<SecurityCategoryId> securityCategories = ServerConf.getRequiredCategories(service1);
assertEquals(1, securityCategories.size());
assertEquals(SecurityCategoryId.create(XROAD_INSTANCE, SECURITY_CATEGORY + 1), securityCategories.iterator().next());
}
use of ee.ria.xroad.common.identifier.SecurityCategoryId in project X-Road by nordic-institute.
the class ServerMessageProcessor method verifySecurityCategory.
private void verifySecurityCategory(ServiceId service) throws Exception {
Collection<SecurityCategoryId> required = ServerConf.getRequiredCategories(service);
if (required == null || required.isEmpty()) {
// Service requires nothing, we are satisfied.
return;
}
Collection<SecurityCategoryId> provided = GlobalConf.getProvidedCategories(getClientAuthCert());
for (SecurityCategoryId cat : required) {
if (provided.contains(cat)) {
// All OK.
return;
}
}
throw new CodedException(X_SECURITY_CATEGORY, "Service requires security categories (%s), but client only satisfies (%s)", StringUtils.join(required, ", "), StringUtils.join(provided, ", "));
}
Aggregations