Search in sources :

Example 1 with AuthenticationProperties

use of org.apereo.cas.configuration.model.core.authentication.AuthenticationProperties in project cas by apereo.

the class CasCoreConfigurationUtilsTests method verifyMappingByPropertyRef.

@Test
public void verifyMappingByPropertyRef() {
    val props = new CasConfigurationProperties();
    props.getAuthn().getSyncope().setName("SyncopeAuth");
    props.getAuthn().getSyncope().setUrl("https://github.com/apereo/cas");
    props.getAuthn().getSyncope().setDomain("Master");
    val filters = new SimpleFilterProvider().setFailOnUnknownId(false).addFilter(CasConfigurationProperties.class.getSimpleName(), SimpleBeanPropertyFilter.filterOutAllExcept(CasCoreConfigurationUtils.getPropertyName(CasConfigurationProperties.class, CasConfigurationProperties::getAuthn))).addFilter(AuthenticationProperties.class.getSimpleName(), SimpleBeanPropertyFilter.filterOutAllExcept(CasCoreConfigurationUtils.getPropertyName(AuthenticationProperties.class, AuthenticationProperties::getSyncope)));
    val map = CasCoreConfigurationUtils.asMap(props.withHolder(), filters);
    assertTrue(map.keySet().stream().allMatch(key -> key.startsWith("cas.authn.syncope")));
}
Also used : lombok.val(lombok.val) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RefreshAutoConfiguration(org.springframework.cloud.autoconfigure.RefreshAutoConfiguration) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) lombok.val(lombok.val) Assertions(org.junit.jupiter.api.Assertions) Autowired(org.springframework.beans.factory.annotation.Autowired) AuthenticationProperties(org.apereo.cas.configuration.model.core.authentication.AuthenticationProperties) SimpleBeanPropertyFilter(com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter) Tag(org.junit.jupiter.api.Tag) LdapAuthenticationProperties(org.apereo.cas.configuration.model.support.ldap.LdapAuthenticationProperties) SimpleFilterProvider(com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider) SimpleFilterProvider(com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider) AuthenticationProperties(org.apereo.cas.configuration.model.core.authentication.AuthenticationProperties) LdapAuthenticationProperties(org.apereo.cas.configuration.model.support.ldap.LdapAuthenticationProperties) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

SimpleBeanPropertyFilter (com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter)1 SimpleFilterProvider (com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider)1 lombok.val (lombok.val)1 AuthenticationProperties (org.apereo.cas.configuration.model.core.authentication.AuthenticationProperties)1 LdapAuthenticationProperties (org.apereo.cas.configuration.model.support.ldap.LdapAuthenticationProperties)1 Assertions (org.junit.jupiter.api.Assertions)1 Tag (org.junit.jupiter.api.Tag)1 Test (org.junit.jupiter.api.Test)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 EnableConfigurationProperties (org.springframework.boot.context.properties.EnableConfigurationProperties)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 RefreshAutoConfiguration (org.springframework.cloud.autoconfigure.RefreshAutoConfiguration)1