XACML for dynamic authorization using time and date - xacml

Please, I would like to know how to write XACML policy for dynamic control. I want to control user permission to access attribute with time or date.

You will need to be more specific in your question if you want us to help with the XACML policy.
Generally you can use the ALFA plugin for Eclipse to write an ALFA policy that will get automatically converted on the fly into a XACML 3.0 policy.
In your question, you say:
I want to control user permission to access attribute with time or date.
Your XACML policy could look like
policy example{
target clause currentDate>"2014-06-01":date and currentTime>"07:00:00":time
apply firstApplicable
rule allowAccessManagers{
target clause role=="manager"
permit
}
}
You can download the ALFA plugin here.

Related

Dynamic root policyset for multi-tenancy using Authzforce Core

I basically want to use Authzforce in a multi-tenant system.
Right now, I have a single root policy that has a few PolicySetIdReference elements that point to other policy sets (per organization) but I noticed that it tries to resolve every reference element and queries the database (I set up my own version of the MongoDbBasedRefProvider). I am worried that I would needlessly load every other policy for other organizations.
<PolicySet PolicySetId="ROOT" ....>
<PolicySetIdReference>ID-for-org-1</PolicySetIdReference>
<PolicySetIdReference>ID-for-org-2</PolicySetIdReference>
</PolicySet>
Am I able to make the root policy provider check some condition(based on org) so that the policies that I check are significantly smaller? In the example above, i only want to retrieve the one for ID-for-org-1
For full multi-tenancy, I recommend to have one PDP instance per tenant, i.e. dispatch the request to a specific PdpEngine instance based on the tenant (org) ID, e.g. via a String-to-PdpEngine map or whatever, just a suggestion.
If you still want to use the same PDP engine for all tenants (i.e. handling policies for all), make sure you do all these:
Use the first-applicable policy combining algorithm in the ROOT policy (so that the evaluation stops at the first applicable policyset within).
Make sure there is a tenant/org ID attribute present in XACML requests.
Define a XACML Target in each org policyset with a Match (equal) on this tenant/org ID attribute, to make sure the policyset applies (is evaluated) only if the tenant/org-id matches.
Implement and enable a Decision Cache on the PDP.

XACML policy at run time

I am exploring XACML and WSO2 to see if it fits my use cases. One of use case is to dynamically create XACML policies. I want to use role based access control system and my application allows admin users to create roles and assign permissions to these roles. Is there a way for my application to insert a policy/modify policy at run time?
Thanks
Chaitanya
PAP interface via SOAP API:
https://docs.wso2.com/display/IS540/Entitlement+with+APIs
Java example:
https://svn.wso2.org/repos/wso2/people/asela/xacml/pap/5.X.X/src/main/java/org/xacmlinfo/xacml/pap/is/PolicyAdminClient.java
Python example:
https://github.com/welkson/WSO2-PDP-CacheTest

How to Seprate wso2 xacml policy in tenent envirnament based on Registry

Our requirement is that i have to separate xacml policy file from default registry called wso2Registry.
so , i am trying to do this scenario using wso2-Governance Registry
but i cant get succeded on this
is anythings other then i have to do to seprate xacml policy based on Tenent so that one tenent cant see other Tenent Xacml policy file not even super tenent
I think your requirement is to isolate the entitlement(XACML) policy. You don't need a separate WSO2 G-Reg instances to do that. In default you it will save the policy at following path for all the tenant, and all the tenants have their own registry space. Therefore any other tenant/ super tenant cannot access them. /_system/governance/repository/identity/entitlement/policy/pap

how to match XACML 3.0 request against policy stored in policy store

Hi I just want to know how can I match XACML 3.0 Request from the PEP against the Policies stored in policy store using PDP. How I will evaluate particular request against the multiple policies stored in policy store.
XACML request is matched with the "Target" element of the policies that are stored in PDP policy store. Once target element is matched for policies, Those matched policies (applicable policies) are evaluated (rules of the policies) according to the policy order and results are combined according to the policy combining algorithm of the policy store. If PEP wants to know that; what PEP policies are matched for given XACML request, PEP can send the XACML request with "ReturnPolicyIdList" attribute as "true".
<Request xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" CombinedDecision="false" ReturnPolicyIdList="true">
Then XACML response would returns the matched policies in the XACML response.
In addition to Asela's answer, I'd like to add that a "policy store" is implementation-specific.
The way Asela describes it essentially means that the policy store acts a policy set with a combining algorithm and no target.
Adding my experience of using WSO2 Identity Server as a PDP
So you can add multiple policy files in IS. But you have to give ranking to each policy file.
So what i think is, those policies get validated in the order of ranking which we provide and for whichever policy the target element gets matched first get evaluated first.

What is the best way of creating policy using XACML3.0?

I am beginner for creating XACML 3.0 policies. In my case we have multiple actions for a single resource.The permissions of a single resource will be depend upon Role.Here in my case resource in the sense like "Name" and "Actions" in the sense "Read,Create,Update,Delete".
Please suggest me the best way of creating policy?
You can use policy editors to create XACML policies. There are some policy editors that are available free. If you are using WSO2 identity Server, You can find the policy editors in the management console to create the XACML policies. You can find more details about them from here. Also According to the your scenario, let me give few suggestion of creating a XACML policy
First identify the entities and their mapping.. Just think as following
Policy is going to create for Resource -- foo
Foo resource has actions -- Read,Create,Update,Delete
All actions can be preformed by role -- admin
Read action can be preformed by role -- role1
Update,Create action can be preformed by role - role2
Identify the target for policy --> This can be the entity that policy is written for, Here it is the resource; i.e "foo"
Define rules policy rule. There can be three rules (if want , we can write them in even one rule)
All action --> admin
Read action ---> role1
Update,Create -- role2
(Optional) Define the last rule as denied to avoid any other access to foo resource
I am attaching UI view of the Identity Server simple policy editor that is used to create the above scenario..(deny rule would be auto generated in this editor). once you have the template and idea, It is easy even to modify the policy using XML and see try out.