This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Extending WSO2 Identity Server to Handle Custom SAML Assertions
Before reading this, please familiarize yourself with WSO2 Identity Server and Claim Aware Proxy Services with ESB.
Once you get the above running, all of the client requests to attributes are satisfied through Identity Server's default implementation.
To filter attributes being sent, invoke an EJB to obtain custom attributes, and insert them as an SAML assertion to the returning security token, you need to execute some custom logic inside Identity Server to manipulate attributes being added to the returning security token.
Follow the instructions below to do this.
- Make sure the first scenario works fine. That is, make sure the Security Token with SAML attribute assertions is inserted by Identity Server.
- To override it, you need to write a Carbon component to insert our custom logic.
Download and extractÂ
sample.aar
. Next, run the following from the sample folder:mvn clean install
- Now, you can find the bundle insideÂ
sample\org.wso2.carbon.identity.samples.attributeservice\target\org.wso2.carbon.identity.samples.attributeservice-2.0.0.SNAPSHOT.jar
. - Stop Identity Server if it's already running.
- CopyÂ
org.wso2.carbon.identity.samples.attributeservice-2.0.0.SNAPSHOT.jar
 toÂIS_HOME\webapps\ROOT\WEB-INF\plugins\server
. OpenÂ
IS_HOME\webapps\ROOT\WEB-INF\eclipse\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info
 and add the following entry to the end.org.wso2.carbon.identity.samples.attributeservice,2.0.0.SNAPSHOT,file:plugins/org.wso2.carbon.identity.samples.attributeservice-2.0.0.SNAPSHOT.jar,10,true
Note
It is one line.
Start the Identity Server with the following command:
\> wso2server.bat -DosgiConsole -cleanCache
- Once it has started, press "Enter" on the console to get theÂ
osgi
 prompt. Type in the following there to list the available bundles.
osgi\> ss
Check the status of theÂ
org.wso2.carbon.identity.samples.attributeservice
 bundle and get its bundle ID, for example, 164. If the status isÂRESOLVED
, then type:osgi\> start 164
- Once again, check the status withÂ
ss
. It should beÂACTIVE
 now. Run the same client used here before. You can see the "First Name" attribute being overridden, as well as a new attribute being added. You can also see the following line on the console.
INFO - SampleAttributeService being called
Â