Showing posts with label Application Server. Show all posts
Showing posts with label Application Server. Show all posts

Tuesday, December 16, 2014

Run Time Governance Use Case with WSO2 GREG and ESB - 1

Hi Ya''ll,

Long time ...How are you all doing? It is Christmas time again....Lets try to learn a run time governance scenario with WSO2 Governance Registry today.....:)

Lets start understanding the scenario with a diagram....





We can describe the above diagram as follows :-

1. Custom security policy is uploaded via GREG.
2. GREG is mounted with ESB.
3. Security proxy is created applying the custom policy in the registry (referring the policy in the GREG)
4. Proxy is created for the service hosted in the application server.

Once the service is invoked via SoapUI, since the security policy is applied at ESB , it will refer to the policy in the Governance Registry at the rum-time. Once the security policy is properly validated, the response will be passed back to the invoking party.

In the next post lets talk about how to simply build up the above scenario......

Bye bye for now...:)

Monday, October 7, 2013

Fine-grained authorization with PIP points - WSO2 IS

Use Case Scenario :-
User ‘john’ trying to get READ access by using his user id.
Authorization should be given by validating the user id against user name, requesting use name information via PIP point.

PIP requesting information from a web service.











Now lets see how to implement this use case scenario.

1 ) First of all you need to have the jax-rs service implemented.
2) Then you need to deploy it in the application server.

6) You can use the TryIt tool in Identity Server as the PEP to test the XACML policy
7) You need to expose the entitlement service of the IS and then send request via SoapUI (you can also configure WSO2 ESB to further enhance the use case ) 




Sunday, October 6, 2013

How to write a simple XACML policy in WSO2 IS

We meet again :)

Lets talk about how to write a simple xacml policy in WSO2 IS.


First lets recall our scenario.


Please refer the following links on understanding the scenario.


1) http://umeshagunasinghe.blogspot.com/2013/09/how-to-create-jax-rs-service-using-wso2.html


2) http://umeshagunasinghe.blogspot.com/2013/09/how-to-deploy-jax-rs-service-in-wso2.html

3) http://umeshagunasinghe.blogspot.com/2013/10/how-to-write-pip-point-for-wso2-is.html

4) http://umeshagunasinghe.blogspot.com/2013/10/how-to-register-pip-in-wso2-is.html

We wrote our jax-rs service with users initialized.

Lets say we had 'john' user with user id 124 and another user with user id 125.


Now we have a requirement that we need to permit john to read something.

But nobody else should be able to read it.

So how can we handle this authorization situation?? 


It is really simple to write xacml policies with new user interface provided by WSO2 IS 4.5.0.


Login to IS and go to 

















Now lets fill in the necessary information.

1) First give the xacml policy a name


2) Then you can fill in a description


3) Then select on what this policy is based on. For our scenario this based on the resource we have which is the web service that is deployed on the Application Server. Therefore we can select Resource.


4) Then give the resource name

Note that the input values may change on what the policy is based on

5) Now lets focus on the bottom part. We do not intend to give child resource.

Our user is john
The action is READ
you can give an environment even.

Now we have filled the information we need to implement the policy.


You  can follow the following links to get in depth understanding of writing xacml policies in WSO2 IS.


1) http://xacmlinfo.org/2013/09/02/how-write-xacml-policies-1/


2) http://xacmlinfo.org/2013/09/03/how-to-write-xacml-policies-part-2/


3) http://xacmlinfo.org/2013/09/05/how-to-write-xacml-policies-part-3-basic-policy-editor/


After filling the information regarding the xacml policy click on finish button.


Now lets think about what is the purpose of we registered the PIP. The reason because we needed to get user information needed for authorization.

What user information we were trying to access form the web service? It was the username that is given to the user id.

So what we have actually done? We have written a xacml policy to permit READ access to john.


Now, we need to mention in the policy that "Look, you have to give permit 'john' to give READ rights to certain information, but only the user id of john is provided. So you have to verify the user id with the username before giving any permission. You have to look for a PIP to get this information."


But actually we haven't mention in the policy how to get this information.


Lets go do that. Go to 


















You can see the information we have given. Check out the user information section. There you have to mention where to get the user information to permit access to john. There you have to mention the attribute Id you have given when you wrote the PIP. In this case it is 'USERNAME'.

Now the policy knows everything :). Go to Policy Administration and Click on Publish to My PDP to publish the policy.










Then click on Publish.









Then go to Policy View and Enable the policy.










Now the policy is all ready. In the next post lets talk about the Try It tool to checkout the policy.

See y'all!

Saturday, October 5, 2013

How to write a PIP point for WSO2 IS

Today, we are going to talk about how to write a PIP for WSO2 IS.

In my previous posts I have discussed how to write a jax-rs service and how to deploy it in WSO2 Application Server and send requests.

In this post we are going a step forward and discuss how we can access that service deployed in Application server to get information needed for authorization purpose.

WSO2 Identity server supports  fine grained authorization with XACML 3.0 in IS 4.5.0.
We can register PIP points to retrieve information related for authorization. For that,  a PIP should be written and registered with IS.

You can download a sample PIP from here.

Here , lets talk about main sections of the code sample on how to customize to access the jax-rs service deployed in App Server.

1) Supported attributes should be initiated.








2) Then, getAttributeValues method should be implemented to setup the connection to the service in the application server and get the required values.

 As you can see in the above code sample, the serviceURL is set to the the username and the subject is passed to the method as user id.

In the next post we will talk about how to register the PIP in WSO2 IS.

Wednesday, September 25, 2013

How to deploy a jax-rs service in WSO2 Application Server and send request via Advanced Rest Client



Hello all,

In my previous post I have described how to write a simple jax-rs service using WSO2 Developer Studio.

In this post lets see how we can deploy the service using WSO2 Application Server and send request using Advanced Rest Client.

First of all you will have to download the Application Server from the WSO2 product page.

Extract the product to a local folder and run the server. You can refer to this previous post on how to start the server.

Once the server is started, go to the management control and type admin, admin to login as username and password respectively.

Then go to


2. Upload the .war file

When the service is deployed you can see the service in application list.



When you click on the service you deployed in the list, you can get the following view where you can see the service details.













Get the service endpoint url and give the service path in the Advanced Rest Client to send the requests as represented in the following image.















See y'all next time. Cheers!