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

XSD simplification - Replace PolicySetDefaults / PolicyDefaults / RequestDefaults elements with Defaults #36

Open
cdanger opened this issue Jul 23, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@cdanger
Copy link

cdanger commented Jul 23, 2024

... or XPathDefaults.

@cdanger cdanger added the enhancement New feature or request label Jul 23, 2024
@cdanger cdanger added this to the xacml-core-4.0 milestone Jul 23, 2024
@steven-legg
Copy link

If XPath and JSONPath are largely defined in separate profiles then the core has no default settings. However, a future profile might come up with its own useful default settings. The best option may be to have an empty <Defaults> element and DefaultsType base type, allow a list of <Defaults> elements in a policy and a request, and leave the profiles to extend DefaultsType and <Defaults> element in a separate namespace to convey what they need.

In the core:

<xs:element name="Defaults" type="xacml:DefaultsType" abstract="true"/>
<xs:complexType name="DefaultsType" abstract="true"/>

In PolicyType and RequestType:

<xs:element ref="xacml:Defaults" minOccurs="0" maxOccurs="unbounded"/>

In the XPath profile:

<xs:element name="XPathDefaults" type="xacml-xpath:XPathDefaultsType" substitutionGroup="xacml:Defaults"/>
<xs:complexType name="XPathDefaultsType">
  <xs:complexContent>
    <xs:extension base="xacml:DefaultsType">
      <xs:attribute name="XPathVersion" type="xs:anyURI" use="required"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

@steven-legg
Copy link

In PolicyType and RequestType:

<xs:element ref="xacml:Defaults" minOccurs="0" maxOccurs="unbounded"/>

We could also split that with PolicyDefaults in PolicyType and RequestDefaults in RequestType, where PolicyDefaults and RequestDefaults are empty extensions of Defaults.

@cdanger
Copy link
Author

cdanger commented Sep 28, 2024

OK, agreed to keep separate RequestDefaults and PolicyDefaults in case some profile wants to have different definitions for both.

<xs:element name="RequestDefaults" type="xacml:DefaultsType" abstract="true"/>
<xs:element name="PolicyDefaults" type="xacml:DefaultsType" abstract="true"/>
<xs:complexType name="DefaultsType" abstract="true"/>

Then in the XPath profile, I can still have the same type definition for both:

<xs:element name="XPathRequestDefaults" type="xacml-xpath:XPathDefaultsType" substitutionGroup="xacml:RequestDefaults"/>
<xs:element name="XPathPolicyDefaults" type="xacml-xpath:XPathDefaultsType" substitutionGroup="xacml:PolicyDefaults"/>

<xs:complexType name="XPathDefaultsType">
  <xs:complexContent>
    <xs:extension base="xacml:DefaultsType">
      <xs:attribute name="XPathVersion" type="xs:anyURI" use="required"/>
    </xs:extension>
  </xs:complexContent>
</xs:complexType>

(In XSD 1.1, this could be simplified further since we can have multiple QNames in the substitutionGroup:

<xs:element name="XPathDefaults" type="xacml-xpath:XPathDefaultsType" substitutionGroup="xacml:RequestDefaults xacml:PolicyDefaults"/>
...

But I'm not sure we should migrate to XSD 1.1 just yet ;-) considering the lack of support in open source tools. Food for thought.
)

Also I'm thinking that some PDP (e.g. AuthzForce) may be able to receive both XML and JSON inputs in the same request, e.g. JSON content in the subject category and XML content in the resource category, in which case we would need 2 types of RequestDefaults elements in the same Request (or 2 PolicyDefaults in a policy) :

<Request>
<JsonRequestDefaults>...</JsonRequestDefaults>
<XPathRequestDefaults>...</XPathRequestDefaults
...
</Request

In general we might have more than one Request/PolicyDefaults elements (one per profile used), which changes the number of occurrences of Defaults in RequestType/PolicyType a bit (maxOccurs="unbounded").

@steven-legg
Copy link

In general we might have more than one Request/PolicyDefaults elements (one per profile used), which changes the number of occurrences of Defaults in RequestType/PolicyType a bit (maxOccurs="unbounded").

I had maxOccurs for the Defaults element ref originally, so I agree.

@steven-legg
Copy link

But I'm not sure we should migrate to XSD 1.1 just yet ;-) considering the lack of support in open source tools.

Well, let's not do it then.

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

No branches or pull requests

2 participants