Tuesday, March 31, 2015

Invoking WSO2 ESB proxy which uses Entitlement Mediator to evaluate a XACML rule in the WSO2 Identity Server in WSO2 Stratos 1.6

In this blog, I am assuming that you have an understanding on XACML Policy Language and use of WSO2 Stratos 1.6





This it the full synapse configuration that has been used in this sample.
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
<registry provider="org.wso2.carbon.mediation.registry.WSO2Registry">
<parameter name="cachableDuration">15000</parameter>
</registry>
<proxy name="EntitlementService"
transports="https"
startOnLoad="true"
trace="disable">
<description/>
<target inSequence="EntitlementInSequence" outSequence="EntitlementOutSequence"/>
<policy key="conf:/repository/axis2/service-groups/EntitlementService/services/EntitlementService/policies/UTOverTransport"/>
<enableSec/>
</proxy>
<sequence name="EntitlementInSequence">
<log level="full">
<property name="FirstLog"
value="############$$$$$$$$$$$$$$$$$$$$$#### First LOG ############$$$$$$$$$$$$$$$$$$$$$####"/>
</log>
<entitlementService remoteServiceUrl="https://identity.stratos-local.wso2.com/services"
remoteServiceUserName="admin"
remoteServicePassword="admin"
client="soap">
<onReject>
<log level="full">
<property name="onAccept"
value="############$$$$$$$$$$$$$$$$$$$$$#### onAccept LOG ############$$$$$$$$$$$$$$$$$$$$$####"/>
</log>
</onReject>
<onAccept>
<log level="full">
<property name="onRejectLog"
value="############$$$$$$$$$$$$$$$$$$$$$#### onReject LOG ############$$$$$$$$$$$$$$$$$$$$$####"/>
</log>
</onAccept>
<obligations/>
<advice/>
</entitlementService>
<header xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
name="wsse:Security"
action="remove"/>
<log level="full">
<property name="SecondLog"
value="############$$$$$$$$$$$$$$$$$$$$$#### Second LOG ############$$$$$$$$$$$$$$$$$$$$$####"/>
</log>
<send>
<endpoint>
<address uri="http://esb.stratos-local.wso2.com:8280/services/echo"/>
</endpoint>
</send>
<drop/>
</sequence>
<sequence name="fault">
<log level="full">
<property name="MESSAGE" value="Executing default 'fault' sequence"/>
<property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
<property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
</log>
<drop/>
</sequence>
<sequence name="EntitlementOutSequence">
<send/>
<drop/>
</sequence>
<sequence name="main">
<in>
<log level="full"/>
<filter source="get-property('To')" regex="http://localhost:9000.*">
<send/>
</filter>
</in>
<out>
<send/>
</out>
<description>The main sequence for the message mediation</description>
</sequence>
</definitions>