简体   繁体   English

Apache Camel,客户端证书

[英]Apache Camel, Client Certificates

I'm trying to find an elegant way to attach client certificates through Apache Camel. 我正在尝试找到一种优雅的方法来通过Apache Camel附加客户端证书。 It can either be in Java or Spring XML. 它可以是Java或Spring XML。

The servers I'm sending to all have server cert's which would encrypt the traffic, but I need to attach the client public certificate to the message before sending. 我要发送给所有服务器的服务器均具有服务器证书,可以对通信进行加密,但是在发送之前,我需要将客户端公共证书附加到邮件中。 The server contains 15 or so certificates with their corresponding private keys. 服务器包含15个左右的证书及其相应的私钥。

My main configuration is written in Spring XML, so I'm not sure how to get that working with adding client certificates. 我的主要配置是用Spring XML编写的,所以我不确定如何通过添加客户端证书来实现这一点。

(I'm a .NET guy with minimal java and 0 Linux experience) (我是具有最少Java和0 Linux经验的.NET人员)

Sample Spring: 样品弹簧:

<camel:route>          
    <camel:from uri="direct:GetEligibility"/>
    <camel:doTry>                   
        <camel:choice>
            <camel:when>
                <camel:xpath>count(//soapenv:Envelope) = '0'</camel:xpath>
                <camel:to uri="xslt:xslt/WrapSoap.xsl"/>
            </camel:when>
        </camel:choice>   
        <camel:setHeader headerName="CamelHttpMethod">
            <camel:constant>POST</camel:constant>
        </camel:setHeader>

        <camel:setHeader headerName="Content-Type">
            <camel:constant>text/xml; charset=utf-8</camel:constant>
        </camel:setHeader>     

        <camel:to uri="https://testsite.gov.ca/Services.Secured/FICR_AR022001.asmx"/>        

        <camel:doCatch>
            <camel:exception>java.lang.Exception</camel:exception>
            <camel:bean ref="log" method="error"/>
        </camel:doCatch>
    </camel:doTry>                
</camel:route>    

You need to preconfigure a set of SSLContextParameters and then you can add whichever certificate you want to the http endpoint. 您需要预先配置一组SSLContextParameters,然后可以将所需的任何证书添加到http端点。 You can have a choice to route to different endpoints with different certificates. 您可以选择使用不同的证书路由到不同的端点。

It's described in the Camel docs here : 它在骆驼文档描述在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM