Search code examples
ibm-integration-bus

Security - how to extract SOAPInput Auth Headers?


I want to get SOAP Auth Headers from SOAPInput node (which are in Basic) for further processing. The problem is they aren't visible in trace/debug and somehow they are still used for authorization. From what I saw in docs IIB stores security tokens and uses them in some nodes when it's needed. The problem is my flow is a bit complex and I need to retrieve this base64 encoded string.

I tried to make security profile and apply to my flow inside BAR file but didn't noticed any change:

mqsicreateconfigurableservice broker -c SecurityProfiles -o viewAuth -n mapping,mappingConfig,passwordValue -v "WS-Trust v1.3 STS",http://linktomyservice:7800/service,PLAIN

Thank you.


Solution

  • While using SOAPUI, when you add basic authentication header by clicking "Add New Authorization" you have to enter username/password. Just below in the same window you have a field called "Pre-emptive auth". You have to select "Authenticate Pre-emptively" after which in IIB you see the authorization field getting populated under HTTPHeader. Below is an extract of http input header that I pulled by running IIB toolkit in debug mode.

    HTTPInputHeader
    X-Original-HTTP-Command:CHARACTER:POST http://XXXXXXX HTTP/1.1
    Accept-Encoding:CHARACTER:gzip,deflate
    Content-Type:CHARACTER:text/xml;charset=UTF-8
    SOAPAction:CHARACTER:""
    Authorization:CHARACTER:Basic asdfsdfasdfasdfsdf
    Content-Length:CHARACTER:254
    

    To save the Authorization, you can use the below esql statement to save Authorization value in the Environment tree.

    SET Environment.Authorization = InputRoot.HTTPInputHeader."Authorization";
    

    I tried a small POC with IIB and it worked for me.