The below sample
expalains how to create a user in WSO2 IS with multiple claims using WSO2 ESB
API.
The sample ESB API:
<api xmlns="http://ws.apache.org/ns/synapse" name="AdminServiceCall" context="/v8"> <resource methods="POST" url-mapping="/addUser3" protocol="http"> <inSequence> <log level="custom"> <property name="STATUS" value="---------------------------AdminServiceCall IN Invoked------------"/> </log> <payloadFactory media-type="xml"> <format> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://common.mgt.user.carbon.wso2.org/xsd" xmlns:ser="http://service.ws.um.carbon.wso2.org"> <soapenv:Header/> <soapenv:Body> <ser:addUser> <ser:userName>$1</ser:userName> <ser:credential>$2</ser:credential> <ser:roleList>$3</ser:roleList> <ser:claims> <xsd:claimURI>$4</xsd:claimURI> <xsd:value>$5</xsd:value> </ser:claims> <ser:claims> <xsd:claimURI>$6</xsd:claimURI> <xsd:value>$7</xsd:value> </ser:claims> <ser:claims> <xsd:claimURI>$8</xsd:claimURI> <xsd:value>$9</xsd:value> </ser:claims> <ser:claims> <xsd:claimURI>$10</xsd:claimURI> <xsd:value>$11</xsd:value> </ser:claims> <ser:profileName>$12</ser:profileName> <ser:requirePasswordChange>false</ser:requirePasswordChange> </ser:addUser> </soapenv:Body> </soapenv:Envelope> </format> <args> <arg evaluator="json" expression="$.userName"/> <arg evaluator="json" expression="$.password"/> <arg evaluator="json" expression="$.roles"/> <arg evaluator="json" expression="$.claims.claimURIAddress"/> <arg evaluator="json" expression="$.claims.claimValueAddress"/> <arg evaluator="json" expression="$.claims.claimURICountry"/> <arg evaluator="json" expression="$.claims.claimURIValueCountry"/> <arg evaluator="json" expression="$.claims.claimURIName"/> <arg evaluator="json" expression="$.claims.claimURIValueName"/> <arg evaluator="json" expression="$.claims.claimURIEmail"/> <arg evaluator="json" expression="$.claims.claimValueEmail"/> <arg evaluator="json" expression="$.profileName"/> </args> </payloadFactory> <property xmlns:ns="http://org.apache.synapse/xsd" name="Authorization" expression="fn:concat('Basic ', base64Encode('admin:admin'))" scope="transport"/> <send> <endpoint> <address uri="https://localhost:9446/services/RemoteUserStoreManagerService" trace="disable" format="soap12"/> </endpoint> </send> </inSequence> <outSequence> <log level="custom"> <property name="STATUS" value="---------------------------AdminServiceCall Out Sequence Invoked------------"/> </log> <send/> </outSequence> </resource> </api>
Sample Request:
{ "userName": "ajanthan_15", "password": "batticaloa", "roles": "Internal/everyone", "claims": { "claimURIAddress": "http://wso2.org/claims/streetaddress", "claimValueAddress": "15 Colombo Srilanka", "claimURICountry": "http://wso2.org/claims/country", "claimURIValueCountry": "Srilanka", "claimURIName": "http://wso2.org/claims/displayName", "claimURIValueName": "Ajanthan", "claimURIEmail": "http://wso2.org/claims/emailaddress", "claimValueEmail": "aja00@yahoo.com" }, "profileName": "default" }
No comments:
Post a Comment