Code Monkey home page Code Monkey logo

python-xacml-sdk's Introduction

README

Run a client that uses the python-xacml-sdk to contact an AuthzForce server.

Quick Setup

Install sdk:

python -m venv python-xacml-sdk
python-xacml-sdk
. bin/activate
git clone https://github.com/doublebyte1/python-xacml-sdk.git
cd python-xacml-sdk
pip install --upgrade pip
pip install -r requirements.txt

Create a configuration file for your AuthzForce server and copy it to /tmp/pyxacml_sdk If you don't have access to a server, you can use this one:

docker-compose up -d

Create domain:

curl -s --request POST \
--header "Accept: application/xml" \
--header "Content-Type: application/xml;charset=UTF-8" \
--data @domainProperties.xml \
 http://localhost:8080/authzforce-ce/domains

Retrieve domain:

 curl -s --request GET http://localhost:8080/authzforce-ce/domains

Run the sample client on this folder:

python simple_authz_request.py

python-xacml-sdk's People

Contributors

cdanger avatar hargathor avatar

Watchers

 avatar

python-xacml-sdk's Issues

Request results in 400 response from the server

To reproduce, run:

python3 simple_authz_request.py
A POST request is issued to the authzforce-ce server:

POST /authzforce-ce/domains/Jx1KDt6JEe2ojAJCrBIAAg/pdp HTTP/1.1"

This is the payload:

{
    "Request": {
        "Category": [
            {
                "CategoryId": "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject",
                "Attribute": [
                    {
                        "AttributeId": "urn:oasis:names:tc:xacml:1.0:subject:subject-id",
                        "Value": "Romain",
                        "DataType": "http://www.w3.org/2001/XMLSchema#string",
                        "IncludeInResult": false
                    },
                    {
                        "AttributeId": "urn:oasis:names:tc:xacml:1.0:subject:subject-id",
                        "Value": "Cyril",
                        "DataType": "http://www.w3.org/2001/XMLSchema#string",
                        "IncludeInResult": false
                    }
                ]
            },
            {
                "CategoryId": "urn:oasis:names:tc:xacml:1.0:subject-category:intermediary-subject",
                "Attribute": {
                    "AttributeId": "urn:oasis:names:tc:xacml:1.0:subject:subject-id",
                    "Value": "Cyril",
                    "DataType": "http://www.w3.org/2001/XMLSchema#string",
                    "IncludeInResult": false
                }
            },
            {
                "CategoryId": "urn:oasis:names:tc:xacml:3.0:attribute-category:resource",
                "Attribute": {
                    "AttributeId": "urn:oasis:names:tc:xacml:1.0:resource:resource-id",
                    "Value": "http://rootme.org",
                    "DataType": "http://www.w3.org/2001/XMLSchema#string",
                    "IncludeInResult": false
                }
            },
            {
                "CategoryId": "urn:oasis:names:tc:xacml:3.0:attribute-category:action",
                "Attribute": {
                    "AttributeId": "urn:oasis:names:tc:xacml:1.0:action:action-id",
                    "Value": "GET",
                    "DataType": "http://www.w3.org/2001/XMLSchema#string",
                    "IncludeInResult": false
                }
            }
        ],
        "@ReturnPolicyIdList": false,
        "@CombinedDecision": false
    }
}

And this is the response from the server:

{'error': {'message': 'Invalid parameters: cvc-complex-type.2.4.a: Invalid content was found starting with element \'{"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17":Category}\'. One of \'{"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17":RequestDefaults, "urn:oasis:names:tc:xacml:3.0:core:schema:wd-17":Attributes}\' is expected.'}}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.