Hello All,
I am working on a WS-Policy implementation that requires a SAML token to be
passed in the security header.  CXF provides a SAML callback handler to
support adding the token.  I am using an STS so I call a web service to
obtain the token.  I obtain the token and set it in a header:

<camel:setHeader headerName="token">
        <camel:xpath
resultType="org.w3c.dom.Element">//saml2:Assertion</camel:xpath>
</camel:setHeader>

I now want to obtain the token in my callback handler:

<entry key="ws-security.saml-callback-handler"
value-ref="mySamlCallbackHandler"/>

        @Override
        public void handle(Callback[] callbacks) throws IOException,
                        UnsupportedCallbackException {

                for (int i = 0; i < callbacks.length; i++) {
                        if (callbacks[i] instanceof SAMLCallback) {
                                SAMLCallback callback = (SAMLCallback) 
callbacks[i];

                                Element assertionElement;
                                //I WANT TO GET THE ASSERTION HERE FROM A CAMEL 
HEADER OR OTHER
MECHANISM

                                callback.setAssertionElement(assertionElement);
                        }
                }

        }

Does anyone know how I can access the Camel header 'token' inside of my
callback?  I have tried injecting a bean into the callback handler that
would read a hashmap to obtain the token, however, I have no messageID or
other mechanism to use as the 'key' to the hashmap.  I also injected a
CamelContext thinking I could use that in some fashion.

Any ideas on what I can do here?  I want to use the CXF framework and not
use a manual interceptor to somehow inject the token into the Soap header.

Thanks,
Yogesh



--
View this message in context: 
http://camel.465427.n5.nabble.com/Inject-camel-resources-into-Spring-bean-tp5724524.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to