From 3fada6cef21c9b16467177d866df778203b51b4d Mon Sep 17 00:00:00 2001
From: Thomas
+ * Parse a GUI template, with parameters into a http servlet-response and use
+ * the default http-response content-type.
*
- * The parser use the VelocityEngine
as internal template evaluator.
+ * The parser use the VelocityEngine
as internal template
+ * evaluator.
*
- * @param httpReq http-request object
- * @param httpResp http-response object
- * @param config Configuration object
+ * @param httpReq http-request object
+ * @param httpResp http-response object
+ * @param config Configuration object
* @param loggerName String, which should be used from logger
*
* @throws GuiBuildException in case of an error
@@ -47,17 +49,17 @@ public interface IVelocityGuiFormBuilder extends IGuiFormBuilder {
void build(HttpServletRequest httpReq, HttpServletResponse httpResp,
IVelocityGuiBuilderConfiguration config, String loggerName) throws GuiBuildException;
-
/**
* Parse a GUI template, with parameters into a http servlet-response.
*
- * The parser use the VelocityEngine
as internal template evaluator.
+ * The parser use the VelocityEngine
as internal template
+ * evaluator.
*
- * @param httpReq http-request object
- * @param httpResp http-response object
- * @param config Configuration object
+ * @param httpReq http-request object
+ * @param httpResp http-response object
+ * @param config Configuration object
* @param contentType http-response content-type, which should be set
- * @param loggerName String, which should be used from logger
+ * @param loggerName String, which should be used from logger
*
* @throws GuiBuildException In case of an error
*/
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ExpressionEvaluationContext.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ExpressionEvaluationContext.java
index 7315dbf1..8f66afff 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ExpressionEvaluationContext.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ExpressionEvaluationContext.java
@@ -21,11 +21,12 @@ package at.gv.egiz.eaaf.core.api.idp.process;
import java.io.Serializable;
import java.util.Map;
-import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition;
+import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition;
/**
- * Context used for evaluation of condition expressions set for {@linkplain Transition Transitions}.
+ * Context used for evaluation of condition expressions set for
+ * {@linkplain Transition Transitions}.
*
* @author tknall
*
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ExpressionEvaluator.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ExpressionEvaluator.java
index 7fa67ae4..18e4533e 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ExpressionEvaluator.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ExpressionEvaluator.java
@@ -29,11 +29,13 @@ public interface ExpressionEvaluator {
/**
* Evaluates a given {@code expression} returning a boolean value.
*
- * @param expressionContext The context which can be used for evaluation of the expression.
- * @param expression The expression resulting in a boolean (must not be {@code null}).
+ * @param expressionContext The context which can be used for evaluation of the
+ * expression.
+ * @param expression The expression resulting in a boolean (must not be
+ * {@code null}).
* @return A boolean value.
* @throws IllegalArgumentException In case of an invalid {@code expression}.
- * @throws NullPointerException In case of a {@code null} expression.
+ * @throws NullPointerException In case of a {@code null} expression.
*/
boolean evaluate(ExpressionEvaluationContext expressionContext, String expression);
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessEngine.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessEngine.java
index d4c221e0..302deae4 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessEngine.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessEngine.java
@@ -19,8 +19,8 @@
package at.gv.egiz.eaaf.core.api.idp.process;
-
import java.io.InputStream;
+
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException;
import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParserException;
@@ -35,64 +35,71 @@ import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessDefinition;
public interface ProcessEngine {
/**
- * Registers a new process definition. Note that existing definitions with the same identifier
- * will be replaced.
+ * Registers a new process definition. Note that existing definitions with the
+ * same identifier will be replaced.
*
* @param processDefinition The process definition to be registered.
*/
void registerProcessDefinition(ProcessDefinition processDefinition);
/**
- * Registers a new process definition given as {@link InputStream}. Note that existing definitions
- * with the same identifier will be replaced.
+ * Registers a new process definition given as {@link InputStream}. Note that
+ * existing definitions with the same identifier will be replaced.
*
- * @param processDefinitionInputStream The input stream to the definition to be registered.
+ * @param processDefinitionInputStream The input stream to the definition to be
+ * registered.
* @return The process definition's identifier.
- * @throws ProcessDefinitionParserException Thrown in case of an error parsing the process
- * definition.
+ * @throws ProcessDefinitionParserException Thrown in case of an error parsing
+ * the process definition.
*/
String registerProcessDefinition(InputStream processDefinitionInputStream)
throws ProcessDefinitionParserException;
/**
- * Creates a process instance according to the referenced process definition, persists it into the
- * database and returns it identifier.
+ * Creates a process instance according to the referenced process definition,
+ * persists it into the database and returns it identifier.
*
- * Note that the method returns the identifier of a process instance which will be needed in order
- * to start a process or to continue process execution after asynchronous task execution (refer to
- * {@link #start(String)} and {@link #signal(String)} for further information).
+ * Note that the method returns the identifier of a process instance which will
+ * be needed in order to start a process or to continue process execution after
+ * asynchronous task execution (refer to {@link #start(String)} and
+ * {@link #signal(String)} for further information).
*
- * @param processDefinitionId The identifier of the respective process definition.
- * @param executionContext The execution context (may be {@code null}).
+ * @param processDefinitionId The identifier of the respective process
+ * definition.
+ * @param executionContext The execution context (may be {@code null}).
* @return The id of the newly created process instance (never {@code null}).
* @throws ProcessExecutionException Thrown in case of error, e.g. when a
- * {@code processDefinitionId} is referenced that does not exist.
+ * {@code processDefinitionId} is referenced
+ * that does not exist.
*/
String createProcessInstance(String processDefinitionId, ExecutionContext executionContext)
throws ProcessExecutionException;
/**
- * Creates a process instance according to the referenced process definition, persists it into the
- * database and returns it identifier.
+ * Creates a process instance according to the referenced process definition,
+ * persists it into the database and returns it identifier.
*
- * Note that the method returns the identifier of a process instance which will be needed in order
- * to start a process or to continue process execution after asynchronous task execution (refer to
- * {@link #start(String)} and {@link #signal(String)} for further information).
+ * Note that the method returns the identifier of a process instance which will
+ * be needed in order to start a process or to continue process execution after
+ * asynchronous task execution (refer to {@link #start(String)} and
+ * {@link #signal(String)} for further information).
*
- * @param processDefinitionId The identifier of the respective process definition.
+ * @param processDefinitionId The identifier of the respective process
+ * definition.
* @return The id of the newly created process instance (never {@code null}).
* @throws ProcessExecutionException Thrown in case of error, e.g. when a
- * {@code processDefinitionId} is referenced that does not exist.
+ * {@code processDefinitionId} is referenced
+ * that does not exist.
*/
String createProcessInstance(String processDefinitionId) throws ProcessExecutionException;
-
/**
* Delete a process instance.
*
* @param processInstanceId The identifier of the respective process.
* @throws ProcessExecutionException Thrown in case of error, e.g. when a
- * {@code processInstanceId} is referenced that does not exist.
+ * {@code processInstanceId} is referenced
+ * that does not exist.
*/
void deleteProcessInstance(String processInstanceId) throws ProcessExecutionException;
@@ -101,8 +108,10 @@ public interface ProcessEngine {
*
* @param processInstanceId The process instance id.
* @return The process instance (never {@code null}).
- * @throws IllegalArgumentException In case the process instance does not/no longer exist.
- * @throws RuntimeException In case the process instance could not be retrieved from persistence.
+ * @throws IllegalArgumentException In case the process instance does not/no
+ * longer exist.
+ * @throws RuntimeException In case the process instance could not be
+ * retrieved from persistence.
*/
ProcessInstance getProcessInstance(String processInstanceId);
@@ -114,7 +123,6 @@ public interface ProcessEngine {
*/
void start(IRequest pendingReq) throws ProcessExecutionException;
-
/**
* Resumes process execution after an asynchronous task has been executed.
*
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessInstanceStoreDao.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessInstanceStoreDao.java
index 641eeab8..6de53432 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessInstanceStoreDao.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessInstanceStoreDao.java
@@ -30,25 +30,30 @@ public interface ProcessInstanceStoreDao {
* Stores a {@link ProcessInstance} defined by {@code pIStore} in the database.
*
* @param piStore the {@link ProcessInstanceStore} to persist.
- * @throws EaafStorageException is thrown if a problem occurs while accessing the database.
+ * @throws EaafStorageException is thrown if a problem occurs while accessing
+ * the database.
*/
void saveOrUpdate(ProcessInstanceStore piStore) throws EaafException;
/**
- * Returns a {@link ProcessInstanceStore}, defined by {@code processInstanceID} from the database,
- * or {@code null} if the object could not be found.
+ * Returns a {@link ProcessInstanceStore}, defined by {@code processInstanceID}
+ * from the database, or {@code null} if the object could not be found.
*
- * @param processInstanceId the id of the {@code ProcessInstanceStore} to retrieve.
+ * @param processInstanceId the id of the {@code ProcessInstanceStore} to
+ * retrieve.
* @return a ProcessInstanceStore, or {@code null}.
- * @throws EaafStorageException is thrown if a problem occurs while accessing the database.
+ * @throws EaafStorageException is thrown if a problem occurs while accessing
+ * the database.
*/
ProcessInstanceStore load(String processInstanceId) throws EaafException;
/**
- * Deletes the {@link ProcessInstance} corresponding with the {@code processInstanceId}.
+ * Deletes the {@link ProcessInstance} corresponding with the
+ * {@code processInstanceId}.
*
* @param processInstanceId the id of the {@code ProcessInstance} to be deleted.
- * @throws EaafStorageException is thrown if a problem occurs while accessing the database.
+ * @throws EaafStorageException is thrown if a problem occurs while accessing
+ * the database.
*/
void remove(String processInstanceId) throws EaafException;
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/Task.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/Task.java
index 06573403..a1fd49e5 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/Task.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/Task.java
@@ -22,7 +22,6 @@ package at.gv.egiz.eaaf.core.api.idp.process;
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
-
/**
* Represents a single task to be performed upon process execution.
*
@@ -34,9 +33,10 @@ public interface Task {
/**
* Executes this task.
*
- * @param pendingReq Provides the current processed protocol request
+ * @param pendingReq Provides the current processed protocol request
* @param executionContext Provides execution related information.
- * @return The pending-request object, because Process-management works recursive
+ * @return The pending-request object, because Process-management works
+ * recursive
* @throws Exception An exception upon task execution.
*/
IRequest execute(IRequest pendingReq, ExecutionContext executionContext)
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/utils/IJsonMapper.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/utils/IJsonMapper.java
index dd7e69fd..a7e4f6fe 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/utils/IJsonMapper.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/utils/IJsonMapper.java
@@ -9,38 +9,43 @@ public interface IJsonMapper {
/**
* Serialize an object to a JSON string.
- *
+ *
* @param value the object to serialize
* @return a JSON string
- * @throws JsonProcessingException thrown when an error occurs during serialization
+ * @throws JsonProcessingException thrown when an error occurs during
+ * serialization
*/
String serialize(Object value) throws EaafJsonMapperException;
/**
* Deserialize a JSON string.
- *
+ *
* @param value the JSON string to deserialize
- * @param clazz optional parameter that determines the type of the returned object. If not set, an
- * {@link Object} is returned.
- * @return the deserialized JSON string as an object of type {@code clazz} or {@link Object}
- * @throws JsonParseException if the JSON string contains invalid content.
- * @throws JsonMappingException if the input JSON structure does not match structure expected for
- * result type
- * @throws IOException if an I/O problem occurs (e.g. unexpected end-of-input)
+ * @param clazz optional parameter that determines the type of the returned
+ * object. If not set, an {@link Object} is returned.
+ * @return the deserialized JSON string as an object of type {@code clazz} or
+ * {@link Object}
+ * @throws JsonParseException if the JSON string contains invalid content.
+ * @throws JsonMappingException if the input JSON structure does not match
+ * structure expected for result type
+ * @throws IOException if an I/O problem occurs (e.g. unexpected
+ * end-of-input)
*/
- * IMPORTANT: external HTML escapetion is required, because it is NOT done internally
- * during the building process
+ * IMPORTANT: external HTML escapetion is required, because it is NOT
+ * done internally during the building process
*
*/
protected abstract void putSpecificViewParameters();
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractVelocityGuiFormBuilderImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractVelocityGuiFormBuilderImpl.java
index 0ab5fa49..5e4af55e 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractVelocityGuiFormBuilderImpl.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractVelocityGuiFormBuilderImpl.java
@@ -27,20 +27,23 @@ import java.io.StringWriter;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
-import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration;
-import at.gv.egiz.eaaf.core.api.gui.IVelocityGuiBuilderConfiguration;
-import at.gv.egiz.eaaf.core.api.gui.IVelocityGuiFormBuilder;
-import at.gv.egiz.eaaf.core.exceptions.GuiBuildException;
-import at.gv.egiz.eaaf.core.impl.gui.velocity.VelocityProvider;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.gv.egiz.eaaf.core.api.data.EaafConstants;
+import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration;
+import at.gv.egiz.eaaf.core.api.gui.IVelocityGuiBuilderConfiguration;
+import at.gv.egiz.eaaf.core.api.gui.IVelocityGuiFormBuilder;
+import at.gv.egiz.eaaf.core.exceptions.GuiBuildException;
+import at.gv.egiz.eaaf.core.impl.gui.velocity.VelocityProvider;
+
/**
* Abstract VeloCity based GUI builder implementation.
*
@@ -50,7 +53,7 @@ import org.slf4j.LoggerFactory;
public abstract class AbstractVelocityGuiFormBuilderImpl implements IVelocityGuiFormBuilder {
private static final Logger log =
LoggerFactory.getLogger(AbstractVelocityGuiFormBuilderImpl.class);
- private static final String DEFAULT_CONTENT_TYPE = EAAFConstants.CONTENTTYPE_HTML_UTF8;
+ private static final String DEFAULT_CONTENT_TYPE = EaafConstants.CONTENTTYPE_HTML_UTF8;
private VelocityEngine engine;
@@ -82,7 +85,6 @@ public abstract class AbstractVelocityGuiFormBuilderImpl implements IVelocityGui
+ IVelocityGuiBuilderConfiguration.class.getName());
}
-
}
@Override
@@ -159,7 +161,8 @@ public abstract class AbstractVelocityGuiFormBuilderImpl implements IVelocityGui
}
/**
- * Generate a new {@link VelocityContext} and populate it with MOA-ID GUI parameters.
+ * Generate a new {@link VelocityContext} and populate it with MOA-ID GUI
+ * parameters.
*
* @param config GUI builder config
* @return Context of Velocity engine
@@ -175,8 +178,8 @@ public abstract class AbstractVelocityGuiFormBuilderImpl implements IVelocityGui
* Load the template from different resources.
*
* @param config GUI builder config
- * @return An {@link InputStream} but never null. The {@link InputStream} had to be closed be the
- * invoking method
+ * @return An {@link InputStream} but never null. The {@link InputStream} had to
+ * be closed be the invoking method
* @throws GuiBuildException In case of an error
*/
@Override
@@ -207,7 +210,6 @@ public abstract class AbstractVelocityGuiFormBuilderImpl implements IVelocityGui
protected abstract InputStream getInternalTemplate(IVelocityGuiBuilderConfiguration config)
throws GuiBuildException;
-
protected String getInternalClasspathTemplateDir(final IVelocityGuiBuilderConfiguration config,
final String defaultClassPathDir) {
String dir = config.getClasspathTemplateDir();
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/velocity/VelocityLogAdapter.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/velocity/VelocityLogAdapter.java
index 05cbaf58..bf8e75a9 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/velocity/VelocityLogAdapter.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/velocity/VelocityLogAdapter.java
@@ -37,8 +37,8 @@ public class VelocityLogAdapter implements LogChute {
public VelocityLogAdapter() {
try {
/*
- * register this class as a logger with the Velocity singleton (NOTE: this would not work for
- * the non-singleton method.)
+ * register this class as a logger with the Velocity singleton (NOTE: this would
+ * not work for the non-singleton method.)
*/
Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM, this);
Velocity.init();
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/AuthenticationData.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/AuthenticationData.java
index 1c1de7c8..05ea08b2 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/AuthenticationData.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/AuthenticationData.java
@@ -28,15 +28,17 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
-import at.gv.egiz.eaaf.core.api.idp.IAuthData;
-import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;
-import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
-import at.gv.egiz.eaaf.core.impl.data.Pair;
+
import org.apache.commons.collections4.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import at.gv.egiz.eaaf.core.api.idp.IAuthData;
+import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;
+import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
+import at.gv.egiz.eaaf.core.impl.data.Pair;
+
/**
* Service-Provider specific authentication data.
*
@@ -70,8 +72,6 @@ public class AuthenticationData implements IAuthData, Serializable {
private String encSourceId;
private String encSourceIdType;
-
-
@Deprecated
private String bpk;
@Deprecated
@@ -81,7 +81,6 @@ public class AuthenticationData implements IAuthData, Serializable {
private String ccc = null;
-
private boolean foreigner = false;
private String eidasLoa = null;
@@ -112,14 +111,12 @@ public class AuthenticationData implements IAuthData, Serializable {
}
-
@Override
public Date getAuthenticationIssueInstant() {
return getDateCopyOrNull(this.issueInstant);
}
-
@Override
public String getAuthenticationIssueInstantString() {
final SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
@@ -142,7 +139,6 @@ public class AuthenticationData implements IAuthData, Serializable {
return this.ccc;
}
-
@Override
@Deprecated
public String getBpk() {
@@ -159,15 +155,12 @@ public class AuthenticationData implements IAuthData, Serializable {
this.bpk = bpk;
}
-
@Override
public Date getDateOfBirth() {
return getDateCopyOrNull(this.dateOfBirth);
}
-
-
@Override
public String getFormatedDateOfBirth() {
final DateFormat pvpDateFormat = new SimpleDateFormat(IDENTITY_LINK_DATE_FORMAT);
@@ -179,13 +172,11 @@ public class AuthenticationData implements IAuthData, Serializable {
}
-
@Override
public String getFamilyName() {
return this.familyName;
}
-
@Override
public String getGivenName() {
return this.givenName;
@@ -207,7 +198,6 @@ public class AuthenticationData implements IAuthData, Serializable {
return identificationValue;
}
-
@Override
@Deprecated
public String getIdentificationType() {
@@ -296,7 +286,6 @@ public class AuthenticationData implements IAuthData, Serializable {
this.identificationType = identificationType;
}
-
@Override
@Deprecated
public String getBpkType() {
@@ -319,13 +308,11 @@ public class AuthenticationData implements IAuthData, Serializable {
}
-
@Override
public boolean isForeigner() {
return this.foreigner;
}
-
/**
* Indicate the the user is a foreigner.
*
@@ -340,7 +327,6 @@ public class AuthenticationData implements IAuthData, Serializable {
return ssoSession;
}
-
/**
* Indicate that the authentication was done by using an active SSO session.
*
@@ -350,7 +336,6 @@ public class AuthenticationData implements IAuthData, Serializable {
this.ssoSession = ssoSession;
}
-
/**
* Country Code for the authenticated user.
*
@@ -374,7 +359,6 @@ public class AuthenticationData implements IAuthData, Serializable {
this.sessionIndex = sessionIndex;
}
-
@Override
public String getNameID() {
return this.nameID;
@@ -427,7 +411,6 @@ public class AuthenticationData implements IAuthData, Serializable {
this.ssoSessionValidTo = getDateCopyOrNull(ssoSessionValidTo);
}
-
/*
* (non-Javadoc)
*
@@ -450,7 +433,7 @@ public class AuthenticationData implements IAuthData, Serializable {
/**
* Returns a generic data-object with is stored with a specific identifier.
*
- * @param key The specific identifier of the data object
+ * @param key The specific identifier of the data object
* @param clazz The class type which is stored with this key
* @return The data object or null if no data is found with this key
*/
@@ -484,11 +467,11 @@ public class AuthenticationData implements IAuthData, Serializable {
/**
* Store a generic data-object to session with a specific identifier.
*
- * @param key Identifier for this data-object
- * @param object Generic data-object which should be stored. This data-object had to be implement
- * the 'java.io.Serializable' interface
- * @throws SessionDataStorageException Error message if the data-object can not stored to generic
- * session-data storage
+ * @param key Identifier for this data-object
+ * @param object Generic data-object which should be stored. This data-object
+ * had to be implement the 'java.io.Serializable' interface
+ * @throws SessionDataStorageException Error message if the data-object can not
+ * stored to generic session-data storage
*/
public void setGenericData(final String key, final Object object) throws EaafStorageException {
if (StringUtils.isEmpty(key)) {
@@ -499,7 +482,7 @@ public class AuthenticationData implements IAuthData, Serializable {
if (object != null && !Serializable.class.isInstance(object)) {
log.warn(
- "Generic data can only store objects which implements the 'Seralizable' interface");
+ "Generic data can only store objects which implements the 'Seralizable' interface");
throw new EaafStorageException(
"Generic data can only store objects which implements the 'Seralizable' interface",
null);
@@ -524,7 +507,6 @@ public class AuthenticationData implements IAuthData, Serializable {
return this.additionalBpks;
}
-
/**
* Set the encrypted SourceId for current authenticated user.
*
@@ -543,8 +525,6 @@ public class AuthenticationData implements IAuthData, Serializable {
this.encSourceIdType = encSourceIdType;
}
-
-
/**
* Add an additional bPK Pair bPK/bPKType into authdata.
*
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/EaafCoreSpringResourceProvider.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/EaafCoreSpringResourceProvider.java
index 74b6a0fb..3548684b 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/EaafCoreSpringResourceProvider.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/EaafCoreSpringResourceProvider.java
@@ -19,10 +19,11 @@
package at.gv.egiz.eaaf.core.impl.idp;
-import at.gv.egiz.components.spring.api.SpringResourceProvider;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
+import at.gv.egiz.components.spring.api.SpringResourceProvider;
+
public class EaafCoreSpringResourceProvider implements SpringResourceProvider {
@Override
@@ -41,7 +42,7 @@ public class EaafCoreSpringResourceProvider implements SpringResourceProvider {
final ClassPathResource sl20AuthConfig =
new ClassPathResource("/eaaf_core.beans.xml", EaafCoreSpringResourceProvider.class);
- return new Resource[] {sl20AuthConfig};
+ return new Resource[] { sl20AuthConfig };
}
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/EidAuthenticationData.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/EidAuthenticationData.java
index ea197478..5779f12b 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/EidAuthenticationData.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/EidAuthenticationData.java
@@ -2,22 +2,23 @@ package at.gv.egiz.eaaf.core.impl.idp;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
-import at.gv.egiz.eaaf.core.api.data.PVPAttributeDefinitions.EID_IDENTITY_STATUS_LEVEL_VALUES;
-import at.gv.egiz.eaaf.core.api.idp.IEidAuthData;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.lang.NonNull;
import org.springframework.util.Assert;
+import at.gv.egiz.eaaf.core.api.data.PvpAttributeDefinitions.EidIdentityStatusLevelValues;
+import at.gv.egiz.eaaf.core.api.idp.IEidAuthData;
+
public class EidAuthenticationData extends AuthenticationData implements IEidAuthData {
private static final Logger log = LoggerFactory.getLogger(EidAuthenticationData.class);
-
private static final long serialVersionUID = -7106142572904327044L;
private byte[] eidToken;
private byte[] signerCertificate;
- private EID_IDENTITY_STATUS_LEVEL_VALUES eidStatus;
+ private EidIdentityStatusLevelValues eidStatus;
private String vdaEndpointUrl;
private boolean useMandate = false;
@@ -32,7 +33,7 @@ public class EidAuthenticationData extends AuthenticationData implements IEidAut
}
@Override
- public EID_IDENTITY_STATUS_LEVEL_VALUES getEidStatus() {
+ public EidIdentityStatusLevelValues getEidStatus() {
return this.eidStatus;
}
@@ -53,7 +54,7 @@ public class EidAuthenticationData extends AuthenticationData implements IEidAut
*
* @param eidStatus Status of the E-ID
*/
- public void setEidStatus(final EID_IDENTITY_STATUS_LEVEL_VALUES eidStatus) {
+ public void setEidStatus(final EidIdentityStatusLevelValues eidStatus) {
this.eidStatus = eidStatus;
}
@@ -103,7 +104,6 @@ public class EidAuthenticationData extends AuthenticationData implements IEidAut
this.useMandate = useMandate;
}
-
/**
* Set URL of the EndPoint that was used on VDA for authentication.
*
@@ -121,5 +121,4 @@ public class EidAuthenticationData extends AuthenticationData implements IEidAut
}
}
-
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
index 241b43c9..d2365e4a 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/AbstractAuthenticationManager.java
@@ -24,14 +24,22 @@ import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
+
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.text.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
-import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
+import at.gv.egiz.eaaf.core.api.data.EaafConstants;
import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
-import at.gv.egiz.eaaf.core.api.idp.IspConfiguration;
+import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration;
import at.gv.egiz.eaaf.core.api.idp.auth.IAuthenticationManager;
import at.gv.egiz.eaaf.core.api.idp.auth.ISsoManager;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
@@ -46,11 +54,6 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.modules.ModuleRegistration;
import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl;
import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.text.StringEscapeUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
public abstract class AbstractAuthenticationManager implements IAuthenticationManager {
private static final Logger log = LoggerFactory.getLogger(AbstractAuthenticationManager.class);
@@ -73,14 +76,14 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
protected IRevisionLogger revisionsLogger;
@Autowired(required = false)
protected ISsoManager ssoManager;
- @Autowired ModuleRegistration moduleRegistration;
+ @Autowired
+ ModuleRegistration moduleRegistration;
/*
* (non-Javadoc)
*
- * @see
- * at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#addParameterNameToWhiteList(java.lang
- * .String)
+ * @see at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#
+ * addParameterNameToWhiteList(java.lang .String)
*/
@Override
public final void addParameterNameToWhiteList(final String httpReqParam) {
@@ -93,9 +96,8 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
/*
* (non-Javadoc)
*
- * @see
- * at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#addHeaderNameToWhiteList(java.lang.
- * String)
+ * @see at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#
+ * addHeaderNameToWhiteList(java.lang. String)
*/
@Override
public final void addHeaderNameToWhiteList(final String httpReqParam) {
@@ -108,9 +110,8 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
/*
* (non-Javadoc)
*
- * @see
- * at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#addHeaderNameToWhiteList(java.lang.
- * String)
+ * @see at.gv.egiz.eaaf.core.impl.idp.auth.IAuthenticationManager#
+ * addHeaderNameToWhiteList(java.lang. String)
*/
@Override
public final boolean doAuthentication(final HttpServletRequest httpReq,
@@ -124,7 +125,7 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
}
// load OA configuration from pending request
- final IspConfiguration oaParam = pendingReq.getServiceProviderConfiguration();
+ final ISpConfiguration oaParam = pendingReq.getServiceProviderConfiguration();
// set logging context and log unique OA identifier to revision log
TransactionIdUtils.setServiceProviderId(oaParam.getUniqueIdentifier());
@@ -137,7 +138,6 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
throw new NoPassivAuthenticationException();
}
-
// check Single Sign-On functionality if SSOManager is available
boolean isValidSsoSession = false;
if (ssoManager != null) {
@@ -149,16 +149,15 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
isValidSsoSession = ssoManager.checkAndValidateSsoSession(pendingReq, httpReq, httpResp)
&& pendingReq.needSingleSignOnFunctionality();
-
}
// check if session is already authenticated
- // boolean isSessionAuthenticated = tryPerformAuthentication((RequestImpl) pendingReq,
+ // boolean isSessionAuthenticated = tryPerformAuthentication((RequestImpl)
+ // pendingReq,
// isValidSSOSession);
// boolean isSessionAuthenticated = isValidSSOSession &&
// StringUtils.isNotEmpty(pendingReq.getSSOSessionIdentifier());
-
// force new authentication authentication process
if (pendingReq.forceAuth()) {
startAuthenticationProcess(httpReq, (RequestImpl) pendingReq);
@@ -169,7 +168,6 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
sendSingleSignOnConsentsEvaluation((RequestImpl) pendingReq);
return false;
-
} else if (pendingReq.isPassiv()) {
if (isValidSsoSession
&& StringUtils.isNotEmpty(pendingReq.getInternalSsoSessionIdentifier())) {
@@ -207,7 +205,6 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
log.debug("Close session. Remove pending request ... ");
requestStoreage.removePendingRequest(pendingReq.getPendingRequestId());
-
if (ssoManager != null) {
try {
log.trace("'SSOManager' active. Search for active SSO sessions ... ");
@@ -229,11 +226,11 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
/**
* Populate process execution context and start process engine.
*
- * @param httpReq http request
+ * @param httpReq http request
* @param pendingReq current pending request
* @throws ServletException In case of a servlet error
- * @throws IOException In case of an IO error
- * @throws EaafException In case of EAAF processing error
+ * @throws IOException In case of an IO error
+ * @throws EaafException In case of EAAF processing error
*/
private void startAuthenticationProcess(final HttpServletRequest httpReq,
final RequestImpl pendingReq) throws EaafException {
@@ -245,15 +242,15 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
final ExecutionContext executionContext = new ExecutionContextImpl();
// set oaIdentifeir
- executionContext.put(EAAFConstants.PROCESS_ENGINE_SERVICE_PROVIDER_ENTITYID,
+ executionContext.put(EaafConstants.PROCESS_ENGINE_SERVICE_PROVIDER_ENTITYID,
pendingReq.getServiceProviderConfiguration().getUniqueIdentifier());
// add X509 SSL client certificate if exist
if (httpReq.getAttribute("javax.servlet.request.X509Certificate") != null) {
log.debug("Find SSL-client-certificate on request --> Add it to context");
- executionContext.put(EAAFConstants.PROCESS_ENGINE_SSL_CLIENT_CERTIFICATE,
+ executionContext.put(EaafConstants.PROCESS_ENGINE_SSL_CLIENT_CERTIFICATE,
(X509Certificate[]) httpReq.getAttribute("javax.servlet.request.X509Certificate"));
- pendingReq.setRawDataToTransaction(EAAFConstants.PROCESS_ENGINE_SSL_CLIENT_CERTIFICATE,
+ pendingReq.setRawDataToTransaction(EaafConstants.PROCESS_ENGINE_SSL_CLIENT_CERTIFICATE,
httpReq.getAttribute("javax.servlet.request.X509Certificate"));
}
@@ -287,8 +284,6 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
}
}
-
-
// populate more IDP specific information to execution context
populateExecutionContext(executionContext, pendingReq, httpReq);
@@ -301,8 +296,8 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
* Add additional parameters into context of process-engine.
*
* @param executionContext Process-engine context
- * @param pendingReq Current pending request
- * @param httpReq http request
+ * @param pendingReq Current pending request
+ * @param httpReq http request
*
* @throws EaafException In case of an error
*/
@@ -314,8 +309,8 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
*
* @param pendingReq current pending request
* @throws ServletException In case of a servlet error
- * @throws IOException In case of an IO error
- * @throws EaafException In case of a EAAF processing error
+ * @throws IOException In case of an IO error
+ * @throws EaafException In case of a EAAF processing error
*/
private void sendSingleSignOnConsentsEvaluation(final RequestImpl pendingReq) throws EaafException {
@@ -333,11 +328,10 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
}
-
/**
* Select a specific process and starting process engine.
*
- * @param pendingReq current pending request
+ * @param pendingReq current pending request
* @param executionContext current context for process-engine
* @throws EaafException In case of an process-engine error
*/
@@ -345,7 +339,7 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
final ExecutionContext executionContext) throws EaafException {
try {
// put pending-request ID on execurtionContext
- executionContext.put(EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID,
+ executionContext.put(EaafConstants.PROCESS_ENGINE_PENDINGREQUESTID,
pendingReq.getPendingRequestId());
// create process instance
@@ -354,7 +348,7 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
if (processDefinitionId == null) {
log.warn("No suitable process found for PendingReqId " + pendingReq.getPendingRequestId());
- throw new EaafException("process.02", new Object[] {pendingReq.getPendingRequestId()});
+ throw new EaafException("process.02", new Object[] { pendingReq.getPendingRequestId() });
}
@@ -383,7 +377,7 @@ public abstract class AbstractAuthenticationManager implements IAuthenticationMa
}
throw new EaafException("process.01",
- new Object[] {pendingReq.getProcessInstanceId(), pendingReq.getPendingRequestId()}, e);
+ new Object[] { pendingReq.getProcessInstanceId(), pendingReq.getPendingRequestId() }, e);
}
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java
index 1afa879f..0834aa7c 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java
@@ -19,6 +19,12 @@
package at.gv.egiz.eaaf.core.impl.idp.auth;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
import at.gv.egiz.eaaf.core.api.idp.process.ProcessInstanceStoreDao;
@@ -29,11 +35,6 @@ import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException;
import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl;
import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
@Service("RequestStorage")
public class RequestStorage implements IRequestStorage {
@@ -155,8 +156,8 @@ public class RequestStorage implements IRequestStorage {
* (non-Javadoc)
*
* @see
- * at.gv.egovernment.moa.id.storage.IRequestStorage#changePendingRequestID(at.gv.egovernment.moa.
- * id.moduls.IRequest)
+ * at.gv.egovernment.moa.id.storage.IRequestStorage#changePendingRequestID(at.gv
+ * .egovernment.moa. id.moduls.IRequest)
*/
@Override
public String changePendingRequestID(final IRequest pendingRequest) throws EaafException {
@@ -169,13 +170,13 @@ public class RequestStorage implements IRequestStorage {
.getPendingRequestIdWithOutChecks(pendingRequest.getPendingRequestId());
} catch (final PendingReqIdValidationException e) {
- // it's no problem, because it must be valid before when pending-request was loaded and we
+ // it's no problem, because it must be valid before when pending-request was
+ // loaded and we
// change it now
oldInternalRequestID = e.getInvalidInternalPendingReqId();
}
-
// generate new pendingReqId and get internalPendingReqId
final String newRequestID = pendingReqIdGenerationStrategy.generateExternalPendingRequestId();
log.debug("Change pendingRequestID from " + pendingRequest.getPendingRequestId() + " to "
@@ -189,11 +190,10 @@ public class RequestStorage implements IRequestStorage {
} catch (final PendingReqIdValidationException e) {
throw new EaafException("internal.99",
- new Object[] {"Generate invalid pendingRequestId. Something looks WRONG"}, e);
+ new Object[] { "Generate invalid pendingRequestId. Something looks WRONG" }, e);
}
-
// change Key in cache
transactionStorage.changeKey(oldInternalRequestID, newInternalPendingRequestId,
pendingRequest);
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java
index b12658f5..f5c687f1 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/AbstractAuthenticationDataBuilder.java
@@ -25,14 +25,26 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map.Entry;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.lang.NonNull;
+import org.springframework.util.Assert;
+import org.springframework.util.Base64Utils;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
import at.gv.egiz.eaaf.core.api.IRequest;
-import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
-import at.gv.egiz.eaaf.core.api.data.ExtendedPVPAttributeDefinitions;
-import at.gv.egiz.eaaf.core.api.data.PVPAttributeDefinitions;
+import at.gv.egiz.eaaf.core.api.data.EaafConstants;
+import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions;
+import at.gv.egiz.eaaf.core.api.data.PvpAttributeDefinitions;
import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.idp.IAuthenticationDataBuilder;
import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;
-import at.gv.egiz.eaaf.core.api.idp.IspConfiguration;
+import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration;
import at.gv.egiz.eaaf.core.api.idp.auth.data.IAuthProcessDataContainer;
import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;
import at.gv.egiz.eaaf.core.exceptions.EaafAuthenticationException;
@@ -47,17 +59,6 @@ import at.gv.egiz.eaaf.core.impl.idp.AuthenticationData;
import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser;
import at.gv.egiz.eaaf.core.impl.utils.XPathUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.lang.NonNull;
-import org.springframework.util.Assert;
-import org.springframework.util.Base64Utils;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
public abstract class AbstractAuthenticationDataBuilder implements IAuthenticationDataBuilder {
private static final Logger log =
@@ -83,7 +84,7 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
pendingReq.getSessionData(AuthProcessDataWrapper.class);
try {
- if (authProcessData.isEIDProcess()) {
+ if (authProcessData.isEidProcess()) {
log.debug("Building AuthData from new E-ID information ... ");
authData = getAuthDataInstance(pendingReq);
Assert.notNull(authData, "AuthData is null");
@@ -107,7 +108,7 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
} catch (XPathException | DOMException | EaafException e) {
log.warn("Can not build authentication data from auth. process information");
- throw new EaafAuthenticationException("builder.11", new Object[] {e.getMessage()}, e);
+ throw new EaafAuthenticationException("builder.11", new Object[] { e.getMessage() }, e);
}
@@ -127,8 +128,8 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
protected abstract IAuthData getAuthDataInstance(IRequest pendingReq) throws EaafException;
/**
- * Build service-specific AuthData by using information from E-ID This builder uses vSZ, MDS and
- * Consent as input information.
+ * Build service-specific AuthData by using information from E-ID This builder
+ * uses vSZ, MDS and Consent as input information.
*
* @param pendingReq current pendingRequest
* @return {@link IAuthData} but never null
@@ -137,13 +138,13 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
protected abstract void buildServiceSpecificAuthenticationData(IAuthData authData,
IRequest pendingReq) throws EaafException;
-
/**
* Add generic E-ID information into already existing AuthData.
*
- * @param authData AuthData object
- * @param authProcessData Authentication information holder from current pending request
- * @param pendingReq current pending request
+ * @param authData AuthData object
+ * @param authProcessData Authentication information holder from current pending
+ * request
+ * @param pendingReq current pending request
*/
private void buildInternalAuthDataGeneric(@NonNull final IAuthData authData,
@NonNull final IAuthProcessDataContainer authProcessData,
@@ -164,7 +165,8 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
// TODO: check if it is needed
// if (authProcessData.getGenericSessionDataStorage() != null &&
// !authProcessData.getGenericSessionDataStorage().isEmpty())
- // includedToGenericAuthData = authProcessData.getGenericSessionDataStorage().keySet();
+ // includedToGenericAuthData =
+ // authProcessData.getGenericSessionDataStorage().keySet();
// else
includedToGenericAuthData = new ArrayList<>();
@@ -178,31 +180,28 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
// ####################################################
// set MDS and vSZ
internalAuthData.setFamilyName(authProcessData
- .getGenericDataFromSession(PVPAttributeDefinitions.PRINCIPAL_NAME_NAME, String.class));
+ .getGenericDataFromSession(PvpAttributeDefinitions.PRINCIPAL_NAME_NAME, String.class));
internalAuthData.setGivenName(authProcessData
- .getGenericDataFromSession(PVPAttributeDefinitions.GIVEN_NAME_NAME, String.class));
+ .getGenericDataFromSession(PvpAttributeDefinitions.GIVEN_NAME_NAME, String.class));
internalAuthData.setDateOfBirth(authProcessData
- .getGenericDataFromSession(PVPAttributeDefinitions.BIRTHDATE_NAME, String.class));
+ .getGenericDataFromSession(PvpAttributeDefinitions.BIRTHDATE_NAME, String.class));
internalAuthData.setEncSourceId(authProcessData.getGenericDataFromSession(
- ExtendedPVPAttributeDefinitions.EID_ENCRYPTED_SOURCEID_NAME, String.class));
+ ExtendedPvpAttributeDefinitions.EID_ENCRYPTED_SOURCEID_NAME, String.class));
internalAuthData.setEncSourceIdType(authProcessData.getGenericDataFromSession(
- ExtendedPVPAttributeDefinitions.EID_ENCRYPTED_SOURCEID_TYPE_NAME, String.class));
+ ExtendedPvpAttributeDefinitions.EID_ENCRYPTED_SOURCEID_TYPE_NAME, String.class));
// ####################################################
// set QAA level
setQaaLevel(internalAuthData, authProcessData);
-
// ####################################################
// set isForeigner flag
setFlagForeigner(internalAuthData, authProcessData);
-
// ####################################################
// set citizen country-code
setCitizenCountryCode(internalAuthData, authProcessData);
-
// set generic authProcessData to authdata
for (final Entrynull
@@ -340,7 +340,6 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
authData.setBaseIdTransferRestrication(
pendingReq.getServiceProviderConfiguration().hasBaseIdTransferRestriction());
-
// ####################################################
// parse user info's from identityLink
IIdentityLink idlFromPvpAttr = null;
@@ -351,10 +350,10 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
} else {
// identityLink is not direct in MOASession
final String pvpAttrIdl = authProcessData
- .getGenericDataFromSession(PVPAttributeDefinitions.EID_IDENTITY_LINK_NAME, String.class);
+ .getGenericDataFromSession(PvpAttributeDefinitions.EID_IDENTITY_LINK_NAME, String.class);
// find PVP-Attr. which contains the IdentityLink
if (StringUtils.isNotEmpty(pvpAttrIdl)) {
- log.debug("Find PVP-Attr: " + PVPAttributeDefinitions.EID_IDENTITY_LINK_FRIENDLY_NAME
+ log.debug("Find PVP-Attr: " + PvpAttributeDefinitions.EID_IDENTITY_LINK_FRIENDLY_NAME
+ " --> Parse basic user info's from that attribute.");
InputStream idlStream = null;
try {
@@ -373,7 +372,7 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
} finally {
try {
- includedToGenericAuthData.remove(PVPAttributeDefinitions.EID_IDENTITY_LINK_NAME);
+ includedToGenericAuthData.remove(PvpAttributeDefinitions.EID_IDENTITY_LINK_NAME);
if (idlStream != null) {
idlStream.close();
}
@@ -390,28 +389,28 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
log.debug(
"No IdentityLink found or not parseable --> Parse basic user info's from single PVP-Attributes.");
authData.setFamilyName(authProcessData
- .getGenericDataFromSession(PVPAttributeDefinitions.PRINCIPAL_NAME_NAME, String.class));
+ .getGenericDataFromSession(PvpAttributeDefinitions.PRINCIPAL_NAME_NAME, String.class));
authData.setGivenName(authProcessData
- .getGenericDataFromSession(PVPAttributeDefinitions.GIVEN_NAME_NAME, String.class));
+ .getGenericDataFromSession(PvpAttributeDefinitions.GIVEN_NAME_NAME, String.class));
authData.setDateOfBirth(authProcessData
- .getGenericDataFromSession(PVPAttributeDefinitions.BIRTHDATE_NAME, String.class));
+ .getGenericDataFromSession(PvpAttributeDefinitions.BIRTHDATE_NAME, String.class));
authData.setIdentificationValue(authProcessData
- .getGenericDataFromSession(PVPAttributeDefinitions.EID_SOURCE_PIN_NAME, String.class));
+ .getGenericDataFromSession(PvpAttributeDefinitions.EID_SOURCE_PIN_NAME, String.class));
authData.setIdentificationType(authProcessData.getGenericDataFromSession(
- PVPAttributeDefinitions.EID_SOURCE_PIN_TYPE_NAME, String.class));
+ PvpAttributeDefinitions.EID_SOURCE_PIN_TYPE_NAME, String.class));
// remove corresponding keys from genericSessionData if exists
- includedToGenericAuthData.remove(PVPAttributeDefinitions.PRINCIPAL_NAME_NAME);
- includedToGenericAuthData.remove(PVPAttributeDefinitions.GIVEN_NAME_NAME);
- includedToGenericAuthData.remove(PVPAttributeDefinitions.BIRTHDATE_NAME);
- includedToGenericAuthData.remove(PVPAttributeDefinitions.EID_SOURCE_PIN_NAME);
- includedToGenericAuthData.remove(PVPAttributeDefinitions.EID_SOURCE_PIN_TYPE_NAME);
+ includedToGenericAuthData.remove(PvpAttributeDefinitions.PRINCIPAL_NAME_NAME);
+ includedToGenericAuthData.remove(PvpAttributeDefinitions.GIVEN_NAME_NAME);
+ includedToGenericAuthData.remove(PvpAttributeDefinitions.BIRTHDATE_NAME);
+ includedToGenericAuthData.remove(PvpAttributeDefinitions.EID_SOURCE_PIN_NAME);
+ includedToGenericAuthData.remove(PvpAttributeDefinitions.EID_SOURCE_PIN_TYPE_NAME);
}
}
if (authData.getIdentificationType() != null
- && !authData.getIdentificationType().equals(EAAFConstants.URN_PREFIX_BASEID)) {
+ && !authData.getIdentificationType().equals(EaafConstants.URN_PREFIX_BASEID)) {
log.trace("IdentificationType is not a baseID --> clear it. ");
authData.setBpk(authData.getIdentificationValue());
authData.setBpkType(authData.getIdentificationType());
@@ -420,22 +419,18 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
authData.setIdentificationType(null);
}
-
// ####################################################
// set QAA level
setQaaLevel(authData, authProcessData);
-
// ####################################################
// set isForeigner flag
setFlagForeigner(authData, authProcessData);
-
// ####################################################
// set citizen country-code
setCitizenCountryCode(authData, authProcessData);
-
// ####################################################
// set bPK and IdentityLink
final String pvpBpkValue = getBpkValueFromPvpAttribute(authProcessData);
@@ -449,12 +444,12 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
log.info(
"Can not build authData, because moaSession include no bPK, encrypted bPK or baseID");
throw new EaafBuilderException("builder.08",
- new Object[] {"No " + PVPAttributeDefinitions.BPK_FRIENDLY_NAME + " or "
- + PVPAttributeDefinitions.EID_SOURCE_PIN_FRIENDLY_NAME + " or "
- + PVPAttributeDefinitions.ENC_BPK_LIST_FRIENDLY_NAME},
- "No " + PVPAttributeDefinitions.BPK_FRIENDLY_NAME + " or "
- + PVPAttributeDefinitions.EID_SOURCE_PIN_FRIENDLY_NAME + " or "
- + PVPAttributeDefinitions.ENC_BPK_LIST_FRIENDLY_NAME);
+ new Object[] { "No " + PvpAttributeDefinitions.BPK_FRIENDLY_NAME + " or "
+ + PvpAttributeDefinitions.EID_SOURCE_PIN_FRIENDLY_NAME + " or "
+ + PvpAttributeDefinitions.ENC_BPK_LIST_FRIENDLY_NAME },
+ "No " + PvpAttributeDefinitions.BPK_FRIENDLY_NAME + " or "
+ + PvpAttributeDefinitions.EID_SOURCE_PIN_FRIENDLY_NAME + " or "
+ + PvpAttributeDefinitions.ENC_BPK_LIST_FRIENDLY_NAME);
}
@@ -513,10 +508,10 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
"Can not build authData, because moaSession include no valid bPK, encrypted bPK or sourceID");
throw new EaafBuilderException("builder.13",
new Object[] {
- pendingReq.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier()},
- "No valid " + PVPAttributeDefinitions.BPK_FRIENDLY_NAME + " or "
- + PVPAttributeDefinitions.EID_SOURCE_PIN_FRIENDLY_NAME + " or "
- + PVPAttributeDefinitions.ENC_BPK_LIST_FRIENDLY_NAME);
+ pendingReq.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier() },
+ "No valid " + PvpAttributeDefinitions.BPK_FRIENDLY_NAME + " or "
+ + PvpAttributeDefinitions.EID_SOURCE_PIN_FRIENDLY_NAME + " or "
+ + PvpAttributeDefinitions.ENC_BPK_LIST_FRIENDLY_NAME);
}
}
@@ -536,7 +531,7 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
@Deprecated
protected abstract Pair
+ * Get bPK from PVP Attribute 'BPK_NAME', which could be exist in MOASession as
+ * 'GenericData'.
*
*
*
*
* @param session MOASession, but never null
- * @return bPK, which was received by PVP-Attribute, or session.getGenericDataFromSession(PVPConstants.BPK_NAME, String.class)
* null
if no attribute exists
+ * @return bPK, which was received by PVP-Attribute, or null
if no
+ * attribute exists
*/
@Deprecated
private String getBpkValueFromPvpAttribute(final IAuthProcessDataContainer session) {
String pvpBpkValueAttr =
- session.getGenericDataFromSession(PVPAttributeDefinitions.BPK_NAME, String.class);
+ session.getGenericDataFromSession(PvpAttributeDefinitions.BPK_NAME, String.class);
if (StringUtils.isNotEmpty(pvpBpkValueAttr)) {
- // fix a wrong bPK-value prefix, which was used in some PVP Standardportal implementations
+ // fix a wrong bPK-value prefix, which was used in some PVP Standardportal
+ // implementations
if (pvpBpkValueAttr.startsWith("bPK:")) {
- log.warn("Attribute " + PVPAttributeDefinitions.BPK_NAME
+ log.warn("Attribute " + PvpAttributeDefinitions.BPK_NAME
+ " contains a not standardize prefix! Staring attribute value correction process ...");
pvpBpkValueAttr = pvpBpkValueAttr.substring("bPK:".length());
@@ -685,18 +685,16 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
final String[] spitted = pvpBpkValueAttr.split(":");
if (spitted.length == 2) {
- log.debug("Find PVP-Attr: " + PVPAttributeDefinitions.BPK_FRIENDLY_NAME);
+ log.debug("Find PVP-Attr: " + PvpAttributeDefinitions.BPK_FRIENDLY_NAME);
return spitted[1];
-
-
} else if (spitted.length > 2) {
- log.warn("Attribute " + PVPAttributeDefinitions.BPK_NAME
+ log.warn("Attribute " + PvpAttributeDefinitions.BPK_NAME
+ " has a wrong encoding and can NOT be USED!" + " Value:" + pvpBpkValueAttr);
return null;
} else {
- log.debug("Find PVP-Attr: " + PVPAttributeDefinitions.BPK_FRIENDLY_NAME
+ log.debug("Find PVP-Attr: " + PvpAttributeDefinitions.BPK_FRIENDLY_NAME
+ " without prefix. Use it as it is");
return spitted[0];
@@ -708,49 +706,52 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati
}
/**
- * Get bPK-Type from PVP Attribute 'EID_SECTOR_FOR_IDENTIFIER_NAME', which could be exist in
- * MOASession as 'GenericData'.
+ * Get bPK-Type from PVP Attribute 'EID_SECTOR_FOR_IDENTIFIER_NAME', which could
+ * be exist in MOASession as 'GenericData'.
*
*
*
*
* @param session MOASession, but never null
- * @return bPKType, which was received by PVP-Attribute, or session.getGenericDataFromSession(PVPConstants.EID_SECTOR_FOR_IDENTIFIER_NAME, String.class)
* null
if no attribute
- * exists
+ * @return bPKType, which was received by PVP-Attribute, or null
if
+ * no attribute exists
*/
@Deprecated
private String getBpkTypeFromPvpAttribute(final IAuthProcessDataContainer session) {
final String pvpBpkTypeAttr = session.getGenericDataFromSession(
- PVPAttributeDefinitions.EID_SECTOR_FOR_IDENTIFIER_NAME, String.class);
+ PvpAttributeDefinitions.EID_SECTOR_FOR_IDENTIFIER_NAME, String.class);
if (StringUtils.isNotEmpty(pvpBpkTypeAttr)) {
- // //fix a wrong bPK-Type encoding, which was used in some PVP Standardportal implementations
+ // //fix a wrong bPK-Type encoding, which was used in some PVP Standardportal
+ // implementations
// if (pvpbPKTypeAttr.startsWith(EAAFConstants.URN_PREFIX_CDID) &&
// !pvpbPKTypeAttr.substring(EAAFConstants.URN_PREFIX_CDID.length(),
// EAAFConstants.URN_PREFIX_CDID.length() + 1).equals("+")) {
- // log.warn("Receive uncorrect encoded bBKType attribute " + pvpbPKTypeAttr + " Starting
+ // log.warn("Receive uncorrect encoded bBKType attribute " + pvpbPKTypeAttr + "
+ // Starting
// attribute value correction ... ");
// pvpbPKTypeAttr = EAAFConstants.URN_PREFIX_CDID + "+" +
// pvpbPKTypeAttr.substring(EAAFConstants.URN_PREFIX_CDID.length() + 1);
//
// }
log.debug(
- "Find PVP-Attr: " + PVPAttributeDefinitions.EID_SECTOR_FOR_IDENTIFIER_FRIENDLY_NAME);
+ "Find PVP-Attr: " + PvpAttributeDefinitions.EID_SECTOR_FOR_IDENTIFIER_FRIENDLY_NAME);
return pvpBpkTypeAttr;
}
return null;
-
/*
- * INFO: This code could be used to extract the bPKType from 'PVPConstants.BPK_NAME', because
- * the prefix of BPK_NAME attribute contains the postfix of the bPKType
+ * INFO: This code could be used to extract the bPKType from
+ * 'PVPConstants.BPK_NAME', because the prefix of BPK_NAME attribute contains
+ * the postfix of the bPKType
*
- * Now, all PVP Standardportals should be able to send 'EID_SECTOR_FOR_IDENTIFIER' PVP
- * attributes
+ * Now, all PVP Standardportals should be able to send
+ * 'EID_SECTOR_FOR_IDENTIFIER' PVP attributes
*/
- // String pvpbPKValueAttr = session.getGenericDataFromSession(PVPConstants.BPK_NAME,
+ // String pvpbPKValueAttr =
+ // session.getGenericDataFromSession(PVPConstants.BPK_NAME,
// String.class);
// String[] spitted = pvpbPKValueAttr.split(":");
// if (MiscUtil.isEmpty(authData.getBPKType())) {
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java
index 60c08253..a613bd56 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java
@@ -16,8 +16,6 @@
* works that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
-
package at.gv.egiz.eaaf.core.impl.idp.auth.builder;
import java.security.InvalidKeyException;
@@ -27,22 +25,26 @@ import java.security.PrivateKey;
import java.security.PublicKey;
import java.text.SimpleDateFormat;
import java.util.Date;
+
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
-import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
-import at.gv.egiz.eaaf.core.exceptions.EaafBuilderException;
-import at.gv.egiz.eaaf.core.impl.data.Pair;
+
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Base64Utils;
+import at.gv.egiz.eaaf.core.api.data.EaafConstants;
+import at.gv.egiz.eaaf.core.exceptions.EaafBuilderException;
+import at.gv.egiz.eaaf.core.impl.data.Pair;
+
/**
* Builder for the bPK, as defined in
- * "Ableitung f¨r die bereichsspezifische Personenkennzeichnung"
version
- * 1.0.1
from "reference.e-government.gv.at"
.
+ * "Ableitung f¨r die bereichsspezifische Personenkennzeichnung"
+ * version 1.0.1
from
+ * "reference.e-government.gv.at"
.
*
*/
public class BpkBuilder {
@@ -51,58 +53,60 @@ public class BpkBuilder {
/**
* Calculates an area specific unique person-identifier from a baseID.
*
- * @param baseID baseId from user but never null
- * @param targetIdentifier target identifier for area specific identifier calculation but never
- * null
- * @return Pair consists of (unique person identifier for this target, targetArea) but never null
+ * @param baseID baseId from user but never null
+ * @param targetIdentifier target identifier for area specific identifier
+ * calculation but never null
+ * @return Pair consists of (unique person identifier for this target,
+ * targetArea) but never null
* @throws EaafBuilderException if some input data are not valid
*/
public static Pair
- * "IdentityLink"
is the translation of "Personenbindung"
.
+ * Data contained in an identity link issued by BMI, relevant to the MOA ID
+ * component.
+ * "IdentityLink"
is the translation of
+ * "Personenbindung"
.
*
* @author Paul Ivancsics
* @version $Id$
@@ -59,41 +46,44 @@ public class IdentityLink implements Serializable, IIdentityLink {
private static final long serialVersionUID = 1L;
/**
- * "identificationValue"
is the translation of "Stammzahl"
.
+ * "identificationValue"
is the translation of
+ * "Stammzahl"
.
*/
private String identificationValue;
/**
- * "identificationType"
type of the identificationValue in the IdentityLink.
+ * "identificationType"
type of the identificationValue in the
+ * IdentityLink.
*/
private String identificationType;
/**
- * first name
+ * first name.
*/
private String givenName;
/**
- * family name
+ * family name.
*/
private String familyName;
/**
- * date of birth
+ * date of birth.
*/
private String dateOfBirth;
/**
- * the original saml:Assertion-Element
+ * the original saml:Assertion-Element.
*/
private transient Element samlAssertion;
/**
- * the serializes saml:Assertion
+ * the serializes saml:Assertion.
*/
private String serializedSamlAssertion;
/**
* Element
- * /saml:Assertion/saml:AttributeStatement/saml:Subject/saml:SubjectConfirmation/saml:SubjectConfirmationData/pr:Person
+ * /saml:Assertion/saml:AttributeStatement/saml:Subject
+ * /saml:SubjectConfirmation/saml:SubjectConfirmationData/pr:Person.
*/
private transient Element prPerson = null;
/**
- * we need for each dsig:Reference Element all transformation elements
+ * we need for each dsig:Reference Element all transformation elements.
*/
private transient Element[] dsigReferenceTransforms = null;
@@ -103,14 +93,15 @@ public class IdentityLink implements Serializable, IIdentityLink {
private String issueInstant;
/**
- * we need all public keys stored in the identity link
+ * we need all public keys stored in the identity link.
*/
private PublicKey[] publicKey;
/**
- * Constructor for IdentityLink
+ * Constructor for IdentityLink.
*/
- public IdentityLink() {}
+ public IdentityLink() {
+ }
/*
* (non-Javadoc)
@@ -157,7 +148,8 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#getIdentificationValue()
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#getIdentificationValue()
*/
@Override
public String getIdentificationValue() {
@@ -177,7 +169,9 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setDateOfBirth(java.lang.String)
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setDateOfBirth(java.lang.
+ * String)
*/
@Override
public void setDateOfBirth(final String dateOfBirth) {
@@ -187,7 +181,9 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setFamilyName(java.lang.String)
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setFamilyName(java.lang.
+ * String)
*/
@Override
public void setFamilyName(final String familyName) {
@@ -197,7 +193,8 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setGivenName(java.lang.String)
+ * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setGivenName(java.lang.
+ * String)
*/
@Override
public void setGivenName(final String givenName) {
@@ -207,7 +204,9 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setIdentificationValue(java.lang.String)
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setIdentificationValue(java.
+ * lang.String)
*/
@Override
public void setIdentificationValue(final String identificationValue) {
@@ -217,7 +216,9 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setIdentificationType(java.lang.String)
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setIdentificationType(java.
+ * lang.String)
*/
@Override
public void setIdentificationType(final String identificationType) {
@@ -248,7 +249,8 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#getSerializedSamlAssertion()
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#getSerializedSamlAssertion()
*/
@Override
public String getSerializedSamlAssertion() {
@@ -258,7 +260,9 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setSamlAssertion(org.w3c.dom.Element)
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setSamlAssertion(org.w3c.dom
+ * .Element)
*/
@Override
public void setSamlAssertion(final Element samlAssertion)
@@ -270,7 +274,8 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#getDsigReferenceTransforms()
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#getDsigReferenceTransforms()
*/
@Override
public Element[] getDsigReferenceTransforms() {
@@ -287,8 +292,8 @@ public class IdentityLink implements Serializable, IIdentityLink {
* (non-Javadoc)
*
* @see
- * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setDsigReferenceTransforms(org.w3c.dom.Element
- * [])
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setDsigReferenceTransforms(
+ * org.w3c.dom.Element [])
*/
@Override
public void setDsigReferenceTransforms(final Element[] dsigReferenceTransforms) {
@@ -317,7 +322,9 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setPublicKey(java.security.PublicKey[])
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setPublicKey(java.security.
+ * PublicKey[])
*/
@Override
public void setPublicKey(final PublicKey[] publicKey) {
@@ -346,7 +353,9 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setPrPerson(org.w3c.dom.Element)
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setPrPerson(org.w3c.dom.
+ * Element)
*/
@Override
public void setPrPerson(final Element prPerson) {
@@ -366,7 +375,9 @@ public class IdentityLink implements Serializable, IIdentityLink {
/*
* (non-Javadoc)
*
- * @see at.gv.egovernment.moa.id.auth.data.IIdentityLink#setIssueInstant(java.lang.String)
+ * @see
+ * at.gv.egovernment.moa.id.auth.data.IIdentityLink#setIssueInstant(java.lang.
+ * String)
*/
@Override
public void setIssueInstant(final String issueInstant) {
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/SimpleIdentityLinkAssertionParser.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/SimpleIdentityLinkAssertionParser.java
index 220469d3..acb877c2 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/SimpleIdentityLinkAssertionParser.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/SimpleIdentityLinkAssertionParser.java
@@ -1,22 +1,5 @@
-/*******************************************************************************
- * Copyright 2014 Federal Chancellery Austria MOA-ID has been developed in a cooperation between
- * BRZ, the Federal Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by the European
- * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in
- * compliance with the Licence. You may obtain a copy of the Licence at: http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the Licence
- * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the Licence for the specific language governing permissions and limitations under
- * the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text file for details on the
- * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
- * works that you distribute must include a readable copy of the "NOTICE" text file.
- ******************************************************************************/
/*
- * Copyright 2003 Federal Chancellery Austria MOA-ID has been developed in a cooperation between
+ * Copyright 2014 Federal Chancellery Austria MOA-ID has been developed in a cooperation between
* BRZ, the Federal Chancellery Austria - ICT staff unit, and Graz University of Technology.
*
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved by the European
@@ -31,7 +14,7 @@
* This product combines work with different licenses. See the "NOTICE" text file for details on the
* various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative
* works that you distribute must include a readable copy of the "NOTICE" text file.
- */
+*/
package at.gv.egiz.eaaf.core.impl.idp.auth.data;
@@ -40,17 +23,19 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
-import at.gv.egiz.eaaf.core.api.data.XMLNamespaceConstants;
+
+import org.springframework.util.Base64Utils;
+import org.w3c.dom.Element;
+import org.w3c.dom.traversal.NodeIterator;
+
+import at.gv.egiz.eaaf.core.api.data.XmlNamespaceConstants;
import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;
import at.gv.egiz.eaaf.core.exceptions.EaafParserException;
import at.gv.egiz.eaaf.core.impl.utils.DomUtils;
import at.gv.egiz.eaaf.core.impl.utils.XPathUtils;
-import org.springframework.util.Base64Utils;
-import org.w3c.dom.Element;
-import org.w3c.dom.traversal.NodeIterator;
/**
- * Parses MDS from an identity link <saml:Assertion>
+ * Parses MDS from an identity link. <saml:Assertion>
* This IDL parser extract NO key information!
*
*/
@@ -60,56 +45,59 @@ public class SimpleIdentityLinkAssertionParser {
// XPath namespace prefix shortcuts
//
- /** Xpath prefix for reaching PersonData Namespaces */
- private static final String PDATA = XMLNamespaceConstants.PD_PREFIX + ":";
- /** Xpath prefix for reaching SAML Namespaces */
- private static final String SAML = XMLNamespaceConstants.SAML_PREFIX + ":";
- /** Xpath prefix for reaching XML-DSIG Namespaces */
- private static final String DSIG = XMLNamespaceConstants.DSIG_PREFIX + ":";
- /** Xpath expression to the root element */
+ /** Xpath prefix for reaching PersonData Namespaces. */
+ private static final String PDATA = XmlNamespaceConstants.PD_PREFIX + ":";
+ /** Xpath prefix for reaching SAML Namespaces. */
+ private static final String SAML = XmlNamespaceConstants.SAML_PREFIX + ":";
+ /** Xpath prefix for reaching XML-DSIG Namespaces. */
+ private static final String DSIG = XmlNamespaceConstants.DSIG_PREFIX + ":";
+ /** Xpath expression to the root element. */
private static final String ROOT = "";
- /** Xpath expression to the SAMLSubjectConfirmationData element */
+ /** Xpath expression to the SAMLSubjectConfirmationData element. */
private static final String SAML_SUBJECT_CONFIRMATION_DATA_XPATH =
ROOT + SAML + "AttributeStatement/" + SAML + "Subject/" + SAML + "SubjectConfirmation/" + SAML
+ "SubjectConfirmationData";
- /** Xpath expression to the PersonData element */
+ /** Xpath expression to the PersonData element. */
public static final String PERSON_XPATH =
SAML_SUBJECT_CONFIRMATION_DATA_XPATH + "/" + PDATA + "Person";
- /** Xpath expression to the PersonData GivenName element */
+ /** Xpath expression to the PersonData GivenName element. */
public static final String PERSON_GIVEN_NAME_XPATH =
PERSON_XPATH + "/" + PDATA + "Name/" + PDATA + "GivenName";
- /** Xpath expression to the PersonData FamilyName element */
+ /** Xpath expression to the PersonData FamilyName element. */
public static final String PERSON_FAMILY_NAME_XPATH =
PERSON_XPATH + "/" + PDATA + "Name/" + PDATA + "FamilyName";
- /** Xpath expression to the PersonData DateOfBirth element */
+ /** Xpath expression to the PersonData DateOfBirth element. */
public static final String PERSON_DATE_OF_BIRTH_XPATH =
PERSON_XPATH + "/" + PDATA + "DateOfBirth";
- /** Xpath expression to the Identification Value element */
+ /** Xpath expression to the Identification Value element. */
public static final String PERSON_IDENT_VALUE_XPATH =
PERSON_XPATH + "/" + PDATA + "Identification/" + PDATA + "Value";
- /** Xpath expression to the Identification Value element */
+ /** Xpath expression to the Identification Value element. */
public static final String PERSON_IDENT_TYPE_XPATH =
PERSON_XPATH + "/" + PDATA + "Identification/" + PDATA + "Type";
- /** Xpath expression to the DSIG X509Certificate element */
+ /** Xpath expression to the DSIG X509Certificate element. */
private static final String DSIG_CERTIFICATES_XPATH = ROOT + DSIG + "Signature/" + DSIG
+ "KeyInfo/" + DSIG + "X509Data/" + DSIG + "X509Certificate";
- /** Xpath expression to the DSIG Transforms element */
+ /** Xpath expression to the DSIG Transforms element. */
private static final String DSIG_REFERENCE_TRANSFORMATION_XPATH =
ROOT + DSIG + "Signature/" + DSIG + "SignedInfo/" + DSIG + "Reference/" + DSIG + "Transforms";
- /** The IssueInstant attribute of the SAML assertion */
+ /** The IssueInstant attribute of the SAML assertion. */
private static final String ISSUE_INSTANT_ATTR = "IssueInstant";
public static final String ASSERTIONID = "AssertionID";
- /** This is the root element of the XML-Document provided by the Security Layer Card */
+ /**
+ * This is the root element of the XML-Document provided by the Security Layer
+ * Card.
+ */
private Element assertionElem;
/**
- * Constructor for IdentityLinkAssertionParser
. A DOM-representation of the incoming
- * String will be created
+ * Constructor for IdentityLinkAssertionParser
. A
+ * DOM-representation of the incoming String will be created
*
* @param xmlAssertion <saml:Assertion>
as String
* @throws EaafParserException on any parsing error
@@ -120,7 +108,7 @@ public class SimpleIdentityLinkAssertionParser {
assertionElem = DomUtils.parseXmlValidating(s);
} catch (final Throwable t) {
- throw new EaafParserException("parser.01", new Object[] {t.toString()}, t);
+ throw new EaafParserException("parser.01", new Object[] { t.toString() }, t);
}
}
@@ -136,8 +124,8 @@ public class SimpleIdentityLinkAssertionParser {
}
/**
- * Constructor for IdentityLinkAssertionParser
. A DOM-representation of the incoming
- * Inputstream will be created
+ * Constructor for IdentityLinkAssertionParser
. A
+ * DOM-representation of the incoming Inputstream will be created
*
* @param xmlAssertion <saml:Assertion>
as InputStream
* @throws EaafParserException on any parsing error
@@ -148,13 +136,13 @@ public class SimpleIdentityLinkAssertionParser {
assertionElem = DomUtils.parseXmlValidating(xmlAssertion);
} catch (final Throwable t) {
- throw new EaafParserException("parser.01", new Object[] {t.toString()}, t);
+ throw new EaafParserException("parser.01", new Object[] { t.toString() }, t);
}
}
/**
- * Parses the identity link from the <saml:Assertion>
+ * Parses the identity link from the <saml:Assertion>
.
*
* @return Identity link
* @throws EaafParserException on any parsing error
@@ -199,7 +187,7 @@ public class SimpleIdentityLinkAssertionParser {
// identityLink.setPublicKey(getPublicKeys());
} catch (final Throwable t) {
- throw new EaafParserException("parser.01", new Object[] {t.toString()}, t);
+ throw new EaafParserException("parser.01", new Object[] { t.toString() }, t);
}
return identityLink;
@@ -207,10 +195,10 @@ public class SimpleIdentityLinkAssertionParser {
/**
* Parses a string array of decoded base64 certificates from the
- * <InfoboxReadResponse>
found in the dsig-signature
+ * <InfoboxReadResponse>
found in the dsig-signature.
*
* @return String[] with raw-certificates from the dsig-signature keyinfo
- * @throws Exception
+ * @throws Exception In case of an error
*/
public String[] getCertificates() throws Exception {
final List certs = new ArrayList();
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java
index c785e1cb..3d093a9f 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/AbstractAuthServletTask.java
@@ -27,11 +27,24 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.commons.lang3.ArrayUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ResourceLoader;
+
import at.gv.egiz.eaaf.core.api.IRequest;
import at.gv.egiz.eaaf.core.api.IRequestStorage;
-import at.gv.egiz.eaaf.core.api.data.EAAFConstants;
+import at.gv.egiz.eaaf.core.api.data.EaafConstants;
import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
@@ -41,20 +54,10 @@ import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
import at.gv.egiz.eaaf.core.impl.idp.controller.ProtocolFinalizationController;
import at.gv.egiz.eaaf.core.impl.idp.process.springweb.AbstractTask;
import at.gv.egiz.eaaf.core.impl.utils.DataUrlBuilder;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileItemFactory;
-import org.apache.commons.fileupload.FileUploadException;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.apache.commons.lang3.ArrayUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.ResourceLoader;
/**
- * Task based counterpart to {@link AuthServlet}, providing the same utility methods (error
- * handling, parameter parsing etc.).
+ * Task based counterpart to {@link AuthServlet}, providing the same utility
+ * methods (error handling, parameter parsing etc.).
*
- *This handler start a protocol-specific error handling. - *
+ *+ * This handler start a protocol-specific error handling. + *
* - * @param req http request + * @param req http request * @param resp http response - * @param e exception + * @param e exception * @throws IOException in case of an exception handling error */ - @ExceptionHandler({EaafException.class}) + @ExceptionHandler({ EaafException.class }) public void eaafExceptionHandler(final HttpServletRequest req, final HttpServletResponse resp, final Exception e) throws IOException { try { @@ -102,15 +104,15 @@ public abstract class AbstractController { * This handler wrote an internal server error into http response * * - * @param resp http response + * @param resp http response * @param exception exception * @throws IOException In case of an internal error. */ - @ExceptionHandler({Exception.class}) + @ExceptionHandler({ Exception.class }) public void genericExceptionHandler(final HttpServletResponse resp, final Exception exception) throws IOException { log.error("Internel Server Error.", exception); - resp.setContentType(EAAFConstants.CONTENTTYPE_HTML_UTF8); + resp.setContentType(EaafConstants.CONTENTTYPE_HTML_UTF8); resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal Server Error!" + "(Errorcode=9199" + " | Description=" + StringEscapeUtils.escapeHtml4(StringEscapeUtils.escapeEcmaScript(exception.getMessage())) @@ -125,13 +127,13 @@ public abstract class AbstractController { * This handler wrote an internal server error into http response * * - * @param resp http response + * @param resp http response * @param exception exception */ - @ExceptionHandler({IOException.class}) + @ExceptionHandler({ IOException.class }) public void ioExceptionHandler(final HttpServletResponse resp, final Throwable exception) { log.error("Internel Server Error.", exception); - resp.setContentType(EAAFConstants.CONTENTTYPE_HTML_UTF8); + resp.setContentType(EaafConstants.CONTENTTYPE_HTML_UTF8); resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } @@ -144,7 +146,8 @@ public abstract class AbstractController { final Throwable extractedException = extractOriginalExceptionFromProcessException(exceptionThrown); - // extract pendingRequestID and originalException if it was a TaskExecutionException + // extract pendingRequestID and originalException if it was a + // TaskExecutionException if (extractedException instanceof TaskExecutionException) { // set original exception loggedException = ((TaskExecutionException) extractedException).getOriginalException(); @@ -164,14 +167,14 @@ public abstract class AbstractController { } try { - // switch to protocol-finalize method to generate a protocol-specific error message + // switch to protocol-finalize method to generate a protocol-specific error + // message // log error directly in debug mode if (log.isDebugEnabled()) { log.warn(loggedException.getMessage(), loggedException); } - // put exception into transaction store for redirect final String key = Random.nextLongRandom(); if (pendingReq != null) { @@ -187,7 +190,7 @@ public abstract class AbstractController { String redirectUrl = null; redirectUrl = ServletUtils.getBaseUrl(req); redirectUrl += "/" + ProtocolFinalizationController.ENDPOINT_ERRORHANDLING + "?" - + EAAFConstants.PARAM_HTTP_ERROR_CODE + "=" + key; + + EaafConstants.PARAM_HTTP_ERROR_CODE + "=" + key; resp.setContentType("text/html"); resp.setStatus(302); @@ -206,14 +209,12 @@ public abstract class AbstractController { } - - /** * Extracts a TaskExecutionException of a ProcessExecutionExeception Stacktrace. * * @param exception error - * @return Return the latest TaskExecutionExecption if exists, otherwise the latest - * ProcessExecutionException + * @return Return the latest TaskExecutionExecption if exists, otherwise the + * latest ProcessExecutionException */ private Throwable extractOriginalExceptionFromProcessException(final Throwable exception) { Throwable exholder = exception; @@ -238,6 +239,4 @@ public abstract class AbstractController { } } - - } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java index 9ff468d3..098bca4c 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractProcessEngineSignalController.java @@ -20,20 +20,23 @@ package at.gv.egiz.eaaf.core.impl.idp.controller; import java.io.IOException; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.text.StringEscapeUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.IRequestStorage; import at.gv.egiz.eaaf.core.api.IStatusMessenger; -import at.gv.egiz.eaaf.core.api.data.EAAFConstants; +import at.gv.egiz.eaaf.core.api.data.EaafConstants; import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine; import at.gv.egiz.eaaf.core.exceptions.EaafException; import at.gv.egiz.eaaf.core.exceptions.EaafIllegalStateException; import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils; -import org.apache.commons.text.StringEscapeUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; /** * Servlet that resumes a suspended process (in case of asynchronous tasks). @@ -65,7 +68,7 @@ public abstract class AbstractProcessEngineSignalController extends AbstractCont log.info("No PendingRequest with Id: " + pendingRequestID + " Maybe, a transaction timeout occure."); throw new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_TIMEOUT, - new Object[] {pendingRequestID}); + new Object[] { pendingRequestID }); } @@ -75,7 +78,7 @@ public abstract class AbstractProcessEngineSignalController extends AbstractCont // process instance is mandatory if (pendingReq.getProcessInstanceId() == null) { throw new EaafIllegalStateException( - new Object[] {"MOA session does not provide process instance id."}); + new Object[] { "MOA session does not provide process instance id." }); } @@ -91,22 +94,22 @@ public abstract class AbstractProcessEngineSignalController extends AbstractCont } - } /** - * Retrieves the current pending-request id from the HttpServletRequest parameter + * Retrieves the current pending-request id from the HttpServletRequest + * parameter * * - * Note that this class/method can be overwritten by modules providing their own strategy of - * retrieving the respective pending-request id. + * Note that this class/method can be overwritten by modules providing their own + * strategy of retrieving the respective pending-request id. * * @param request The unterlying HttpServletRequest. * @return The current pending-request id. */ public String getPendingRequestId(final HttpServletRequest request) { return StringEscapeUtils - .escapeHtml4(request.getParameter(EAAFConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID)); + .escapeHtml4(request.getParameter(EaafConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID)); } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java index 7b350c3b..51a8aefd 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/ProtocolFinalizationController.java @@ -20,15 +20,10 @@ package at.gv.egiz.eaaf.core.impl.idp.controller; import java.io.IOException; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import at.gv.egiz.components.eventlog.api.EventConstants; -import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.IRequestStorage; -import at.gv.egiz.eaaf.core.api.IStatusMessenger; -import at.gv.egiz.eaaf.core.api.data.EAAFConstants; -import at.gv.egiz.eaaf.core.api.data.ExceptionContainer; -import at.gv.egiz.eaaf.core.exceptions.EaafException; + import org.apache.commons.text.StringEscapeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,6 +32,14 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import at.gv.egiz.components.eventlog.api.EventConstants; +import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.IRequestStorage; +import at.gv.egiz.eaaf.core.api.IStatusMessenger; +import at.gv.egiz.eaaf.core.api.data.EaafConstants; +import at.gv.egiz.eaaf.core.api.data.ExceptionContainer; +import at.gv.egiz.eaaf.core.exceptions.EaafException; + /** * Protocol finialization end-point. * @@ -55,17 +58,17 @@ public class ProtocolFinalizationController extends AbstractController { /** * End-Point to handle errors. * - * @param req http request + * @param req http request * @param resp http response * @throws EaafException In case of an internal error - * @throws IOException In case of a servlet error + * @throws IOException In case of a servlet error */ - @RequestMapping(value = ENDPOINT_ERRORHANDLING, method = {RequestMethod.GET}) + @RequestMapping(value = ENDPOINT_ERRORHANDLING, method = { RequestMethod.GET }) public void errorHandling(final HttpServletRequest req, final HttpServletResponse resp) throws EaafException, IOException { // receive an authentication error final String errorid = - StringEscapeUtils.escapeHtml4(req.getParameter(EAAFConstants.PARAM_HTTP_ERROR_CODE)); + StringEscapeUtils.escapeHtml4(req.getParameter(EaafConstants.PARAM_HTTP_ERROR_CODE)); if (errorid != null) { IRequest pendingReq = null; try { @@ -127,25 +130,25 @@ public class ProtocolFinalizationController extends AbstractController { /** * End-Point to finalize authentication protocol. * - * @param req http request + * @param req http request * @param resp http response * @throws EaafException In case of an internal error - * @throws IOException In case of a servlet error + * @throws IOException In case of a servlet error */ - @RequestMapping(value = ENDPOINT_FINALIZEPROTOCOL, method = {RequestMethod.GET}) + @RequestMapping(value = ENDPOINT_FINALIZEPROTOCOL, method = { RequestMethod.GET }) public void finalizeAuthProtocol(final HttpServletRequest req, final HttpServletResponse resp) throws EaafException, IOException { // read pendingRequest from http request final String pendingRequestID = StringEscapeUtils - .escapeHtml4(req.getParameter(EAAFConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID)); + .escapeHtml4(req.getParameter(EaafConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID)); final IRequest pendingReq = requestStorage.getPendingRequest(pendingRequestID); if (pendingReq == null) { log.error("No PendingRequest with ID " + pendingRequestID + " found.!"); protAuthService.handleErrorNoRedirect( new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_TIMEOUT, - new Object[] {pendingRequestID,}), + new Object[] { pendingRequestID, }), req, resp, false); } else { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java index 88dae874..07fc652a 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java @@ -28,13 +28,22 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.UUID; + import javax.annotation.Nonnull; import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; +import org.springframework.util.Assert; + import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.data.EAAFConstants; +import at.gv.egiz.eaaf.core.api.data.EaafConstants; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP; -import at.gv.egiz.eaaf.core.api.idp.IspConfiguration; +import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration; import at.gv.egiz.eaaf.core.exceptions.EaafAuthenticationException; import at.gv.egiz.eaaf.core.exceptions.EaafException; import at.gv.egiz.eaaf.core.exceptions.EaafStorageException; @@ -42,12 +51,6 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper; import at.gv.egiz.eaaf.core.impl.utils.HttpUtils; import at.gv.egiz.eaaf.core.impl.utils.Random; import at.gv.egiz.eaaf.core.impl.utils.TransactionIdUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; -import org.springframework.util.Assert; public abstract class RequestImpl implements IRequest, Serializable { @@ -70,7 +73,7 @@ public abstract class RequestImpl implements IRequest, Serializable { private String requestedServiceProviderIdentifer; private String idpAuthUrl = null; - private IspConfiguration spConfiguration = null; + private ISpConfiguration spConfiguration = null; private boolean passiv = false; private boolean force = false; @@ -89,11 +92,10 @@ public abstract class RequestImpl implements IRequest, Serializable { private final Map- * This method sets the pending-request object of the task implementation and starts the - * {@code execute} method of the task + * This method sets the pending-request object of the task implementation and + * starts the {@code execute} method of the task *
* - * @param pendingReq The pending-request object (never {@code null}). + * @param pendingReq The pending-request object (never {@code null}). * @param executionContext The execution context (never {@code null}). - * @param request The HttpServletRequest (never {@code null}). - * @param response The HttpServletResponse (never {@code null}). - * @return The pending-request object, because Process-management works recursive + * @param request The HttpServletRequest (never {@code null}). + * @param response The HttpServletResponse (never {@code null}). + * @return The pending-request object, because Process-management works + * recursive * - * @throws IllegalStateException Thrown in case the task is being run within the required - * environment. Refer to javadoc for further information. - * @throws Exception Thrown in case of error executing the task. + * @throws IllegalStateException Thrown in case the task is being run within the + * required environment. Refer to javadoc for + * further information. + * @throws Exception Thrown in case of error executing the task. */ protected abstract IRequest internalExecute(IRequest pendingReq, ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException; - - } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/SpringWebExpressionEvaluator.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/SpringWebExpressionEvaluator.java index c723a728..afcc0a58 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/SpringWebExpressionEvaluator.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/SpringWebExpressionEvaluator.java @@ -22,12 +22,10 @@ package at.gv.egiz.eaaf.core.impl.idp.process.springweb; import java.io.Serializable; import java.util.Map; import java.util.Objects; + import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext; -import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator; -import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; + import org.apache.commons.lang3.BooleanUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,13 +37,21 @@ import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.support.StandardEvaluationContext; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext; +import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator; +import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; + /** - * Expression evaluator for processing {@link Transition} conditions allowing to. + * Expression evaluator for processing {@link Transition} conditions allowing + * to. *- * The parsing methods in this class make use of some features internal to the Xerces DOM parser, - * mainly for performance reasons. As soon as JAXP (currently at version 1.2) is better at schema - * handling, it should be used as the parser interface. - *
+ *+ * The parsing methods in this class make use of some features internal to the + * Xerces DOM parser, mainly for performance reasons. As soon as JAXP (currently + * at version 1.2) is better at schema handling, it should be used as the parser + * interface. + *
* */ public class DomUtils { @@ -103,7 +105,8 @@ public class DomUtils { private static final String EXTERNAL_SCHEMA_LOCATION_PROPERTY = "http://apache.org/xml/properties/schema/external-schemaLocation"; /** - * Property URI for providing the external schema location for elements without a namespace. + * Property URI for providing the external schema location for elements without + * a namespace. */ private static final String EXTERNAL_NO_NAMESPACE_SCHEMA_LOCATION_PROPERTY = "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"; @@ -117,8 +120,6 @@ public class DomUtils { public static final String DISALLOW_DOCTYPE_FEATURE = "http://apache.org/xml/features/disallow-doctype-decl"; - - /** Property URI for the Xerces grammar pool. */ private static final String GRAMMAR_POOL = org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY; @@ -129,8 +130,8 @@ public class DomUtils { /** Xerces schema grammar pool. */ private static XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); /** - * Set holding the NamespaceURIs of the grammarPool, to prevent multiple entries of same grammars - * to the pool. + * Set holding the NamespaceURIs of the grammarPool, to prevent multiple entries + * of same grammars to the pool. */ private static Set grammarNamespaces; @@ -140,12 +141,13 @@ public class DomUtils { } /** - * Preparse a schema and add it to the schema pool. The method only adds the schema to the pool if - * a schema having the samesystemId
(namespace URI) is not already present in the
- * pool.
+ * Preparse a schema and add it to the schema pool. The method only adds the
+ * schema to the pool if a schema having the same systemId
+ * (namespace URI) is not already present in the pool.
*
- * @param inputStream An InputStream
providing the contents of the schema.
- * @param systemId The systemId (namespace URI) to use for the schema.
+ * @param inputStream An InputStream
providing the contents of the
+ * schema.
+ * @param systemId The systemId (namespace URI) to use for the schema.
* @throws IOException An error occurred reading the schema.
*/
public static void addSchemaToPool(final InputStream inputStream, final String systemId)
@@ -178,24 +180,32 @@ public class DomUtils {
/**
* Parse an XML document from an InputStream
.
*
- *
- * It uses a MOAEntityResolver
as the EntityResolver
and a
- * MOAErrorHandler
as the ErrorHandler
.
- *
+ * It uses a MOAEntityResolver
as the EntityResolver
+ * and a MOAErrorHandler
as the ErrorHandler
.
+ *
InputStream
containing the XML document.
- * @param validating If true
, parse validating.
- * @param externalSchemaLocations A String
containing namespace URI to schema
- * location pairs, the same way it is accepted by the xsi:
- * schemaLocation
attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without
- * a namespace, the same way it is accepted by the
- * xsi:noNamespaceSchemaLocation
attribute.
- * @param parserFeatures Map of features that should be set into XML parser
+ * @param inputStream The InputStream
+ * containing the XML document.
+ * @param validating If true
, parse
+ * validating.
+ * @param externalSchemaLocations A String
containing
+ * namespace URI to schema location
+ * pairs, the same way it is accepted
+ * by the xsi:
+ * schemaLocation
attribute.
+ * @param externalNoNamespaceSchemaLocation The schema location of the schema
+ * for elements without a namespace,
+ * the same way it is accepted by the
+ * xsi:noNamespaceSchemaLocation
+ * attribute.
+ * @param parserFeatures Map of features that should be set
+ * into XML parser
* @return The parsed XML document as a DOM tree.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document.
- * @throws ParserConfigurationException An error occurred configuring the XML parser.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document.
+ * @throws ParserConfigurationException An error occurred configuring the XML
+ * parser.
*/
public static Document parseDocument(final InputStream inputStream, final boolean validating,
final String externalSchemaLocations, final String externalNoNamespaceSchemaLocation,
@@ -209,24 +219,31 @@ public class DomUtils {
/**
* Parse an XML document from a String
.
*
- *
- * It uses a MOAEntityResolver
as the EntityResolver
and a
- * MOAErrorHandler
as the ErrorHandler
.
- *
+ * It uses a MOAEntityResolver
as the EntityResolver
+ * and a MOAErrorHandler
as the ErrorHandler
.
+ *
String
containing the XML document.
- * @param encoding The encoding of the XML document.
- * @param validating If true
, parse validating.
- * @param externalSchemaLocations A String
containing namespace URI to schema
- * location pairs, the same way it is accepted by the xsi:
- * schemaLocation
attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without
- * a namespace, the same way it is accepted by the
- * xsi:noNamespaceSchemaLocation
attribute.
+ * @param xmlString The String
containing
+ * the XML document.
+ * @param encoding The encoding of the XML document.
+ * @param validating If true
, parse
+ * validating.
+ * @param externalSchemaLocations A String
containing
+ * namespace URI to schema location
+ * pairs, the same way it is accepted
+ * by the xsi:
+ * schemaLocation
attribute.
+ * @param externalNoNamespaceSchemaLocation The schema location of the schema
+ * for elements without a namespace,
+ * the same way it is accepted by the
+ * xsi:noNamespaceSchemaLocation
+ * attribute.
* @return The parsed XML document as a DOM tree.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document.
- * @throws ParserConfigurationException An error occurred configuring the XML parser.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document.
+ * @throws ParserConfigurationException An error occurred configuring the XML
+ * parser.
*/
public static Document parseDocument(final String xmlString, final String encoding,
final boolean validating, final String externalSchemaLocations,
@@ -241,24 +258,31 @@ public class DomUtils {
/**
* Parse an XML document from a String
.
*
- *
- * It uses a MOAEntityResolver
as the EntityResolver
and a
- * MOAErrorHandler
as the ErrorHandler
.
- *
+ * It uses a MOAEntityResolver
as the EntityResolver
+ * and a MOAErrorHandler
as the ErrorHandler
.
+ *
String
containing the XML document.
- * @param encoding The encoding of the XML document.
- * @param validating If true
, parse validating.
- * @param externalSchemaLocations A String
containing namespace URI to schema
- * location pairs, the same way it is accepted by the xsi:
- * schemaLocation
attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without
- * a namespace, the same way it is accepted by the
- * xsi:noNamespaceSchemaLocation
attribute.
+ * @param xmlString The String
containing
+ * the XML document.
+ * @param encoding The encoding of the XML document.
+ * @param validating If true
, parse
+ * validating.
+ * @param externalSchemaLocations A String
containing
+ * namespace URI to schema location
+ * pairs, the same way it is accepted
+ * by the xsi:
+ * schemaLocation
attribute.
+ * @param externalNoNamespaceSchemaLocation The schema location of the schema
+ * for elements without a namespace,
+ * the same way it is accepted by the
+ * xsi:noNamespaceSchemaLocation
+ * attribute.
* @return The parsed XML document as a DOM tree.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document.
- * @throws ParserConfigurationException An error occurred configuring the XML parser.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document.
+ * @throws ParserConfigurationException An error occurred configuring the XML
+ * parser.
*/
public static Document parseDocument(final String xmlString, final String encoding,
final boolean validating, final String externalSchemaLocations,
@@ -273,18 +297,25 @@ public class DomUtils {
/**
* Parse an UTF-8 encoded XML document from a String
.
*
- * @param xmlString The String
containing the XML document.
- * @param validating If true
, parse validating.
- * @param externalSchemaLocations A String
containing namespace URI to schema
- * location pairs, the same way it is accepted by the xsi:
- * schemaLocation
attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without
- * a namespace, the same way it is accepted by the
- * xsi:noNamespaceSchemaLocation
attribute.
+ * @param xmlString The String
containing
+ * the XML document.
+ * @param validating If true
, parse
+ * validating.
+ * @param externalSchemaLocations A String
containing
+ * namespace URI to schema location
+ * pairs, the same way it is accepted
+ * by the xsi:
+ * schemaLocation
attribute.
+ * @param externalNoNamespaceSchemaLocation The schema location of the schema
+ * for elements without a namespace,
+ * the same way it is accepted by the
+ * xsi:noNamespaceSchemaLocation
+ * attribute.
* @return The parsed XML document as a DOM tree.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document.
- * @throws ParserConfigurationException An error occurred configuring the XML parser.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document.
+ * @throws ParserConfigurationException An error occurred configuring the XML
+ * parser.
*/
public static Document parseDocument(final String xmlString, final boolean validating,
final String externalSchemaLocations, final String externalNoNamespaceSchemaLocation)
@@ -297,22 +328,33 @@ public class DomUtils {
/**
* Parse an XML document from an InputStream
.
*
- * @param inputStream The InputStream
containing the XML document.
- * @param validating If true
, parse validating.
- * @param externalSchemaLocations A String
containing namespace URI to schema
- * location pairs, the same way it is accepted by the xsi:
- * schemaLocation
attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without
- * a namespace, the same way it is accepted by the
- * xsi:noNamespaceSchemaLocation
attribute.
- * @param entityResolver An EntityResolver
to resolve external entities (schemas and
- * DTDs). If null
, it will not be set.
- * @param errorHandler An ErrorHandler
to decide what to do with parsing errors. If
- * null
, it will not be set.
+ * @param inputStream The InputStream
+ * containing the XML document.
+ * @param validating If true
, parse
+ * validating.
+ * @param externalSchemaLocations A String
containing
+ * namespace URI to schema location
+ * pairs, the same way it is accepted
+ * by the xsi:
+ * schemaLocation
attribute.
+ * @param externalNoNamespaceSchemaLocation The schema location of the schema
+ * for elements without a namespace,
+ * the same way it is accepted by the
+ * xsi:noNamespaceSchemaLocation
+ * attribute.
+ * @param entityResolver An EntityResolver
to
+ * resolve external entities (schemas
+ * and DTDs). If null
, it
+ * will not be set.
+ * @param errorHandler An ErrorHandler
to
+ * decide what to do with parsing
+ * errors. If null
, it
+ * will not be set.
* @return The parsed XML document as a DOM tree.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document.
- * @throws ParserConfigurationException An error occurred configuring the XML parser.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document.
+ * @throws ParserConfigurationException An error occurred configuring the XML
+ * parser.
*/
public static Document parseDocument(final InputStream inputStream, final boolean validating,
final String externalSchemaLocations, final String externalNoNamespaceSchemaLocation,
@@ -330,8 +372,8 @@ public class DomUtils {
// }
// }
-
- // if Debug is enabled make a copy of inputStream to enable debug output in case of SAXException
+ // if Debug is enabled make a copy of inputStream to enable debug output in case
+ // of SAXException
byte[] buffer = null;
ByteArrayInputStream baStream = null;
if (true == log.isDebugEnabled()) {
@@ -340,8 +382,6 @@ public class DomUtils {
}
-
-
// create the DOM parser
if (symbolTable != null) {
parser = new DOMParser(symbolTable, grammarPool);
@@ -379,8 +419,8 @@ public class DomUtils {
}
// fix XXE problem
- // parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
-
+ // parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl",
+ // true);
if (validating) {
if (externalSchemaLocations != null) {
@@ -423,9 +463,9 @@ public class DomUtils {
*
* @param inputStream data to parse
* @return Element
- * @throws SAXException In case of an error
- * @throws IOException In case of an error
- * @throws ParserConfigurationException In case of an error
+ * @throws SAXException In case of an error
+ * @throws IOException In case of an error
+ * @throws ParserConfigurationException In case of an error
*/
public static Document parseDocumentSimple(final InputStream inputStream)
throws SAXException, IOException, ParserConfigurationException {
@@ -446,62 +486,56 @@ public class DomUtils {
return parser.getDocument();
}
-
-
-
-
-
-
-
-
-
-
/**
* A convenience method to parse an XML document validating.
*
* @param inputStream The InputStream
containing the XML document.
* @return The root element of the parsed XML document.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document.
- * @throws ParserConfigurationException An error occurred configuring the XML parser.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document.
+ * @throws ParserConfigurationException An error occurred configuring the XML
+ * parser.
*/
public static Element parseXmlValidating(final InputStream inputStream)
throws ParserConfigurationException, SAXException, IOException {
return DomUtils
- .parseDocument(inputStream, true, XMLNamespaceConstants.ALL_SCHEMA_LOCATIONS, null, null)
+ .parseDocument(inputStream, true, XmlNamespaceConstants.ALL_SCHEMA_LOCATIONS, null, null)
.getDocumentElement();
}
/**
* A convenience method to parse an XML document validating.
*
- * @param inputStream The InputStream
containing the XML document.
+ * @param inputStream The InputStream
containing the XML
+ * document.
* @param parserFeatures Set additional features to XML parser
* @return The root element of the parsed XML document.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document.
- * @throws ParserConfigurationException An error occurred configuring the XML parser.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document.
+ * @throws ParserConfigurationException An error occurred configuring the XML
+ * parser.
*/
public static Element parseXmlValidating(final InputStream inputStream,
final MapInputStream
containing the XML document.
* @return The root element of the parsed XML document.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document.
- * @throws ParserConfigurationException An error occurred configuring the XML parser.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document.
+ * @throws ParserConfigurationException An error occurred configuring the XML
+ * parser.
*/
public static Element parseXmlNonValidating(final InputStream inputStream)
throws ParserConfigurationException, SAXException, IOException {
- return DomUtils.parseDocument(inputStream, false, XMLNamespaceConstants.ALL_SCHEMA_LOCATIONS,
+ return DomUtils.parseDocument(inputStream, false, XmlNamespaceConstants.ALL_SCHEMA_LOCATIONS,
null, Collections.unmodifiableMap(new HashMapString
containing namespace URI to schema
- * location pairs, the same way it is accepted by the xsi:
- * schemaLocation
attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without
- * a namespace, the same way it is accepted by the
- * xsi:noNamespaceSchemaLocation
attribute.
- * @return true
, if the element
validates against the schemas declared
- * in it.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document from its serialized representation.
+ * @param element The element to validate.
+ * @param externalSchemaLocations A String
containing
+ * namespace URI to schema location
+ * pairs, the same way it is accepted
+ * by the xsi:
+ * schemaLocation
attribute.
+ * @param externalNoNamespaceSchemaLocation The schema location of the schema
+ * for elements without a namespace,
+ * the same way it is accepted by the
+ * xsi:noNamespaceSchemaLocation
+ * attribute.
+ * @return true
, if the element
validates against the
+ * schemas declared in it.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document
+ * from its serialized representation.
* @throws ParserConfigurationException An error occurred configuring the XML
- * @throws TransformerException An error occurred serializing the element.
+ * @throws TransformerException An error occurred serializing the
+ * element.
*/
public static boolean validateElement(final Element element, final String externalSchemaLocations,
final String externalNoNamespaceSchemaLocation)
@@ -552,7 +592,6 @@ public class DomUtils {
parser.setFeature(EXTERNAL_GENERAL_ENTITIES_FEATURE, false);
parser.setFeature(DISALLOW_DOCTYPE_FEATURE, true);
-
if (externalSchemaLocations != null) {
parser.setProperty(EXTERNAL_SCHEMA_LOCATION_PROPERTY, externalSchemaLocations);
}
@@ -569,23 +608,28 @@ public class DomUtils {
return true;
}
-
/**
* Schema validate a given DOM element.
*
- * @param element The element to validate.
- * @param externalSchemaLocations A String
containing namespace URI to schema
- * location pairs, the same way it is accepted by the xsi:
- * schemaLocation
attribute.
- * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without
- * a namespace, the same way it is accepted by the
- * xsi:noNamespaceSchemaLocation
attribute.
- * @return true
, if the element
validates against the schemas declared
- * in it.
- * @throws SAXException An error occurred parsing the document.
- * @throws IOException An error occurred reading the document from its serialized representation.
+ * @param element The element to validate.
+ * @param externalSchemaLocations A String
containing
+ * namespace URI to schema location
+ * pairs, the same way it is accepted
+ * by the xsi:
+ * schemaLocation
attribute.
+ * @param externalNoNamespaceSchemaLocation The schema location of the schema
+ * for elements without a namespace,
+ * the same way it is accepted by the
+ * xsi:noNamespaceSchemaLocation
+ * attribute.
+ * @return true
, if the element
validates against the
+ * schemas declared in it.
+ * @throws SAXException An error occurred parsing the document.
+ * @throws IOException An error occurred reading the document
+ * from its serialized representation.
* @throws ParserConfigurationException An error occurred configuring the XML
- * @throws TransformerException An error occurred serializing the element.
+ * @throws TransformerException An error occurred serializing the
+ * element.
*/
public static boolean validateElement(final Element element, final String externalSchemaLocations,
final String externalNoNamespaceSchemaLocation, final EntityResolver entityResolver)
@@ -628,32 +672,35 @@ public class DomUtils {
/**
* Serialize the given DOM node.
*
- *+ *
* The node will be serialized using the UTF-8 encoding. - *
+ * * * @param node The node to serialize. * @return String TheString
representation of the given DOM node.
- * @throws TransformerException An error occurred transforming the node to a String
.
- * @throws IOException An IO error occurred writing the node to a byte array.
+ * @throws TransformerException An error occurred transforming the node to a
+ * String
.
+ * @throws IOException An IO error occurred writing the node to a byte
+ * array.
*/
public static String serializeNode(final Node node) throws TransformerException, IOException {
return new String(serializeNode(node, "UTF-8", false), "UTF-8");
}
-
/**
* Serialize the given DOM node.
*
- *+ *
* The node will be serialized using the UTF-8 encoding. - *
+ * * - * @param node The node to serialize. + * @param node The node to serialize. * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. * @return String TheString
representation of the given DOM node.
- * @throws TransformerException An error occurred transforming the node to a String
.
- * @throws IOException An IO error occurred writing the node to a byte array.
+ * @throws TransformerException An error occurred transforming the node to a
+ * String
.
+ * @throws IOException An IO error occurred writing the node to a byte
+ * array.
*/
public static String serializeNode(final Node node, final boolean omitXmlDeclaration)
throws TransformerException, IOException {
@@ -663,16 +710,18 @@ public class DomUtils {
/**
* Serialize the given DOM node.
*
- *+ *
* The node will be serialized using the UTF-8 encoding. - *
+ * * - * @param node The node to serialize. + * @param node The node to serialize. * @param omitXmlDeclaration The boolean value for omitting the XML Declaration. - * @param lineSeperator Sets the line seperator String of the parser + * @param lineSeperator Sets the line seperator String of the parser * @return String TheString
representation of the given DOM node.
- * @throws TransformerException An error occurred transforming the node to a String
.
- * @throws IOException An IO error occurred writing the node to a byte array.
+ * @throws TransformerException An error occurred transforming the node to a
+ * String
.
+ * @throws IOException An IO error occurred writing the node to a byte
+ * array.
*/
public static String serializeNode(final Node node, final boolean omitXmlDeclaration,
final String lineSeperator) throws TransformerException, IOException {
@@ -682,12 +731,14 @@ public class DomUtils {
/**
* Serialize the given DOM node to a byte array.
*
- * @param node The node to serialize.
+ * @param node The node to serialize.
* @param xmlEncoding The XML encoding to use.
- * @return The serialized node, as a byte array. Using a compatible encoding this can easily be
- * converted into a String
.
- * @throws TransformerException An error occurred transforming the node to a byte array.
- * @throws IOException An IO error occurred writing the node to a byte array.
+ * @return The serialized node, as a byte array. Using a compatible encoding
+ * this can easily be converted into a String
.
+ * @throws TransformerException An error occurred transforming the node to a
+ * byte array.
+ * @throws IOException An IO error occurred writing the node to a byte
+ * array.
*/
public static byte[] serializeNode(final Node node, final String xmlEncoding)
throws TransformerException, IOException {
@@ -697,31 +748,34 @@ public class DomUtils {
/**
* Serialize the given DOM node to a byte array.
*
- * @param node The node to serialize.
- * @param xmlEncoding The XML encoding to use.
+ * @param node The node to serialize.
+ * @param xmlEncoding The XML encoding to use.
* @param omitDeclaration The boolean value for omitting the XML Declaration.
- * @return The serialized node, as a byte array. Using a compatible encoding this can easily be
- * converted into a String
.
- * @throws TransformerException An error occurred transforming the node to a byte array.
- * @throws IOException An IO error occurred writing the node to a byte array.
+ * @return The serialized node, as a byte array. Using a compatible encoding
+ * this can easily be converted into a String
.
+ * @throws TransformerException An error occurred transforming the node to a
+ * byte array.
+ * @throws IOException An IO error occurred writing the node to a byte
+ * array.
*/
public static byte[] serializeNode(final Node node, final String xmlEncoding,
final boolean omitDeclaration) throws TransformerException, IOException {
return serializeNode(node, xmlEncoding, omitDeclaration, null);
}
-
/**
* Serialize the given DOM node to a byte array.
*
- * @param node The node to serialize.
- * @param xmlEncoding The XML encoding to use.
+ * @param node The node to serialize.
+ * @param xmlEncoding The XML encoding to use.
* @param omitDeclaration The boolean value for omitting the XML Declaration.
- * @param lineSeperator Sets the line seperator String of the parser
- * @return The serialized node, as a byte array. Using a compatible encoding this can easily be
- * converted into a String
.
- * @throws TransformerException An error occurred transforming the node to a byte array.
- * @throws IOException An IO error occurred writing the node to a byte array.
+ * @param lineSeperator Sets the line seperator String of the parser
+ * @return The serialized node, as a byte array. Using a compatible encoding
+ * this can easily be converted into a String
.
+ * @throws TransformerException An error occurred transforming the node to a
+ * byte array.
+ * @throws IOException An IO error occurred writing the node to a byte
+ * array.
*/
public static byte[] serializeNode(final Node node, final String xmlEncoding,
final boolean omitDeclaration, final String lineSeperator)
@@ -737,7 +791,7 @@ public class DomUtils {
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omit);
if (null != lineSeperator) {
transformer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", lineSeperator);
- // does not work for xalan <= 2.5.1
+ // does not work for xalan <= 2.5.1
}
transformer.transform(new DOMSource(node), new StreamResult(bos));
@@ -750,15 +804,15 @@ public class DomUtils {
/**
* Return the text that a node contains.
*
- *+ *
* This routine: *
*String
value to
- * String
value mapping).
+ * @return The namespace prefix to namespace URL mapping ( a String
+ * value to String
value mapping).
*/
public static Map getNamespaceDeclarations(Node node) {
final Map nsDecls = new HashMap();
@@ -822,8 +877,8 @@ public class DomUtils {
}
/**
- * Add all namespace declarations declared in the parent(s) of a given element and used in the
- * subtree of the given element to the given element.
+ * Add all namespace declarations declared in the parent(s) of a given element
+ * and used in the subtree of the given element to the given element.
*
* @param context The element to which to add the namespaces.
*/
@@ -843,7 +898,7 @@ public class DomUtils {
final String nsUri = (String) e.getValue();
final String nsAttrName = "".equals(prefix) ? "xmlns" : "xmlns:" + prefix;
- context.setAttributeNS(XMLNamespaceConstants.XMLNS_NS_URI, nsAttrName, nsUri);
+ context.setAttributeNS(XmlNamespaceConstants.XMLNS_NS_URI, nsAttrName, nsUri);
}
}
}
@@ -853,8 +908,8 @@ public class DomUtils {
* Collect all the namespace URIs used in the subtree of a given element.
*
* @param context The element that should be searched for namespace URIs.
- * @return All namespace URIs used in the subtree of context
, including the ones used
- * in context
itself.
+ * @return All namespace URIs used in the subtree of context
,
+ * including the ones used in context
itself.
*/
public static Set collectNamespaceUris(final Element context) {
final Set result = new HashSet();
@@ -867,8 +922,8 @@ public class DomUtils {
* A recursive method to do the work of collectNamespaceURIs
.
*
* @param context The context element to evaluate.
- * @param result The result, passed as a parameter to avoid unnecessary instantiations of
- * Set
.
+ * @param result The result, passed as a parameter to avoid unnecessary
+ * instantiations of Set
.
*/
private static void collectNamespaceUrisImpl(final Element context, final Set result) {
final NamedNodeMap attrs = context.getAttributes();
@@ -878,14 +933,14 @@ public class DomUtils {
// add the namespace of the context element
nsUri = context.getNamespaceURI();
- if (nsUri != null && nsUri != XMLNamespaceConstants.XMLNS_NS_URI) {
+ if (nsUri != null && nsUri != XmlNamespaceConstants.XMLNS_NS_URI) {
result.add(nsUri);
}
// add all namespace URIs from attributes
for (i = 0; i < attrs.getLength(); i++) {
nsUri = attrs.item(i).getNamespaceURI();
- if (nsUri != null && nsUri != XMLNamespaceConstants.XMLNS_NS_URI) {
+ if (nsUri != null && nsUri != XmlNamespaceConstants.XMLNS_NS_URI) {
result.add(nsUri);
}
}
@@ -901,12 +956,12 @@ public class DomUtils {
}
/**
- * Check, that each attribute node in the given NodeList
has its parent in the
- * NodeList
as well.
+ * Check, that each attribute node in the given NodeList
has its
+ * parent in the NodeList
as well.
*
* @param nodes The NodeList
to check.
- * @return true
, if each attribute node in nodes
has its parent in
- * nodes
as well.
+ * @return true
, if each attribute node in nodes
has
+ * its parent in nodes
as well.
*/
public static boolean checkAttributeParentsInNodeList(final NodeList nodes) {
final Set nodeSet = new HashSet();
@@ -939,15 +994,19 @@ public class DomUtils {
}
/**
- * Convert an unstructured NodeList
into a DocumentFragment
.
+ * Convert an unstructured NodeList
into a
+ * DocumentFragment
.
*
- * @param nodeList Contains the node list to be converted into a DOM DocumentFragment.
- * @return the resulting DocumentFragment. The DocumentFragment will be backed by a new DOM
- * Document, i.e. all noded of the node list will be cloned.
- * @throws ParserConfigurationException An error occurred creating the DocumentFragment.
+ * @param nodeList Contains the node list to be converted into a DOM
+ * DocumentFragment.
+ * @return the resulting DocumentFragment. The DocumentFragment will be backed
+ * by a new DOM Document, i.e. all noded of the node list will be
+ * cloned.
+ * @throws ParserConfigurationException An error occurred creating the
+ * DocumentFragment.
* @precondition The nodes in the node list appear in document order
- * @precondition for each Attr node in the node list, the owning Element is in the node list as
- * well.
+ * @precondition for each Attr node in the node list, the owning Element is in
+ * the node list as well.
* @precondition each Element or Attr node in the node list is namespace aware.
*/
public static DocumentFragment nodeList2DocumentFragment(final NodeList nodeList)
@@ -973,10 +1032,10 @@ public class DomUtils {
/**
* Helper method for the nodeList2DocumentFragment
.
*
- * @param nodeList The NodeList
to convert.
- * @param currPos The current position in the nodeList
.
- * @param result The resulting DocumentFragment
.
- * @param currOrgElem The current original element.
+ * @param nodeList The NodeList
to convert.
+ * @param currPos The current position in the nodeList
.
+ * @param result The resulting DocumentFragment
.
+ * @param currOrgElem The current original element.
* @param currClonedElem The current cloned element.
* @return The current position.
*/
@@ -1052,7 +1111,7 @@ public class DomUtils {
}
default: {
- log.trace("Node type: {} not supported", currentNode.getNodeType());
+ log.trace("Node type: {} not supported", currentNode.getNodeType());
// All other nodes will be ignored
}
}
@@ -1067,20 +1126,20 @@ public class DomUtils {
* Check, if the given attribute is a namespace declaration.
*
* @param attr The attribute to check.
- * @return true
, if the attribute is a namespace declaration, false
- * otherwise.
+ * @return true
, if the attribute is a namespace declaration,
+ * false
otherwise.
*/
private static boolean isNamespaceDeclaration(final Attr attr) {
- return XMLNamespaceConstants.XMLNS_NS_URI.equals(attr.getNamespaceURI());
+ return XmlNamespaceConstants.XMLNS_NS_URI.equals(attr.getNamespaceURI());
}
/**
* Check, if a given DOM element is an ancestor of a given node.
*
* @param candAnc The DOM element to check for being the ancestor.
- * @param cand The node to check for being the child.
- * @return true
, if candAnc
is an (indirect) ancestor of
- * cand
; false
otherwise.
+ * @param cand The node to check for being the child.
+ * @return true
, if candAnc
is an (indirect) ancestor
+ * of cand
; false
otherwise.
*/
public static boolean isAncestor(final Element candAnc, final Node cand) {
Node currPar = cand.getParentNode();
@@ -1098,8 +1157,9 @@ public class DomUtils {
* Selects the (first) element from a node list and returns it.
*
* @param nl The NodeList to get the element from.
- * @return The (first) element included in the node list or null
if the node list is
- * null
or empty or no element is included in the list.
+ * @return The (first) element included in the node list or null
if
+ * the node list is null
or empty or no element is included
+ * in the list.
*/
public static Element getElementFromNodeList(final NodeList nl) {
if (nl == null || nl.getLength() == 0) {
@@ -1119,8 +1179,8 @@ public class DomUtils {
*
* @param parent The element to get the child elements from.
*
- * @return A list including all child elements of the given element. Maybe empty if the parent
- * element has no child elements.
+ * @return A list including all child elements of the given element. Maybe empty
+ * if the parent element has no child elements.
*/
public static List getChildElements(final Element parent) {
final Vector v = new Vector();
@@ -1153,5 +1213,4 @@ public class DomUtils {
return out.toByteArray();
}
-
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/EaafDomEntityResolver.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/EaafDomEntityResolver.java
index 6139e914..5a7dadc7 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/EaafDomEntityResolver.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/EaafDomEntityResolver.java
@@ -17,19 +17,20 @@
* works that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
-
package at.gv.egiz.eaaf.core.impl.utils;
import java.io.InputStream;
-import at.gv.egiz.eaaf.core.api.data.XMLNamespaceConstants;
+
import org.apache.xerces.util.URI;
import org.apache.xerces.util.URI.MalformedURIException;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
+import at.gv.egiz.eaaf.core.api.data.XmlNamespaceConstants;
+
/**
- * An EntityResolver
that looks up entities stored as local resources.
+ * An EntityResolver
that looks up entities stored as local
+ * resources.
*
* * The following DTDs are mapped to local resources: @@ -39,25 +40,27 @@ import org.xml.sax.InputSource; * *
* - * For all other resources, an attempt is made to resolve them as resources, either absolute or - * relative toConstants.SCHEMA_ROOT
.
+ * For all other resources, an attempt is made to resolve them as resources,
+ * either absolute or relative to Constants.SCHEMA_ROOT
.
*
*/
public class EaafDomEntityResolver implements EntityResolver {
/**
* Resolve an entity.
- *
- * The systemId
parameter is used to perform the lookup of the entity as a resource,
- * either by interpreting the systemId
as an absolute resource path, or by appending
- * the last path component of systemId
to Constants.SCHEMA_ROOT
.
- *
+ * The systemId
parameter is used to perform the lookup of the
+ * entity as a resource, either by interpreting the systemId
as an
+ * absolute resource path, or by appending the last path component of
+ * systemId
to Constants.SCHEMA_ROOT
.
+ *
InputSource
from which the entity can be read, or null
, if
- * the entity could not be found.
- * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
+ * @return An InputSource
from which the entity can be read, or
+ * null
, if the entity could not be found.
+ * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String,
+ * java.lang.String)
*/
@Override
public InputSource resolveEntity(final String publicId, String systemId) {
@@ -68,10 +71,10 @@ public class EaafDomEntityResolver implements EntityResolver {
// check if we can resolve some standard dtd's
if (publicId.equalsIgnoreCase("-//W3C//DTD XMLSchema 200102//EN")) {
return new InputSource(
- getClass().getResourceAsStream(XMLNamespaceConstants.SCHEMA_ROOT + "XMLSchema.dtd"));
+ getClass().getResourceAsStream(XmlNamespaceConstants.SCHEMA_ROOT + "XMLSchema.dtd"));
} else if (publicId.equalsIgnoreCase("datatypes")) {
return new InputSource(
- getClass().getResourceAsStream(XMLNamespaceConstants.SCHEMA_ROOT + "datatypes.dtd"));
+ getClass().getResourceAsStream(XmlNamespaceConstants.SCHEMA_ROOT + "datatypes.dtd"));
}
} else if (systemId != null) {
// get the URI path
@@ -100,7 +103,7 @@ public class EaafDomEntityResolver implements EntityResolver {
slashPos = systemId.lastIndexOf('/');
if (slashPos >= 0 && systemId.length() > slashPos) {
systemId = systemId.substring(slashPos + 1, systemId.length());
- stream = getClass().getResourceAsStream(XMLNamespaceConstants.SCHEMA_ROOT + systemId);
+ stream = getClass().getResourceAsStream(XmlNamespaceConstants.SCHEMA_ROOT + systemId);
if (stream != null) {
final InputSource source = new InputSource(stream);
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/XPathUtils.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/XPathUtils.java
index d6745c78..3adbe3f5 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/XPathUtils.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/XPathUtils.java
@@ -17,14 +17,11 @@
* works that you distribute must include a readable copy of the "NOTICE" text file.
*/
-
-
package at.gv.egiz.eaaf.core.impl.utils;
import java.util.List;
import java.util.Map;
-import at.gv.egiz.eaaf.core.api.data.XMLNamespaceConstants;
-import at.gv.egiz.eaaf.core.exceptions.XPathException;
+
import org.jaxen.JaxenException;
import org.jaxen.NamespaceContext;
import org.jaxen.Navigator;
@@ -37,6 +34,9 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.traversal.NodeIterator;
+import at.gv.egiz.eaaf.core.api.data.XmlNamespaceConstants;
+import at.gv.egiz.eaaf.core.exceptions.XPathException;
+
/**
* Utility methods to evaluate XPath expressions on DOM nodes.
*
@@ -46,7 +46,8 @@ import org.w3c.dom.traversal.NodeIterator;
public class XPathUtils {
/**
- * The XPath expression selecting all nodes under a given root (including the root node itself).
+ * The XPath expression selecting all nodes under a given root (including the
+ * root node itself).
*/
public static final String ALL_NODES_XPATH = "(.//. | .//@* | .//namespace::*)";
@@ -57,49 +58,50 @@ public class XPathUtils {
static {
final SimpleNamespaceContext ctx = new SimpleNamespaceContext();
- ctx.addNamespace(XMLNamespaceConstants.MOA_PREFIX, XMLNamespaceConstants.MOA_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.MOA_CONFIG_PREFIX,
- XMLNamespaceConstants.MOA_CONFIG_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.MOA_ID_CONFIG_PREFIX,
- XMLNamespaceConstants.MOA_ID_CONFIG_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.SL10_PREFIX, XMLNamespaceConstants.SL10_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.SL11_PREFIX, XMLNamespaceConstants.SL11_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.SL12_PREFIX, XMLNamespaceConstants.SL12_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.ECDSA_PREFIX, XMLNamespaceConstants.ECDSA_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.PD_PREFIX, XMLNamespaceConstants.PD_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.SAML_PREFIX, XMLNamespaceConstants.SAML_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.SAMLP_PREFIX, XMLNamespaceConstants.SAMLP_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.DSIG_PREFIX, XMLNamespaceConstants.DSIG_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.XSLT_PREFIX, XMLNamespaceConstants.XSLT_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.XSI_PREFIX, XMLNamespaceConstants.XSI_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.DSIG_FILTER2_PREFIX,
- XMLNamespaceConstants.DSIG_FILTER2_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.DSIG_EC_PREFIX, XMLNamespaceConstants.DSIG_EC_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.MD_PREFIX, XMLNamespaceConstants.MD_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.MDP_PREFIX, XMLNamespaceConstants.MDP_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.MVV_PREFIX, XMLNamespaceConstants.MVV_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.STB_PREFIX, XMLNamespaceConstants.STB_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.WRR_PREFIX, XMLNamespaceConstants.WRR_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.STORK_PREFIX, XMLNamespaceConstants.STORK_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.STORKP_PREFIX, XMLNamespaceConstants.STORKP_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.SAML2_PREFIX, XMLNamespaceConstants.SAML2_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.SAML2P_PREFIX, XMLNamespaceConstants.SAML2P_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.XENC_PREFIX, XMLNamespaceConstants.XENC_NS_URI);
- ctx.addNamespace(XMLNamespaceConstants.XADES_1_1_1_NS_PREFIX,
- XMLNamespaceConstants.XADES_1_1_1_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.MOA_PREFIX, XmlNamespaceConstants.MOA_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.MOA_CONFIG_PREFIX,
+ XmlNamespaceConstants.MOA_CONFIG_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.MOA_ID_CONFIG_PREFIX,
+ XmlNamespaceConstants.MOA_ID_CONFIG_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.SL10_PREFIX, XmlNamespaceConstants.SL10_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.SL11_PREFIX, XmlNamespaceConstants.SL11_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.SL12_PREFIX, XmlNamespaceConstants.SL12_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.ECDSA_PREFIX, XmlNamespaceConstants.ECDSA_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.PD_PREFIX, XmlNamespaceConstants.PD_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.SAML_PREFIX, XmlNamespaceConstants.SAML_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.SAMLP_PREFIX, XmlNamespaceConstants.SAMLP_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.DSIG_PREFIX, XmlNamespaceConstants.DSIG_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.XSLT_PREFIX, XmlNamespaceConstants.XSLT_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.XSI_PREFIX, XmlNamespaceConstants.XSI_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.DSIG_FILTER2_PREFIX,
+ XmlNamespaceConstants.DSIG_FILTER2_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.DSIG_EC_PREFIX, XmlNamespaceConstants.DSIG_EC_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.MD_PREFIX, XmlNamespaceConstants.MD_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.MDP_PREFIX, XmlNamespaceConstants.MDP_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.MVV_PREFIX, XmlNamespaceConstants.MVV_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.STB_PREFIX, XmlNamespaceConstants.STB_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.WRR_PREFIX, XmlNamespaceConstants.WRR_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.STORK_PREFIX, XmlNamespaceConstants.STORK_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.STORKP_PREFIX, XmlNamespaceConstants.STORKP_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.SAML2_PREFIX, XmlNamespaceConstants.SAML2_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.SAML2P_PREFIX, XmlNamespaceConstants.SAML2P_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.XENC_PREFIX, XmlNamespaceConstants.XENC_NS_URI);
+ ctx.addNamespace(XmlNamespaceConstants.XADES_1_1_1_NS_PREFIX,
+ XmlNamespaceConstants.XADES_1_1_1_NS_URI);
NS_CONTEXT = ctx;
}
/**
- * Return a NodeIterator
over the nodes matching the XPath expression.
+ * Return a NodeIterator
over the nodes matching the XPath
+ * expression.
*
- *
- * All namespace URIs and prefixes declared in the Constants
interface are used for
- * resolving namespaces.
- *
+ * All namespace URIs and prefixes declared in the Constants
+ * interface are used for resolving namespaces.
+ *
NodeIterator
over the nodes matching the XPath expression.
+ * Return a NodeIterator
over the nodes matching the XPath
+ * expression.
*
- * @param contextNode The root node from which to evaluate the XPath expression.
- * @param namespaceElement An element from which to build the namespace mapping for evaluating the
- * XPath expression
- * @param exp The XPath expression to evaluate.
+ * @param contextNode The root node from which to evaluate the XPath
+ * expression.
+ * @param namespaceElement An element from which to build the namespace mapping
+ * for evaluating the XPath expression
+ * @param exp The XPath expression to evaluate.
* @return An iterator over the resulting nodes.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
@@ -134,12 +138,15 @@ public class XPathUtils {
}
/**
- * Return a NodeIterator
over the nodes matching the XPath expression.
+ * Return a NodeIterator
over the nodes matching the XPath
+ * expression.
*
- * @param contextNode The root node from which to evaluate the XPath expression.
- * @param namespaceMapping A namespace prefix to namespace URI mapping (String
to
- * String
) for evaluating the XPath expression.
- * @param exp The XPath expression to evaluate.
+ * @param contextNode The root node from which to evaluate the XPath
+ * expression.
+ * @param namespaceMapping A namespace prefix to namespace URI mapping
+ * (String
to String
) for
+ * evaluating the XPath expression.
+ * @param exp The XPath expression to evaluate.
* @return An iterator over the resulting nodes.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
@@ -152,12 +159,14 @@ public class XPathUtils {
}
/**
- * Return a NodeIterator
over the nodes matching the XPath expression.
+ * Return a NodeIterator
over the nodes matching the XPath
+ * expression.
*
* @param contextNode The root node from which to evaluate the XPath expression.
- * @param nsContext The NamespaceContext
for resolving namespace prefixes to
- * namespace URIs for evaluating the XPath expression.
- * @param exp The XPath expression to evaluate.
+ * @param nsContext The NamespaceContext
for resolving namespace
+ * prefixes to namespace URIs for evaluating the XPath
+ * expression.
+ * @param exp The XPath expression to evaluate.
* @return An iterator over the resulting nodes.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
@@ -179,13 +188,15 @@ public class XPathUtils {
}
/**
- * Return a NodeList
of all the nodes matching the XPath expression.
- *
- * All namespace URIs and prefixes declared in the Constants
interface are used for
- * resolving namespaces.
- *
NodeList
of all the nodes matching the XPath
+ * expression.
+ *
+ * All namespace URIs and prefixes declared in the Constants
+ * interface are used for resolving namespaces.
+ *
NodeList
containing the matching nodes.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
@@ -196,12 +207,14 @@ public class XPathUtils {
}
/**
- * Return a NodeList
of all the nodes matching the XPath expression.
+ * Return a NodeList
of all the nodes matching the XPath
+ * expression.
*
- * @param contextNode The root node from which to evaluate the XPath expression.
- * @param namespaceElement An element from which to build the namespace mapping for evaluating the
- * XPath expression
- * @param exp The XPath expression to evaluate.
+ * @param contextNode The root node from which to evaluate the XPath
+ * expression.
+ * @param namespaceElement An element from which to build the namespace mapping
+ * for evaluating the XPath expression
+ * @param exp The XPath expression to evaluate.
* @return A NodeList
containing the matching nodes.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
@@ -221,12 +234,15 @@ public class XPathUtils {
}
/**
- * Return a NodeList
of all the nodes matching the XPath expression.
+ * Return a NodeList
of all the nodes matching the XPath
+ * expression.
*
- * @param contextNode The root node from which to evaluate the XPath expression.
- * @param namespaceMapping A namespace prefix to namespace URI mapping (String
to
- * String
) for evaluating the XPath expression.
- * @param exp The XPath expression to evaluate.
+ * @param contextNode The root node from which to evaluate the XPath
+ * expression.
+ * @param namespaceMapping A namespace prefix to namespace URI mapping
+ * (String
to String
) for
+ * evaluating the XPath expression.
+ * @param exp The XPath expression to evaluate.
* @return A NodeList
containing the matching nodes.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
@@ -239,12 +255,14 @@ public class XPathUtils {
}
/**
- * Return a NodeList
of all the nodes matching the XPath expression.
+ * Return a NodeList
of all the nodes matching the XPath
+ * expression.
*
* @param contextNode The root node from which to evaluate the XPath expression.
- * @param nsContext The NamespaceContext
for resolving namespace prefixes to
- * namespace URIs for evaluating the XPath expression.
- * @param exp The XPath expression to evaluate.
+ * @param nsContext The NamespaceContext
for resolving namespace
+ * prefixes to namespace URIs for evaluating the XPath
+ * expression.
+ * @param exp The XPath expression to evaluate.
* @return A NodeList
containing the matching nodes.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
@@ -265,14 +283,15 @@ public class XPathUtils {
/**
* Select the first node matching an XPath expression.
- *
- * All namespace URIs and prefixes declared in the Constants
interface are used for
- * resolving namespaces.
- *
+ * All namespace URIs and prefixes declared in the Constants
+ * interface are used for resolving namespaces.
+ *
null
, if no node
- * matched.
+ * @param exp The XPath expression to evaluate.
+ * @return Node The first node matching the XPath expression, or
+ * null
, if no node matched.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
public static Node selectSingleNode(final Node contextNode, final String exp)
@@ -284,12 +303,13 @@ public class XPathUtils {
/**
* Select the first node matching an XPath expression.
*
- * @param contextNode The root node from which to evaluate the XPath expression.
- * @param namespaceElement An element from which to build the namespace mapping for evaluating the
- * XPath expression
- * @param exp The XPath expression to evaluate.
- * @return Node The first node matching the XPath expression, or null
, if no node
- * matched.
+ * @param contextNode The root node from which to evaluate the XPath
+ * expression.
+ * @param namespaceElement An element from which to build the namespace mapping
+ * for evaluating the XPath expression
+ * @param exp The XPath expression to evaluate.
+ * @return Node The first node matching the XPath expression, or
+ * null
, if no node matched.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
public static Node selectSingleNode(final Node contextNode, final Element namespaceElement,
@@ -309,12 +329,14 @@ public class XPathUtils {
/**
* Select the first node matching an XPath expression.
*
- * @param contextNode The root node from which to evaluate the XPath expression.
- * @param namespaceMapping A namespace prefix to namespace URI mapping (String
to
- * String
) for evaluating the XPath expression.
- * @param exp The XPath expression to evaluate.
- * @return Node The first node matching the XPath expression, or null
, if no node
- * matched.
+ * @param contextNode The root node from which to evaluate the XPath
+ * expression.
+ * @param namespaceMapping A namespace prefix to namespace URI mapping
+ * (String
to String
) for
+ * evaluating the XPath expression.
+ * @param exp The XPath expression to evaluate.
+ * @return Node The first node matching the XPath expression, or
+ * null
, if no node matched.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
public static Node selectSingleNode(final Node contextNode, final Map namespaceMapping,
@@ -329,11 +351,12 @@ public class XPathUtils {
* Select the first node matching an XPath expression.
*
* @param contextNode The root node from which to evaluate the XPath expression.
- * @param nsContext The NamespaceContext
for resolving namespace prefixes to
- * namespace URIs for evaluating the XPath expression.
- * @param exp The XPath expression to evaluate.
- * @return Node The first node matching the XPath expression, or null
, if no node
- * matched.
+ * @param nsContext The NamespaceContext
for resolving namespace
+ * prefixes to namespace URIs for evaluating the XPath
+ * expression.
+ * @param exp The XPath expression to evaluate.
+ * @return Node The first node matching the XPath expression, or
+ * null
, if no node matched.
* @throws XPathException An error occurred evaluating the XPath expression.
*/
public static Node selectSingleNode(final Node contextNode, final NamespaceContext nsContext,
@@ -351,14 +374,16 @@ public class XPathUtils {
}
/**
- * Return the value of a DOM element whose location is given by an XPath expression.
+ * Return the value of a DOM element whose location is given by an XPath
+ * expression.
*
- * @param root The root element from which to evaluate the XPath.
- * @param xpath The XPath expression pointing to the element whose value to return.
- * @param def The default value to return, if no element can be found using the given
- * xpath
.
- * @return The element value, if it can be located using the xpath
. Otherwise,
- * def
is returned.
+ * @param root The root element from which to evaluate the XPath.
+ * @param xpath The XPath expression pointing to the element whose value to
+ * return.
+ * @param def The default value to return, if no element can be found using
+ * the given xpath
.
+ * @return The element value, if it can be located using the xpath
.
+ * Otherwise, def
is returned.
*/
public static String getElementValue(final Element root, final String xpath, final String def) {
@@ -367,14 +392,16 @@ public class XPathUtils {
}
/**
- * Return the value of a DOM attribute whose location is given by an XPath expression.
+ * Return the value of a DOM attribute whose location is given by an XPath
+ * expression.
*
- * @param root The root element from which to evaluate the XPath.
- * @param xpath The XPath expression pointing to the attribute whose value to return.
- * @param def The default value to return, if no attribute can be found using the given
- * xpath
.
- * @return The element value, if it can be located using the xpath
. Otherwise,
- * def
is returned.
+ * @param root The root element from which to evaluate the XPath.
+ * @param xpath The XPath expression pointing to the attribute whose value to
+ * return.
+ * @param def The default value to return, if no attribute can be found using
+ * the given xpath
.
+ * @return The element value, if it can be located using the xpath
.
+ * Otherwise, def
is returned.
*/
public static String getAttributeValue(final Element root, final String xpath, final String def) {
@@ -383,31 +410,36 @@ public class XPathUtils {
}
/**
- * Returns the namespace prefix used within XPathUtils
for referring to the namespace
- * of the specified (Security Layer command) element.
- *
- * This namespace prefix can be used in various XPath expression evaluation methods within
- * XPathUtils
without explicitely binding it to the particular namespace.
- *
XPathUtils
for
+ * referring to the namespace of the specified (Security Layer command) element.
+ *
+ * This namespace prefix can be used in various XPath expression evaluation
+ * methods within XPathUtils
without explicitely binding it to the
+ * particular namespace.
+ *
XPathUtils
for referring to the namespace
- * of the specified (Security Layer command) element.
+ * @return the namespace prefix used within XPathUtils
for
+ * referring to the namespace of the specified (Security Layer command)
+ * element.
*
- * throws XpathException If the specified element has a namespace other than the ones
- * known by this implementation as valid Security Layer namespaces (cf.
- * @link Constants#SL10_NS_URI, @link Constants#SL11_NS_URI, @link Constants#SL12_NS_URI).
+ * throws XpathException If the specified element has a namespace other
+ * than the ones known by this implementation as valid Security Layer
+ * namespaces (cf.
+ * @link Constants#SL10_NS_URI, @link Constants#SL11_NS_URI, @link
+ * Constants#SL12_NS_URI).
*/
public static String getSlPrefix(final Element contextElement) throws XPathException {
final String sLNamespace = contextElement.getNamespaceURI();
String slPrefix = null;
- if (sLNamespace.equals(XMLNamespaceConstants.SL10_NS_URI)) {
- slPrefix = XMLNamespaceConstants.SL10_PREFIX;
- } else if (sLNamespace.equals(XMLNamespaceConstants.SL12_NS_URI)) {
- slPrefix = XMLNamespaceConstants.SL12_PREFIX;
- } else if (sLNamespace.equals(XMLNamespaceConstants.SL11_NS_URI)) {
- slPrefix = XMLNamespaceConstants.SL11_PREFIX;
+ if (sLNamespace.equals(XmlNamespaceConstants.SL10_NS_URI)) {
+ slPrefix = XmlNamespaceConstants.SL10_PREFIX;
+ } else if (sLNamespace.equals(XmlNamespaceConstants.SL12_NS_URI)) {
+ slPrefix = XmlNamespaceConstants.SL12_PREFIX;
+ } else if (sLNamespace.equals(XmlNamespaceConstants.SL11_NS_URI)) {
+ slPrefix = XmlNamespaceConstants.SL11_PREFIX;
} else {
throw new XPathException("XPath operation FAILED. Reason: ");
}
@@ -415,36 +447,38 @@ public class XPathUtils {
return slPrefix;
}
-
/**
- * Return the SecurityLayer namespace prefix of the context element. If the context element is not
- * the element that lies within the SecurityLayer namespace. The Securitylayer namespace is
- * derived from the xmlns:sl10
, sl11
or sl
attribute of the
- * context element.
- *
+ * Return the SecurityLayer namespace prefix of the context element. If the
+ * context element is not the element that lies within the SecurityLayer
+ * namespace. The Securitylayer namespace is derived from the
+ * xmlns:sl10
, sl11
or sl
attribute of
+ * the context element.
+ *
* The returned prefix is needed for evaluating XPATH expressions. - *
- * @param contextElement The element to get a prefix for the Securitylayer namespace, that is used - * within the corresponding document. + * + * + * @param contextElement The element to get a prefix for the Securitylayer + * namespace, that is used within the corresponding + * document. * - * @return The stringsl10
, sl11
or sl
, depending on the
- * SecurityLayer namespace of the contextElement.
+ * @return The string sl10
, sl11
or sl
,
+ * depending on the SecurityLayer namespace of the contextElement.
*
- * throws XPathException If no (vlalid) SecurityLayer namespace prefix or namespace is
- * defined.
+ * throws XPathException If no (vlalid) SecurityLayer namespace prefix
+ * or namespace is defined.
*/
public static String getSlPrefixFromNoRoot(final Element contextElement) throws XPathException {
- String slPrefix = checkSLnsDeclaration(contextElement, XMLNamespaceConstants.SL10_PREFIX,
- XMLNamespaceConstants.SL10_NS_URI);
+ String slPrefix = checkSLnsDeclaration(contextElement, XmlNamespaceConstants.SL10_PREFIX,
+ XmlNamespaceConstants.SL10_NS_URI);
if (slPrefix == null) {
- slPrefix = checkSLnsDeclaration(contextElement, XMLNamespaceConstants.SL11_PREFIX,
- XMLNamespaceConstants.SL11_NS_URI);
+ slPrefix = checkSLnsDeclaration(contextElement, XmlNamespaceConstants.SL11_PREFIX,
+ XmlNamespaceConstants.SL11_NS_URI);
}
if (slPrefix == null) {
- slPrefix = checkSLnsDeclaration(contextElement, XMLNamespaceConstants.SL12_PREFIX,
- XMLNamespaceConstants.SL12_NS_URI);
+ slPrefix = checkSLnsDeclaration(contextElement, XmlNamespaceConstants.SL12_PREFIX,
+ XmlNamespaceConstants.SL12_NS_URI);
}
return slPrefix;
@@ -452,15 +486,18 @@ public class XPathUtils {
}
/**
- * Checks if the context element has an attribute xmlns:slPrefix
and if the prefix of
- * that attribute corresponds with a valid SecurityLayer namespace.
+ * Checks if the context element has an attribute xmlns:slPrefix
+ * and if the prefix of that attribute corresponds with a valid SecurityLayer
+ * namespace.
*
* @param contextElement The element to be checked.
- * @param slPrefix The prefix which should be checked. Must be a valid SecurityLayer namespace
- * prefix.
- * @param slNameSpace The SecurityLayer namespace that corresponds to the specified prefix.
+ * @param slPrefix The prefix which should be checked. Must be a valid
+ * SecurityLayer namespace prefix.
+ * @param slNameSpace The SecurityLayer namespace that corresponds to the
+ * specified prefix.
*
- * @return The valid SecurityLayer prefix or null
if this prefix is not used.
+ * @return The valid SecurityLayer prefix or null
if this prefix is
+ * not used.
* @throws XPathException In case of an error
*/
private static String checkSLnsDeclaration(final Element contextElement, final String slPrefix,
--
cgit v1.2.3