Search in sources :

Example 1 with SamlResponseBuilder

use of org.apereo.cas.support.saml.authentication.SamlResponseBuilder in project cas by apereo.

the class Saml10SuccessResponseViewTests method initialize.

@BeforeEach
public void initialize() {
    val appCtx = new StaticApplicationContext();
    appCtx.refresh();
    val list = new ArrayList<RegisteredService>();
    list.add(RegisteredServiceTestUtils.getRegisteredService("https://.+"));
    val dao = new InMemoryServiceRegistry(appCtx, list, new ArrayList<>());
    val context = ServicesManagerConfigurationContext.builder().serviceRegistry(dao).applicationContext(appCtx).environments(new HashSet<>(0)).servicesCache(Caffeine.newBuilder().build()).registeredServiceLocators(List.of(new DefaultServicesManagerRegisteredServiceLocator())).build();
    val mgmr = new DefaultServicesManager(context);
    mgmr.load();
    val protocolAttributeEncoder = new DefaultCasProtocolAttributeEncoder(mgmr, CipherExecutor.noOpOfStringToString());
    val builder = new Saml10ObjectBuilder(configBean);
    val samlResponseBuilder = new SamlResponseBuilder(builder, "testIssuer", "whatever", 1000, "PT30S", new NoOpProtocolAttributeEncoder(), mgmr);
    this.response = new Saml10SuccessResponseView(protocolAttributeEncoder, mgmr, new DefaultArgumentExtractor(new SamlServiceFactory()), StandardCharsets.UTF_8.name(), new DefaultAuthenticationAttributeReleasePolicy("attribute"), new DefaultAuthenticationServiceSelectionPlan(), NoOpProtocolAttributesRenderer.INSTANCE, samlResponseBuilder);
}
Also used : lombok.val(lombok.val) DefaultServicesManagerRegisteredServiceLocator(org.apereo.cas.services.DefaultServicesManagerRegisteredServiceLocator) SamlServiceFactory(org.apereo.cas.support.saml.authentication.principal.SamlServiceFactory) StaticApplicationContext(org.springframework.context.support.StaticApplicationContext) ArrayList(java.util.ArrayList) SamlResponseBuilder(org.apereo.cas.support.saml.authentication.SamlResponseBuilder) DefaultAuthenticationServiceSelectionPlan(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan) InMemoryServiceRegistry(org.apereo.cas.services.InMemoryServiceRegistry) DefaultAuthenticationAttributeReleasePolicy(org.apereo.cas.authentication.DefaultAuthenticationAttributeReleasePolicy) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) NoOpProtocolAttributeEncoder(org.apereo.cas.authentication.support.NoOpProtocolAttributeEncoder) DefaultCasProtocolAttributeEncoder(org.apereo.cas.authentication.support.DefaultCasProtocolAttributeEncoder) DefaultServicesManager(org.apereo.cas.services.DefaultServicesManager) Saml10ObjectBuilder(org.apereo.cas.support.saml.util.Saml10ObjectBuilder) HashSet(java.util.HashSet) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with SamlResponseBuilder

use of org.apereo.cas.support.saml.authentication.SamlResponseBuilder in project cas by apereo.

the class Saml10FailureResponseViewTests method initialize.

@BeforeEach
public void initialize() {
    val builder = new Saml10ObjectBuilder(this.configBean);
    val samlResponseBuilder = new SamlResponseBuilder(builder, null, null, 0, "PT30S", new NoOpProtocolAttributeEncoder(), null);
    view = new Saml10FailureResponseView(new NoOpProtocolAttributeEncoder(), null, new DefaultArgumentExtractor(new SamlServiceFactory()), StandardCharsets.UTF_8.name(), null, new DefaultAuthenticationServiceSelectionPlan(), NoOpProtocolAttributesRenderer.INSTANCE, samlResponseBuilder);
}
Also used : lombok.val(lombok.val) DefaultArgumentExtractor(org.apereo.cas.web.support.DefaultArgumentExtractor) SamlServiceFactory(org.apereo.cas.support.saml.authentication.principal.SamlServiceFactory) NoOpProtocolAttributeEncoder(org.apereo.cas.authentication.support.NoOpProtocolAttributeEncoder) SamlResponseBuilder(org.apereo.cas.support.saml.authentication.SamlResponseBuilder) DefaultAuthenticationServiceSelectionPlan(org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan) Saml10ObjectBuilder(org.apereo.cas.support.saml.util.Saml10ObjectBuilder) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

lombok.val (lombok.val)2 DefaultAuthenticationServiceSelectionPlan (org.apereo.cas.authentication.DefaultAuthenticationServiceSelectionPlan)2 NoOpProtocolAttributeEncoder (org.apereo.cas.authentication.support.NoOpProtocolAttributeEncoder)2 SamlResponseBuilder (org.apereo.cas.support.saml.authentication.SamlResponseBuilder)2 SamlServiceFactory (org.apereo.cas.support.saml.authentication.principal.SamlServiceFactory)2 Saml10ObjectBuilder (org.apereo.cas.support.saml.util.Saml10ObjectBuilder)2 DefaultArgumentExtractor (org.apereo.cas.web.support.DefaultArgumentExtractor)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 DefaultAuthenticationAttributeReleasePolicy (org.apereo.cas.authentication.DefaultAuthenticationAttributeReleasePolicy)1 DefaultCasProtocolAttributeEncoder (org.apereo.cas.authentication.support.DefaultCasProtocolAttributeEncoder)1 DefaultServicesManager (org.apereo.cas.services.DefaultServicesManager)1 DefaultServicesManagerRegisteredServiceLocator (org.apereo.cas.services.DefaultServicesManagerRegisteredServiceLocator)1 InMemoryServiceRegistry (org.apereo.cas.services.InMemoryServiceRegistry)1 StaticApplicationContext (org.springframework.context.support.StaticApplicationContext)1