Search in sources :

Example 1 with AttributeDefinition

use of org.apereo.cas.authentication.attribute.AttributeDefinition in project cas by apereo.

the class DefaultAttributeDefinitionStoreTests method verifyAttrDefnNotFound.

@Test
public void verifyAttrDefnNotFound() {
    val service = CoreAuthenticationTestUtils.getRegisteredService();
    val store = new DefaultAttributeDefinitionStore();
    store.setScope("example.org");
    val defn = DefaultAttributeDefinition.builder().key("eduPersonPrincipalName").attribute("invalid").scoped(true).build();
    store.registerAttributeDefinition(defn);
    var values = (Optional<Pair<AttributeDefinition, List<Object>>>) store.resolveAttributeValues("whatever", CollectionUtils.wrap(CoreAuthenticationTestUtils.CONST_USERNAME), service, Map.of());
    assertTrue(values.isEmpty());
}
Also used : lombok.val(lombok.val) Optional(java.util.Optional) DefaultAttributeDefinition(org.apereo.cas.authentication.attribute.DefaultAttributeDefinition) AttributeDefinition(org.apereo.cas.authentication.attribute.AttributeDefinition) DefaultAttributeDefinitionStore(org.apereo.cas.authentication.attribute.DefaultAttributeDefinitionStore) List(java.util.List) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

List (java.util.List)1 Optional (java.util.Optional)1 lombok.val (lombok.val)1 AttributeDefinition (org.apereo.cas.authentication.attribute.AttributeDefinition)1 DefaultAttributeDefinition (org.apereo.cas.authentication.attribute.DefaultAttributeDefinition)1 DefaultAttributeDefinitionStore (org.apereo.cas.authentication.attribute.DefaultAttributeDefinitionStore)1 Test (org.junit.jupiter.api.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1