Commit 30c7fc16 authored by Cyril Dangerville's avatar Cyril Dangerville

Heavy refactoring -> compilation OK

parent d8568893
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.thalesgroup.authzforce</groupId>
<artifactId>authzforce-parent</artifactId>
<version>3.0.7</version>
<version>3.0.8-SNAPSHOT</version>
</parent>
<artifactId>authzforce-core</artifactId>
<version>3.5.9-SNAPSHOT</version>
......@@ -24,11 +24,6 @@
<url>${scm.baseUrl}/core</url>
</scm>
<dependencies>
<dependency>
<!-- Used only to do Strings.join() in StandardFactory's init debug messages -->
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
......@@ -37,35 +32,42 @@
<groupId>org.springframework.ws</groupId>
<artifactId>spring-xml</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
</dependency>
<!-- Include cxf-rt-core/xercesImpl optional dependency: xml-resolver (do not include xercesImpl because
conflicts with JRE) -->
<dependency>
<!-- For loading XML schemas with OASIS catalog (CatalogManager) -->
<groupId>xml-resolver</groupId>
<artifactId>xml-resolver</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<!-- For validation of XACML RFC822Name (email address) -->
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<!-- For validating XML entities (e.g. anyURI type) -->
<dependency>
<!-- For validating certain entities of XACML standard datatypes actually defined by XML schema (e.g. anyURI type) -->
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<!-- Used for DOM parsing / XPath evaluation -->
<groupId>com.thalesgroup.appsec</groupId>
<artifactId>thales-appsec-common-utils</artifactId>
<!-- For validating IP addresses (XACML IPAdress datatype), Domain names (XACML DNSName datatype), etc. without any DNS resolution -->
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<!-- For XACML AttributeSelector evaluation and XPath-based functions (making reference to [XF]) -->
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.6.0-5</version>
</dependency>
<!-- Authzforce dependencies -->
<dependency>
......@@ -75,12 +77,12 @@
<!-- /Authzforce dependencies -->
<!-- Test dependencies -->
<dependency>
<groupId>commons-jxpath</groupId>
<artifactId>commons-jxpath</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>commons-jxpath</groupId> -->
<!-- <artifactId>commons-jxpath</artifactId> -->
<!-- <version>1.3</version> -->
<!-- <scope>test</scope> -->
<!-- </dependency> -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......@@ -122,19 +124,8 @@
<exclude>**/*.md</exclude>
<exclude>**/*.properties</exclude>
<exclude>**/*.gitignore</exclude>
<exclude>src/main/java/com/sun/xacml/cond/xacmlv3/Apply.java</exclude>
</excludes>
<includes>
<include>src/main/java/com/sun/xacml/xacmlv3/**</include>
<include>src/main/java/com/sun/xacml/cond/xacmlv3/**</include>
<include>src/main/java/com/sun/xacml/ctx/xacmlv3/**</include>
<include>src/main/java/com/sun/xacml/CacheManager.java</include>
<include>src/main/java/com/sun/xacml/ObligationExpressions.java</include>
<include>src/main/java/com/sun/xacml/combine/PermitUnlessDenyPolicyAlg</include>
<include>src/main/java/com/sun/xacml/combine/PermitUnlessDenyRuleAlg</include>
<include>src/main/java/com/sun/xacml/combine/DenyUnlessPermitPolicyAlg</include>
<include>src/main/java/com/sun/xacml/combine/DenyUnlessPermitRuleAlg</include>
<include>src/main/java/com/sun/xacml/finder/impl/MultipleResourceFinder.java</include>
<include>src/main/java/com/thalesgroup/authzforce/core/**</include>
<!-- Include test files also -->
<include>src/test/java/**</include>
......
This diff is collapsed.
This diff is collapsed.
/**
*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN")
* AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
* AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use in
* the design, construction, operation or maintenance of any nuclear facility.
*/
package com.sun.xacml;
import org.w3c.dom.Node;
public class DOMHelper {
public static String getLocalName(Node child) {
String localName = child.getLocalName();
if (localName == null)
return child.getNodeName();
return localName;
}
}
\ No newline at end of file
This diff is collapsed.
/**
*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN")
* AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
* AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use in
* the design, construction, operation or maintenance of any nuclear facility.
*/
package com.sun.xacml;
import java.util.Arrays;
/**
* Provides flexible indenting for XML encoding. This class generates
* strings of spaces to be prepended to lines of XML. The strings are
* formed according to a specified indent width and the given depth.
*
* @since 1.0
* @author Marco Barreno
* @author Seth Proctor
*/
public class Indenter
{
/**
* The default indentation width
*/
public static final int DEFAULT_WIDTH = 2;
// The width of one indentation level
private int width;
// the current depth
private int depth;
/**
* Constructs an <code>Indenter</code> with the default indent
* width.
*/
public Indenter() {
this(DEFAULT_WIDTH);
}
/**
* Constructs an <code>Indenter</code> with a user-supplied indent
* width.
*
* @param userWidth the number of spaces to use for each indentation level
*/
public Indenter(int userWidth) {
width = userWidth;
depth = 0;
}
/**
* Move in one width.
*/
public void in() {
depth += width;
}
/**
* Move out one width.
*/
public void out() {
depth -= width;
}
/**
* Create a <code>String</code> of spaces for indentation based on the
* current depth.
*
* @return an indent string to prepend to lines of XML
*/
public String makeString() {
// Return quickly if no indenting
if (depth <= 0) {
return "";
}
// Make a char array and fill it with spaces
char[] array = new char[depth];
Arrays.fill(array, ' ');
// Now return a string built from that char array
return new String(array);
}
}
/**
*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistribution in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of Sun Microsystems, Inc. or the names of contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN")
* AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
* AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST
* REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
* INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY
* OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE,
* EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
* You acknowledge that this software is not designed or intended for use in
* the design, construction, operation or maintenance of any nuclear facility.
*/
package com.sun.xacml;
import com.sun.xacml.ctx.Status;
/**
* This is used as the return value for the various target matching functions. It communicates that
* either the target matches the input request, the target doesn't match the input request, or the
* result is Indeterminate.
*
* @since 1.0
* @author Seth Proctor
*/
public class MatchResult
{
/**
* TODO: use enum constants for values below
*/
/**
* An integer value indicating the the target matches the request
*/
public static final int MATCH = 0;
/**
* An integer value indicating that the target doesn't match the request
*/
public static final int NO_MATCH = 1;
/**
* An integer value indicating the the result is Indeterminate
*/
public static final int INDETERMINATE = 2;
//
private int result;
private Status status;
/**
* Constructor that creates a <code>MatchResult</code> with no Status
*
* @param result
* the applicable result
*/
public MatchResult(int result)
{
this(result, null);
}
/**
* Constructor that creates a <code>MatchResult</code>, including Status data
*
* @param result
* the applicable result
* @param status
* the error information
*
* @throws IllegalArgumentException
* if the input result isn't a valid value
*/
public MatchResult(int result, Status status) throws IllegalArgumentException
{
// check if input result is a valid value
if ((result != MATCH) && (result != NO_MATCH) && (result != INDETERMINATE)) {
throw new IllegalArgumentException("Input result is not a valid" + "value");
}
this.result = result;
this.status = status;
}
/**
* Returns the applicable result
*
* @return the applicable result
*/
public int getResult()
{
return result;
}
/**
* Returns the status if there was an error, or null if no error occurred
*
* @return the error status data or null
*/
public Status getStatus()
{
return status;
}
/**
* @param status
* the status to set
*/
protected void setStatus(Status status)
{
this.status = status;
}
@Override
public String toString()
{
String matchResult = null;
if (result == 0)
{
matchResult = "MATCH";
} else if (result == 1)
{
matchResult = "NO_MATCH";
} else if (result == 2)
{
matchResult = "INDETERMINATE";
}
String msg = "MatchResult: " + matchResult;
if (status != null)
{
msg += " " + status;
}
return msg;
}
}
This diff is collapsed.
/**
* Copyright (C) 2011-2015 Thales Services SAS.
*
* This file is part of AuthZForce.
*
* AuthZForce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* AuthZForce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with AuthZForce. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*
*/
package com.sun.xacml;
import java.util.Set;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.thalesgroup.authzforce.core.PdpModelHandler;
public class ObligationExpressions extends oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressions {
/**
* Logger used for all classes
*/
private static final Logger LOGGER = LoggerFactory
.getLogger(ObligationExpressions.class);
public static oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressions getInstance(
Set<ObligationExpression> obligations) {
oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressions oblgExpr = new oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressions();
oblgExpr.getObligationExpressions().addAll(obligations);
return oblgExpr;
}
public static oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressions getInstance(Node root) {
NodeList nodes = root.getChildNodes();
oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressions obligationExpressions = null;
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
if (node.getNodeName().equals("ObligationExpression")) {
final JAXBElement<oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressions> match;
try {
Unmarshaller u = PdpModelHandler.XACML_3_0_JAXB_CONTEXT.createUnmarshaller();
match = u.unmarshal(root, oasis.names.tc.xacml._3_0.core.schema.wd_17.ObligationExpressions.class);
obligationExpressions = match.getValue();
} catch (Exception e) {
LOGGER.error("Error unmarshalling ObligationExpressions", e);
}
break;
}
}
return obligationExpressions;
}
}
This diff is collapsed.
/**
*
* Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
*
<