summaryrefslogtreecommitdiffstats
path: root/ONAP-XACML
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-XACML')
-rw-r--r--ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java78
-rw-r--r--ONAP-XACML/src/test/resources/Action_TestActionPolicy.1.xml19
-rw-r--r--ONAP-XACML/src/test/resources/Config_SampleTest1206.1.xml19
-rw-r--r--ONAP-XACML/src/test/resources/emptyPapGroupsDefault/xacml.properties20
-rw-r--r--ONAP-XACML/src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml19
-rw-r--r--ONAP-XACML/src/test/resources/pdps/default/xacml.pip.properties20
-rw-r--r--ONAP-XACML/src/test/resources/pdps/default/xacml.policy.properties20
-rw-r--r--ONAP-XACML/src/test/resources/pdps/xacml.properties20
-rw-r--r--ONAP-XACML/testsets/conformance/xacml3.0-ct-v.0.4/IIA001Response.xml19
9 files changed, 188 insertions, 46 deletions
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java
index e24343704..0003e12c6 100644
--- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java
+++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/util/XACMLPolicyScanner.java
@@ -613,59 +613,45 @@ public class XACMLPolicyScanner {
// Parse the policy file
//
Document doc = db.parse(is);
- //
- // Because there is no root defined in xacml,
- // find the first element
- //
- NodeList nodes = doc.getChildNodes();
- Node node = nodes.item(0);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element e = (Element) node;
+ Element e = doc.getDocumentElement();
+ //
+ // Is it a 3.0 policy?
+ //
+ if ("urn:oasis:names:tc:xacml:3.0:core:schema:wd-17".equals(e.getNamespaceURI())) {
//
- // Is it a 3.0 policy?
+ // A policyset or policy could be the root
//
- if ("urn:oasis:names:tc:xacml:3.0:core:schema:wd-17".equals(e.getNamespaceURI())) {
+ if (e.getNodeName().endsWith("Policy")) {
//
- // A policyset or policy could be the root
+ // Now we can create the context for the policy set
+ // and unmarshall the policy into a class.
//
- if (e.getNodeName().endsWith("Policy")) {
- //
- // Now we can create the context for the policy set
- // and unmarshall the policy into a class.
- //
- JAXBContext context = JAXBContext.newInstance(PolicyType.class);
- Unmarshaller um = context.createUnmarshaller();
- JAXBElement<PolicyType> root = um.unmarshal(e, PolicyType.class);
- //
- // Here is our policy set class
- //
- return root.getValue();
- } else if (e.getNodeName().endsWith("PolicySet")) {
- //
- // Now we can create the context for the policy set
- // and unmarshall the policy into a class.
- //
- JAXBContext context = JAXBContext.newInstance(PolicySetType.class);
- Unmarshaller um = context.createUnmarshaller();
- JAXBElement<PolicySetType> root = um.unmarshal(e, PolicySetType.class);
- //
- // Here is our policy set class
- //
- return root.getValue();
- } else {
- if (logger.isDebugEnabled()) {
- logger.debug("Not supported yet: " + e.getNodeName());
- }
- }
+ JAXBContext context = JAXBContext.newInstance(PolicyType.class);
+ Unmarshaller um = context.createUnmarshaller();
+ JAXBElement<PolicyType> root = um.unmarshal(e, PolicyType.class);
+ //
+ // Here is our policy set class
+ //
+ return root.getValue();
+ } else if (e.getNodeName().endsWith("PolicySet")) {
+ //
+ // Now we can create the context for the policy set
+ // and unmarshall the policy into a class.
+ //
+ JAXBContext context = JAXBContext.newInstance(PolicySetType.class);
+ Unmarshaller um = context.createUnmarshaller();
+ JAXBElement<PolicySetType> root = um.unmarshal(e, PolicySetType.class);
+ //
+ // Here is our policy set class
+ //
+ return root.getValue();
} else {
- logger.warn("unsupported namespace: " + e.getNamespaceURI());
+ if (logger.isDebugEnabled()) {
+ logger.debug("Not supported yet: " + e.getNodeName());
+ }
}
} else {
- if (logger.isDebugEnabled()) {
- logger.debug("No root element contained in policy " +
- " Name: " + node.getNodeName() + " type: " + node.getNodeType() +
- " Value: " + node.getNodeValue());
- }
+ logger.warn("unsupported namespace: " + e.getNamespaceURI());
}
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_SCHEMA_INVALID, e, "XACMLPolicyScanner", "Exception in readPolicy");
diff --git a/ONAP-XACML/src/test/resources/Action_TestActionPolicy.1.xml b/ONAP-XACML/src/test/resources/Action_TestActionPolicy.1.xml
index a3b483f74..7f5d45cec 100644
--- a/ONAP-XACML/src/test/resources/Action_TestActionPolicy.1.xml
+++ b/ONAP-XACML/src/test/resources/Action_TestActionPolicy.1.xml
@@ -1,4 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ============LICENSE_START==================================================
+ ONAP Policy Engine
+ ===========================================================================
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ ===========================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END====================================================
+ -->
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:xacml:policy:id:b8e180de-3dcc-4b5b-814d-925e674e573c" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
<Description>TestActionPolicy@CreatedBy:test@CreatedBy:@ModifiedBy:test@ModifiedBy:</Description>
<Target>
diff --git a/ONAP-XACML/src/test/resources/Config_SampleTest1206.1.xml b/ONAP-XACML/src/test/resources/Config_SampleTest1206.1.xml
index dcfd0c5eb..551616744 100644
--- a/ONAP-XACML/src/test/resources/Config_SampleTest1206.1.xml
+++ b/ONAP-XACML/src/test/resources/Config_SampleTest1206.1.xml
@@ -1,4 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ============LICENSE_START==================================================
+ ONAP Policy Engine
+ ===========================================================================
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ ===========================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END====================================================
+ -->
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:0b67998b-57e2-4e25-9ea9-f9154bf18df1" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
<Description>SampleTest1206@CreatedBy:test@CreatedBy:@ModifiedBy:test@ModifiedBy:</Description>
<Target>
diff --git a/ONAP-XACML/src/test/resources/emptyPapGroupsDefault/xacml.properties b/ONAP-XACML/src/test/resources/emptyPapGroupsDefault/xacml.properties
index be5102f2d..291324a3b 100644
--- a/ONAP-XACML/src/test/resources/emptyPapGroupsDefault/xacml.properties
+++ b/ONAP-XACML/src/test/resources/emptyPapGroupsDefault/xacml.properties
@@ -1,4 +1,24 @@
#
+#============LICENSE_START==================================================
+# ONAP Policy Engine
+#===========================================================================
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+#===========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END==================================================
+#
+
+#
#Fri Feb 16 11:15:29 GMT 2018
xacml.pap.groups.default=
xacml.pap.groups=default
diff --git a/ONAP-XACML/src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml b/ONAP-XACML/src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml
index e27f163b6..4fffaf3aa 100644
--- a/ONAP-XACML/src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml
+++ b/ONAP-XACML/src/test/resources/pdps/default/com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml
@@ -1,4 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ============LICENSE_START==================================================
+ ONAP Policy Engine
+ ===========================================================================
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ ===========================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END====================================================
+ -->
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:0f246245-4e4e-4fb4-87f2-c95ebc0b6c30" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides">
<Description>vFW Demo Policy@CreatedBy:@CreatedBy:@ModifiedBy:@ModifiedBy:</Description>
<Target>
diff --git a/ONAP-XACML/src/test/resources/pdps/default/xacml.pip.properties b/ONAP-XACML/src/test/resources/pdps/default/xacml.pip.properties
index 846848f28..d55f7176b 100644
--- a/ONAP-XACML/src/test/resources/pdps/default/xacml.pip.properties
+++ b/ONAP-XACML/src/test/resources/pdps/default/xacml.pip.properties
@@ -1,4 +1,24 @@
#
+#============LICENSE_START==================================================
+# ONAP Policy Engine
+#===========================================================================
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+#===========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END==================================================
+#
+
+#
#Tue Feb 07 10:35:08 EST 2017
AAF.description=AAFEngine to communicate with AAF to take decisions
AAF.classname=org.onap.policy.xacml.std.pip.engines.aaf.AAFEngine
diff --git a/ONAP-XACML/src/test/resources/pdps/default/xacml.policy.properties b/ONAP-XACML/src/test/resources/pdps/default/xacml.policy.properties
index 1dc2aabf4..9b74b3eb9 100644
--- a/ONAP-XACML/src/test/resources/pdps/default/xacml.policy.properties
+++ b/ONAP-XACML/src/test/resources/pdps/default/xacml.policy.properties
@@ -1,4 +1,24 @@
#
+#============LICENSE_START==================================================
+# ONAP Policy Engine
+#===========================================================================
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+#===========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END==================================================
+#
+
+#
#Tue Feb 07 10:35:08 EST 2017
com.Config_BRMS_Param_BRMSParamvFWDemoPolicy.1.xml.name=Config_BRMS_Param_BRMSParamvFWDemoPolicy
xacml.referencedPolicies=
diff --git a/ONAP-XACML/src/test/resources/pdps/xacml.properties b/ONAP-XACML/src/test/resources/pdps/xacml.properties
index aa1ece0a3..f0bed55ea 100644
--- a/ONAP-XACML/src/test/resources/pdps/xacml.properties
+++ b/ONAP-XACML/src/test/resources/pdps/xacml.properties
@@ -1,4 +1,24 @@
#
+#============LICENSE_START==================================================
+# ONAP Policy Engine
+#===========================================================================
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+#===========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END==================================================
+#
+
+#
#Tue Feb 07 10:37:51 EST 2017
default.description=The default group where new PDP's are put.
default.name=default
diff --git a/ONAP-XACML/testsets/conformance/xacml3.0-ct-v.0.4/IIA001Response.xml b/ONAP-XACML/testsets/conformance/xacml3.0-ct-v.0.4/IIA001Response.xml
index 8c484e0a9..680d27d1d 100644
--- a/ONAP-XACML/testsets/conformance/xacml3.0-ct-v.0.4/IIA001Response.xml
+++ b/ONAP-XACML/testsets/conformance/xacml3.0-ct-v.0.4/IIA001Response.xml
@@ -1,4 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START==================================================
+ ONAP Policy Engine
+ ===========================================================================
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ ===========================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END====================================================
+ -->
<Response
xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"