Search in sources :

Example 1 with HttpsUrlConnectionMessageSender

use of org.springframework.ws.transport.http.HttpsUrlConnectionMessageSender in project cas by apereo.

the class InweboServiceConfiguration method inweboConsoleAdmin.

@Bean
@ConditionalOnMissingBean(name = "inweboConsoleAdmin")
@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
public InweboConsoleAdmin inweboConsoleAdmin(@Qualifier(CasSSLContext.BEAN_NAME) final ObjectProvider<CasSSLContext> casSslContext, final CasConfigurationProperties casProperties) throws Exception {
    val inwebo = casProperties.getAuthn().getMfa().getInwebo();
    val marshaller = new Jaxb2Marshaller();
    val marshallerContext = getClass().getPackageName().replaceAll("config", "service.soap.generated");
    marshaller.setContextPath(marshallerContext);
    val client = new InweboConsoleAdmin(casProperties);
    client.setDefaultUri(inwebo.getConsoleAdminUrl());
    client.setMarshaller(marshaller);
    client.setUnmarshaller(marshaller);
    val messageSender = new HttpsUrlConnectionMessageSender();
    messageSender.setKeyManagers(SSLUtils.buildKeystore(inwebo.getClientCertificate()).getKeyManagers());
    if (casSslContext.getIfAvailable() != null) {
        messageSender.setTrustManagers(casSslContext.getObject().getTrustManagers());
    } else {
        val tmFactory = TrustManagerFactory.getInstance("PKIX");
        tmFactory.init((KeyStore) null);
        messageSender.setTrustManagers(tmFactory.getTrustManagers());
    }
    client.setMessageSender(messageSender);
    return client;
}
Also used : lombok.val(lombok.val) HttpsUrlConnectionMessageSender(org.springframework.ws.transport.http.HttpsUrlConnectionMessageSender) InweboConsoleAdmin(org.apereo.cas.support.inwebo.service.InweboConsoleAdmin) Jaxb2Marshaller(org.springframework.oxm.jaxb.Jaxb2Marshaller) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

lombok.val (lombok.val)1 InweboConsoleAdmin (org.apereo.cas.support.inwebo.service.InweboConsoleAdmin)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)1 Bean (org.springframework.context.annotation.Bean)1 Jaxb2Marshaller (org.springframework.oxm.jaxb.Jaxb2Marshaller)1 HttpsUrlConnectionMessageSender (org.springframework.ws.transport.http.HttpsUrlConnectionMessageSender)1