Setting up environment :
Setup both WSO2 AS and WSO2 ESB as mentioned in previous post.
ESB Proxy
- Create a proxy called EchoUTBasicProxy with following content.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<proxy xmlns="http://ws.apache.org/ns/synapse" | |
name="EchoUTBasicProxy" | |
transports="https,http" | |
statistics="disable" | |
trace="disable" | |
startOnLoad="true"> | |
<target> | |
<inSequence> | |
<log level="custom" separator="," description="Log"> | |
<property name="Proxy" value="EchoUTWithBasicAuthProxy"/> | |
</log> | |
<property name="user_name" value="bob" scope="default" type="STRING"/> | |
<property xmlns:ns="http://org.apache.synapse/xsd" | |
name="Authorization" | |
expression="fn:concat('Basic ', base64Encode(fn:concat(get-property('user_name'),':','bobpass')))" | |
scope="transport" | |
type="STRING"/> | |
<log level="custom"> | |
<property name="Generated Authorization token" expression="$trp:Authorization"/> | |
</log> | |
<send> | |
<endpoint> | |
<address uri="https://localhost:9443/services/echo"/> | |
</endpoint> | |
</send> | |
</inSequence> | |
<outSequence> | |
<log level="full"/> | |
<header xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" | |
name="wsse:Security" | |
scope="default" | |
action="remove"/> | |
<send/> | |
</outSequence> | |
<faultSequence/> | |
</target> | |
<publishWSDL uri="http://localhost:9763/services/echo?wsdl"/> | |
<description/> | |
</proxy> | |
Testing Scenario
- Enable Soap tracer on WSO2 AS.
- Enable wire log in WSO2 ESB.
- Invoke EchoUTBasicProxy using SOAP UI.
You can see, there is no username token in incoming message to backend. Instead you see basic auth header in outgoing message to backend from ESB.
No comments:
Post a Comment