Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orion-Wilma-Authzforce #10

Open
fernandorr21 opened this issue Aug 17, 2020 · 7 comments
Open

Orion-Wilma-Authzforce #10

fernandorr21 opened this issue Aug 17, 2020 · 7 comments

Comments

@fernandorr21
Copy link

hello, I would like to obtain in wilma the attributes of an entity already defined in orion based on its id (in root.js for example) . In order to evaluate those attributes in authzforce. Could it be done?

@jason-fox
Copy link
Member

Yes it could be done, but you would need to customize the PEP Proxy code to do it.

@fernandorr21
Copy link
Author

how could i do it?

@jason-fox
Copy link
Member

https://github.com/FIWARE/tutorials.Step-by-Step/blob/master/context-provider/lib/azf.js#L12 provides an example of an application (in this case the Tutorial app) creating a custom XACML request for Authzforce.

The equivalent code in the PEP Proxy is here: https://github.com/ging/fiware-pep-proxy/blob/master/lib/azf.js#L92

You could check the flow of the code to find out where getRESTPolicy() is called and write the following:

1.   Get Value from cache
2.  If not found or expired retrieve current value from CB (look at store.js)
3.  Call Amended getRESTPolicy() and retrieve Permit/Deny.

Obviously Authzforce would need a rule which checked the additional value as well, much like the eMail example in the tutorial

@fernandorr21
Copy link
Author

But, how achieve i attributes of a predefined entity?

@jason-fox
Copy link
Member

To read attributes of an entity or entities use the attrs parameter - something like the NGSI-LD example here:

let productsInStore = await ngsiLD.listEntities(
            {
                type: 'Product',
                options: 'keyValues',
                attrs: 'name,price',
                id: stockedProducts.join(',')
            },
            headers
        );

Effectively you're just sending a request like:

curl -L -X GET 'http://localhost:1026/v2/entities/urn:ngsi-ld:Store:001?options=keyValues&attrs=name'

To generate the XACML you will have to do that yourself - but you can follow the eMail example as a template.

@fernandorr21
Copy link
Author

thank you, I achieve it.
But I have another problem, I want to permit acces /v2/entities and all /v2/entities/id..., how could i permit in XACML access children of /v2/entities/....../....

@jason-fox
Copy link
Member

jason-fox commented Aug 17, 2020

If you are using XACML then create a rule <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-starts-with">
see: here as an example.

However, this complexity is no longer necessary, as this issue #7 points out. You could just use the Keyrock simple Policy Decision Point and supply a regex.

More info here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants