Search in sources :

Example 11 with IdmConfigurationDto

use of eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto in project CzechIdMng by bcvsolutions.

the class PreserveUuidIntegrationTest method testIsNotNew.

@Test
public void testIsNotNew() {
    IdmConfigurationDto configuration = new IdmConfigurationDto();
    configuration.setName("test-property-two");
    configuration.setValue("one");
    // 
    assertTrue(configurationService.isNew(configuration));
    // 
    configuration = configurationService.save(configuration);
    // 
    assertFalse(configurationService.isNew(configuration));
    // 
    IdmConfigurationDto clone = new IdmConfigurationDto(configuration.getId());
    // 
    assertFalse(configurationService.isNew(clone));
}
Also used : IdmConfigurationDto(eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 12 with IdmConfigurationDto

use of eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto in project CzechIdMng by bcvsolutions.

the class PreserveUuidIntegrationTest method testIsNewWithId.

@Test
public void testIsNewWithId() {
    UUID id = UUID.randomUUID();
    IdmConfigurationDto configuration = new IdmConfigurationDto(id);
    configuration.setName("test-property-one");
    configuration.setValue("one");
    // 
    assertTrue(configurationService.isNew(configuration));
}
Also used : IdmConfigurationDto(eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto) UUID(java.util.UUID) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 13 with IdmConfigurationDto

use of eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto in project CzechIdMng by bcvsolutions.

the class DefaultConfigurationServiceIntegrationTest method testReadConfidentialPropertyFromDB.

@Test
@Transactional
public void testReadConfidentialPropertyFromDB() {
    configurationService.saveConfiguration(new IdmConfigurationDto(TEST_GUARDED_PROPERTY_KEY, "secured_change"));
    assertEquals("secured_change", configurationService.getValue(TEST_GUARDED_PROPERTY_KEY));
}
Also used : IdmConfigurationDto(eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 14 with IdmConfigurationDto

use of eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto in project CzechIdMng by bcvsolutions.

the class DefaultConfigurationService method toConfigurationDto.

private static IdmConfigurationDto toConfigurationDto(String key, Object value) {
    String stringValue = value == null ? null : value.toString();
    IdmConfigurationDto configuration = new IdmConfigurationDto(key, stringValue);
    // password etc. has to be guarded - can be used just in BE
    if (shouldBeConfidential(configuration.getName())) {
        LOG.debug("Configuration value for property [{}] is guarded.", configuration.getName());
        configuration.setValue(GuardedString.SECRED_PROXY_STRING);
        configuration.setConfidential(true);
    }
    if (shouldBeSecured(configuration.getName())) {
        configuration.setSecured(true);
    }
    return configuration;
}
Also used : IdmConfigurationDto(eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString)

Example 15 with IdmConfigurationDto

use of eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto in project CzechIdMng by bcvsolutions.

the class DefaultConfigurationService method setValue.

@Override
@Transactional
public void setValue(String key, String value) {
    Assert.hasText(key);
    // 
    saveConfiguration(new IdmConfigurationDto(key, value));
}
Also used : IdmConfigurationDto(eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

IdmConfigurationDto (eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto)16 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)9 Test (org.junit.Test)9 Transactional (org.springframework.transaction.annotation.Transactional)8 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)5 IdmAuthorizationPolicyDto (eu.bcvsolutions.idm.core.api.dto.IdmAuthorizationPolicyDto)2 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)2 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)2 IdmConfiguration (eu.bcvsolutions.idm.core.model.entity.IdmConfiguration)2 LoginDto (eu.bcvsolutions.idm.core.security.api.dto.LoginDto)2 UUID (java.util.UUID)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ValueWrapper (org.springframework.cache.Cache.ValueWrapper)1