Search in sources :

Example 16 with DefaultAttributeDefinitionStore

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

the class DefaultAttributeDefinitionStoreTests method verifyRemoveDefinition.

@Test
public void verifyRemoveDefinition() {
    val store = new DefaultAttributeDefinitionStore();
    store.setScope("example.org");
    val defn = DefaultAttributeDefinition.builder().key("eduPersonPrincipalName").name("urn:oid:1.3.6.1.4.1.5923.1.1.1.6").build();
    store.registerAttributeDefinition(defn);
    assertNotNull(store.locateAttributeDefinition(defn.getKey()));
    assertFalse(store.getAttributeDefinitions().isEmpty());
    store.removeAttributeDefinition(defn.getKey());
    assertTrue(store.locateAttributeDefinition(defn.getKey()).isEmpty());
}
Also used : lombok.val(lombok.val) DefaultAttributeDefinitionStore(org.apereo.cas.authentication.attribute.DefaultAttributeDefinitionStore) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

lombok.val (lombok.val)16 DefaultAttributeDefinitionStore (org.apereo.cas.authentication.attribute.DefaultAttributeDefinitionStore)16 Test (org.junit.jupiter.api.Test)16 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)16 List (java.util.List)3 FileSystemResource (org.springframework.core.io.FileSystemResource)3 Optional (java.util.Optional)2 AttributeDefinition (org.apereo.cas.authentication.attribute.AttributeDefinition)2 DefaultAttributeDefinition (org.apereo.cas.authentication.attribute.DefaultAttributeDefinition)2 RegisteredServicePublicKey (org.apereo.cas.services.RegisteredServicePublicKey)2 Executable (org.junit.jupiter.api.function.Executable)2 ClassPathResource (org.springframework.core.io.ClassPathResource)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Files (java.nio.file.Files)1 FileTime (java.nio.file.attribute.FileTime)1 Instant (java.time.Instant)1 Map (java.util.Map)1 FileUtils (org.apache.commons.io.FileUtils)1