Search in sources :

Example 6 with RegisteredServiceJsonSerializer

use of org.apereo.cas.services.util.RegisteredServiceJsonSerializer in project cas by apereo.

the class RegisteredServiceResourceTests method configureMockMvcFor.

private static MockMvc configureMockMvcFor(final RegisteredServiceResource registeredServiceResource) {
    val sz = new RegisteredServiceJsonSerializer();
    val converter = new MappingJackson2HttpMessageConverter(sz.getObjectMapper());
    return MockMvcBuilders.standaloneSetup(registeredServiceResource).defaultRequest(get("/").contextPath("/cas").contentType(MediaType.APPLICATION_JSON)).setMessageConverters(converter).build();
}
Also used : lombok.val(lombok.val) MappingJackson2HttpMessageConverter(org.springframework.http.converter.json.MappingJackson2HttpMessageConverter) RegisteredServiceJsonSerializer(org.apereo.cas.services.util.RegisteredServiceJsonSerializer)

Example 7 with RegisteredServiceJsonSerializer

use of org.apereo.cas.services.util.RegisteredServiceJsonSerializer in project cas by apereo.

the class SamlRegisteredServiceTests method verifySignAssertionFalseWithDeserialization.

@Test
public void verifySignAssertionFalseWithDeserialization() {
    val json = "{\n" + "  \"@class\" : \"org.apereo.cas.support.saml.services.SamlRegisteredService\",\n" + "  \"serviceId\" : \"the-entity\",\n" + "  \"name\" : \"SAMLService\",\n" + "  \"id\" : 10000003,\n" + "  \"evaluationOrder\" : 10,\n" + "  \"signAssertions\" : false,\n" + "  \"metadataLocation\" : \"https://url/to/metadata.xml\"\n" + '}';
    val serializer = new RegisteredServiceJsonSerializer();
    val service = (SamlRegisteredService) serializer.from(json);
    assertNotNull(service);
    assertTrue(service.getSignAssertions().isFalse());
}
Also used : lombok.val(lombok.val) RegisteredServiceJsonSerializer(org.apereo.cas.services.util.RegisteredServiceJsonSerializer) Test(org.junit.jupiter.api.Test)

Example 8 with RegisteredServiceJsonSerializer

use of org.apereo.cas.services.util.RegisteredServiceJsonSerializer in project cas by apereo.

the class OidcProfileScopeAttributeReleasePolicyTests method verifySerialization.

@Test
public void verifySerialization() {
    val policy = new OidcProfileScopeAttributeReleasePolicy();
    val chain = new ChainingAttributeReleasePolicy();
    chain.addPolicy(policy);
    val service = getOidcRegisteredService();
    service.setAttributeReleasePolicy(chain);
    val serializer = new RegisteredServiceJsonSerializer();
    val json = serializer.toString(service);
    assertNotNull(json);
    assertNotNull(serializer.from(json));
}
Also used : lombok.val(lombok.val) RegisteredServiceJsonSerializer(org.apereo.cas.services.util.RegisteredServiceJsonSerializer) ChainingAttributeReleasePolicy(org.apereo.cas.services.ChainingAttributeReleasePolicy) Test(org.junit.jupiter.api.Test)

Example 9 with RegisteredServiceJsonSerializer

use of org.apereo.cas.services.util.RegisteredServiceJsonSerializer in project cas by apereo.

the class OidcEmailScopeAttributeReleasePolicyTests method verifySerialization.

@Test
public void verifySerialization() {
    val policy = new OidcEmailScopeAttributeReleasePolicy();
    val chain = new ChainingAttributeReleasePolicy();
    chain.addPolicy(policy);
    val service = getOidcRegisteredService();
    service.setAttributeReleasePolicy(chain);
    val serializer = new RegisteredServiceJsonSerializer();
    val json = serializer.toString(service);
    assertNotNull(json);
    assertNotNull(serializer.from(json));
}
Also used : lombok.val(lombok.val) RegisteredServiceJsonSerializer(org.apereo.cas.services.util.RegisteredServiceJsonSerializer) ChainingAttributeReleasePolicy(org.apereo.cas.services.ChainingAttributeReleasePolicy) Test(org.junit.jupiter.api.Test)

Example 10 with RegisteredServiceJsonSerializer

use of org.apereo.cas.services.util.RegisteredServiceJsonSerializer in project cas by apereo.

the class OidcPhoneScopeAttributeReleasePolicyTests method verifySerialization.

@Test
public void verifySerialization() {
    val policy = new OidcPhoneScopeAttributeReleasePolicy();
    val chain = new ChainingAttributeReleasePolicy();
    chain.addPolicy(policy);
    val service = getOidcRegisteredService();
    service.setAttributeReleasePolicy(chain);
    val serializer = new RegisteredServiceJsonSerializer();
    val json = serializer.toString(service);
    assertNotNull(json);
    assertNotNull(serializer.from(json));
}
Also used : lombok.val(lombok.val) RegisteredServiceJsonSerializer(org.apereo.cas.services.util.RegisteredServiceJsonSerializer) ChainingAttributeReleasePolicy(org.apereo.cas.services.ChainingAttributeReleasePolicy) Test(org.junit.jupiter.api.Test)

Aggregations

lombok.val (lombok.val)31 RegisteredServiceJsonSerializer (org.apereo.cas.services.util.RegisteredServiceJsonSerializer)31 Test (org.junit.jupiter.api.Test)23 ClassPathResource (org.springframework.core.io.ClassPathResource)8 File (java.io.File)6 ChainingAttributeReleasePolicy (org.apereo.cas.services.ChainingAttributeReleasePolicy)6 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 RegisteredServiceYamlSerializer (org.apereo.cas.services.util.RegisteredServiceYamlSerializer)4 StringWriter (java.io.StringWriter)2 ArrayList (java.util.ArrayList)2 KafkaObjectFactory (org.apereo.cas.kafka.KafkaObjectFactory)2 RegisteredService (org.apereo.cas.services.RegisteredService)2 CasRegisteredServiceDeletedEvent (org.apereo.cas.support.events.service.CasRegisteredServiceDeletedEvent)2 CasRegisteredServiceSavedEvent (org.apereo.cas.support.events.service.CasRegisteredServiceSavedEvent)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)2 Bean (org.springframework.context.annotation.Bean)2 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1