diff options
| author | Thomas <thomas.lenz@egiz.gv.at> | 2019-12-05 09:52:48 +0100 | 
|---|---|---|
| committer | Thomas <thomas.lenz@egiz.gv.at> | 2019-12-05 09:52:48 +0100 | 
| commit | 3fada6cef21c9b16467177d866df778203b51b4d (patch) | |
| tree | 8fe8ed37b6ee9fe35a1e035ceba6c68808328415 /eaaf_core/src/main | |
| parent | 95b21a826e5d81fdeabcf4673a9e87047edaec9d (diff) | |
| download | EAAF-Components-3fada6cef21c9b16467177d866df778203b51b4d.tar.gz EAAF-Components-3fada6cef21c9b16467177d866df778203b51b4d.tar.bz2 EAAF-Components-3fada6cef21c9b16467177d866df778203b51b4d.zip | |
some code code-style modifications
active code-quality checks!
Diffstat (limited to 'eaaf_core/src/main')
80 files changed, 1741 insertions, 1528 deletions
| diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/gui/IVelocityGuiFormBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/gui/IVelocityGuiFormBuilder.java index 5a7ce49d..ff90e9cc 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/gui/IVelocityGuiFormBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/gui/IVelocityGuiFormBuilder.java @@ -1,16 +1,19 @@  package at.gv.egiz.eaaf.core.api.gui;  import java.io.InputStream; +  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse; -import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; +  import org.apache.velocity.VelocityContext; -public interface IVelocityGuiFormBuilder extends IGuiFormBuilder { +import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; +public interface IVelocityGuiFormBuilder extends IGuiFormBuilder {    /** -   * 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 configuration     * @return @@ -18,28 +21,27 @@ public interface IVelocityGuiFormBuilder extends IGuiFormBuilder {    VelocityContext generateVelocityContextFromConfiguration(        IVelocityGuiBuilderConfiguration config); -    /**     * Load the template from different resources.     *     * @param config GUI builder configuration -   * @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     */    InputStream getTemplateInputStream(IVelocityGuiBuilderConfiguration config)        throws GuiBuildException; -    /** -   * Parse a GUI template, with parameters into a http servlet-response and use the default -   * http-response content-type. <br> +   * Parse a GUI template, with parameters into a http servlet-response and use +   * the default http-response content-type. <br>     * <br> -   * The parser use the <code>VelocityEngine</code> as internal template evaluator. +   * The parser use the <code>VelocityEngine</code> 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. <br>     * <br> -   * The parser use the <code>VelocityEngine</code> as internal template evaluator. +   * The parser use the <code>VelocityEngine</code> 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.     * <p/> -   * 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.     * <p/> -   * 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)     */    <T> Object deserialize(String value, Class<T> clazz) throws EaafJsonMapperException;    /**     * Deserialize a JSON string. -   *  -   * @param is the JSON to deserialize as {@link InputStream} -   * @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 is    the JSON to deserialize as {@link InputStream} +   * @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)     */    <T> Object deserialize(InputStream is, Class<T> clazz) throws EaafJsonMapperException; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/SLOInformationImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/SloInformationImpl.java index c0980b0b..71a2c849 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/SLOInformationImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/data/SloInformationImpl.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/*   * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a   * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.   * @@ -15,72 +15,91 @@   * 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.data;  import java.io.Serializable; -import at.gv.egiz.eaaf.core.api.idp.slo.SloInformationInterface; +import at.gv.egiz.eaaf.core.api.idp.slo.SloInformationInterface;  /** + *  Single Log-Out container DAO. + *    * @author tlenz   *   */ -public class SLOInformationImpl implements SloInformationInterface, Serializable { +public class SloInformationImpl implements SloInformationInterface, Serializable {    private static final long serialVersionUID = 295577931870512387L;    private String sessionIndex = null;    private String nameID = null;    private String protocolType = null; -  private String nameIDFormat = null; +  private String nameIdFormat = null;    private String binding = null; -  private String serviceURL = null; -  private String authURL = null; +  private String serviceUrl = null; +  private String authUrl = null;    private String spEntityID = null; -  public SLOInformationImpl(final String authURL, final String spEntityID, final String sessionID, -      final String nameID, final String nameIDFormat, final String protocolType) { -    this(authURL, spEntityID, sessionID, nameID, nameIDFormat, protocolType, null, +  /** +   * Create a SLO container. +   *  +   * @param authUrl IDP EntityId +   * @param spEntityId SP EntityId +   * @param sessionId SessionId on protocol-level +   * @param nameId User's nameId +   * @param nameIdFormat NameId format +   * @param protocolType Type of the Auth. protocol +   */ +  public SloInformationImpl(final String authUrl, final String spEntityId, final String sessionId, +      final String nameId, final String nameIdFormat, final String protocolType) { +    this(authUrl, spEntityId, sessionId, nameId, nameIdFormat, protocolType, null,          null);    } -  public SLOInformationImpl(final String authURL, final String spEntityID, final String sessionID, -      final String nameID, final String nameIDFormat, final String protocolType, -      final String sloBinding, final String sloLocationURL) { -    this.sessionIndex = sessionID; -    this.nameID = nameID; -    this.nameIDFormat = nameIDFormat; +  /** +   * Create a SLO container. +   *  +   * @param authUrl IDP EntityId +   * @param spEntityId SP EntityId +   * @param sessionId SessionId on protocol-level +   * @param nameId User's nameId +   * @param nameIdFormat NameId format +   * @param protocolType Type of the Auth. protocol +   * @param sloBinding SLO protocol binding +   * @param sloLocationUrl SLO end-point on SP +   */ +  public SloInformationImpl(final String authUrl, final String spEntityId, final String sessionId, +      final String nameId, final String nameIdFormat, final String protocolType, +      final String sloBinding, final String sloLocationUrl) { +    this.sessionIndex = sessionId; +    this.nameID = nameId; +    this.nameIdFormat = nameIdFormat;      this.protocolType = protocolType; -    this.spEntityID = spEntityID; +    this.spEntityID = spEntityId; -    if (authURL.endsWith("/")) { -      this.authURL = authURL.substring(0, authURL.length() - 1); +    if (authUrl.endsWith("/")) { +      this.authUrl = authUrl.substring(0, authUrl.length() - 1);      } else { -      this.authURL = authURL; +      this.authUrl = authUrl;      } -      this.binding = sloBinding; -    this.serviceURL = sloLocationURL; +    this.serviceUrl = sloLocationUrl;    } -    /** -   * +   * Get empty SLOContainer DAO.     */ -  public SLOInformationImpl() { +  public SloInformationImpl() {    } - -    /** +   * Get Service-Provider Id. +   *      * @return the spEntityID     */    @Override @@ -102,7 +121,8 @@ public class SLOInformationImpl implements SloInformationInterface, Serializable    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getUserNameIdentifier() +   * @see +   * at.gv.egovernment.moa.id.data.SLOInformationInterface#getUserNameIdentifier()     */    @Override    public String getUserNameIdentifier() { @@ -110,8 +130,9 @@ public class SLOInformationImpl implements SloInformationInterface, Serializable    } -    /** +   * Get SessionId. +   *      * @param sessionIndex the sessionIndex to set     */    @Override @@ -119,8 +140,9 @@ public class SLOInformationImpl implements SloInformationInterface, Serializable      this.sessionIndex = sessionIndex;    } -    /** +   * Get User's NameId. +   *      * @param nameID the nameID to set     */    @Override @@ -128,16 +150,15 @@ public class SLOInformationImpl implements SloInformationInterface, Serializable      this.nameID = nameID;    } - -    /** +   * Get authentication protocol identifier. +   *      * @param protocolType the protocolType to set     */    public void setProtocolType(final String protocolType) {      this.protocolType = protocolType;    } -    /*     * (non-Javadoc)     * @@ -148,27 +169,30 @@ public class SLOInformationImpl implements SloInformationInterface, Serializable      return protocolType;    } -    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getUserNameIDFormat() +   * @see +   * at.gv.egovernment.moa.id.data.SLOInformationInterface#getUserNameIDFormat()     */    @Override    public String getUserNameIdFormat() { -    return this.nameIDFormat; +    return this.nameIdFormat;    } -    /** -   * @param nameIDFormat the nameIDFormat to set +   * Get Format of the NameId. +   *  +   * @param nameIdFormat the nameIDFormat to set     */    @Override -  public void setNameIdFormat(final String nameIDFormat) { -    this.nameIDFormat = nameIDFormat; +  public void setNameIdFormat(final String nameIdFormat) { +    this.nameIdFormat = nameIdFormat;    }    /** +   * Get SLO protocol binding. +   *      * @return the binding     */    @Override @@ -177,28 +201,32 @@ public class SLOInformationImpl implements SloInformationInterface, Serializable    }    /** +   * Get SLO service URL. +   *      * @return the serviceURL     */    @Override    public String getServiceUrl() { -    return serviceURL; +    return serviceUrl;    }    /** +   * Get the IDP EntityId. +   *      * @return the authURL from requested IDP without ending /     */    @Override    public String getAuthUrl() { -    return authURL; +    return authUrl;    }    /** +   * Set the SP EntityId. +   *      * @param spEntityID the spEntityID to set     */    public void setSpEntityID(final String spEntityID) {      this.spEntityID = spEntityID;    } - -  } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGuiFormBuilderConfiguration.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGuiFormBuilderConfiguration.java index efb8c713..b0718f85 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGuiFormBuilderConfiguration.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGuiFormBuilderConfiguration.java @@ -23,13 +23,15 @@ import java.util.ArrayList;  import java.util.HashMap;  import java.util.List;  import java.util.Map; -import at.gv.egiz.eaaf.core.api.gui.GroupDefinition; -import at.gv.egiz.eaaf.core.api.gui.GroupDefinition.Type; -import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration; +  import org.apache.commons.lang3.StringUtils;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; +import at.gv.egiz.eaaf.core.api.gui.GroupDefinition; +import at.gv.egiz.eaaf.core.api.gui.GroupDefinition.Type; +import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration; +  /**   * Abstract Configuration implementation for GUI Builders.   * @@ -51,7 +53,6 @@ public abstract class AbstractGuiFormBuilderConfiguration implements IGuiBuilder    public static final GroupDefinition PARAM_GROUP_MSG =        GroupDefinition.getInstance("msg", Type.MAP); -    public static final String PARAM_VIEWNAME = "viewName";    public static final String PARAM_AUTHCONTEXT = "contextPath";    public static final String PARAM_FORMSUBMITENDPOINT = "submitEndpoint"; @@ -68,10 +69,11 @@ public abstract class AbstractGuiFormBuilderConfiguration implements IGuiBuilder    /**     * Abstract GUI Builder config.     * -   * @param authUrl IDP PublicURL-Prefix which should be used, but never null -   * @param viewName Name of the template (with suffix) but never null -   * @param formSubmitEndpoint EndPoint on which the form should be submitted, or null if the form -   *        must not submitted +   * @param authUrl            IDP PublicURL-Prefix which should be used, but +   *                           never null +   * @param viewName           Name of the template (with suffix) but never null +   * @param formSubmitEndpoint EndPoint on which the form should be submitted, or +   *                           null if the form must not submitted     *     */    public AbstractGuiFormBuilderConfiguration(final String authUrl, final String viewName, @@ -100,7 +102,8 @@ public abstract class AbstractGuiFormBuilderConfiguration implements IGuiBuilder    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewName() +   * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration# +   * getViewName()     */    @Override    public final String getViewName() { @@ -108,12 +111,11 @@ public abstract class AbstractGuiFormBuilderConfiguration implements IGuiBuilder    } -    /*     * (non-Javadoc)     * -   * @see -   * at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewParameters() +   * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration# +   * getViewParameters()     */    @Override    public final Map<String, Object> getViewParameters() { @@ -137,8 +139,8 @@ public abstract class AbstractGuiFormBuilderConfiguration implements IGuiBuilder    /**     * Define the parameters, which should be evaluated in the template. <br> -   * <b>IMPORTANT:</b> external HTML escapetion is required, because it is NOT done internally -   * during the building process +   * <b>IMPORTANT:</b> 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 <code>null</code> @@ -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 Entry<String, Object> el : authProcessData.getGenericSessionDataStorage()          .entrySet()) { @@ -220,33 +219,33 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati      } -    }    /**     * Parse citzen country-code into AuthData.     * -   * @param authData Current authentication data -   * @param authProcessData Authentication information holder from current pending request +   * @param authData        Current authentication data +   * @param authProcessData Authentication information holder from current pending +   *                        request     */    private void setCitizenCountryCode(final AuthenticationData authData,        final IAuthProcessDataContainer authProcessData) { -    includedToGenericAuthData.remove(PVPAttributeDefinitions.EID_ISSUING_NATION_NAME); +    includedToGenericAuthData.remove(PvpAttributeDefinitions.EID_ISSUING_NATION_NAME);      final String pvpCccAttr = authProcessData -        .getGenericDataFromSession(PVPAttributeDefinitions.EID_ISSUING_NATION_NAME, String.class); +        .getGenericDataFromSession(PvpAttributeDefinitions.EID_ISSUING_NATION_NAME, String.class);      if (StringUtils.isNotEmpty(pvpCccAttr)) {        authData.setCiticenCountryCode(pvpCccAttr); -      log.debug("Find PVP-Attr: " + PVPAttributeDefinitions.EID_ISSUING_NATION_FRIENDLY_NAME); +      log.debug("Find PVP-Attr: " + PvpAttributeDefinitions.EID_ISSUING_NATION_FRIENDLY_NAME);      } else {        if (authData.isForeigner()) { -    	//TODO: +        // TODO:          log.warn("Foreign citizen country NOT set yet!");        } else {          authData.setCiticenCountryCode(basicConfig.getBasicConfiguration(              IConfigurationWithSP.CONFIG_PROPS_AUTH_DEFAULT_COUNTRYCODE, -            EAAFConstants.COUNTRYCODE_AUSTRIA)); +            EaafConstants.COUNTRYCODE_AUSTRIA));        }      } @@ -256,28 +255,29 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati    /**     * parse QAA Level into AuthData.     * -   * @param authData current authentication data -   * @param authProcessData Authentication information holder from current pending request -   * @param pendingReq current pending request +   * @param authData        current authentication data +   * @param authProcessData Authentication information holder from current pending +   *                        request +   * @param pendingReq      current pending request     */    private void setQaaLevel(@NonNull final AuthenticationData authData,        @NonNull final IAuthProcessDataContainer authProcessData) { -    includedToGenericAuthData.remove(PVPAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_NAME); +    includedToGenericAuthData.remove(PvpAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_NAME);      String currentLoA = null; -    if (StringUtils.isNotEmpty(authProcessData.getQAALevel())) { -      currentLoA = authProcessData.getQAALevel(); +    if (StringUtils.isNotEmpty(authProcessData.getQaaLevel())) { +      currentLoA = authProcessData.getQaaLevel();      } else {        currentLoA = authProcessData.getGenericDataFromSession( -          PVPAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_NAME, String.class); +          PvpAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_NAME, String.class);        if (StringUtils.isNotEmpty(currentLoA)) {          log.debug( -            "Find PVP-Attr '" + PVPAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_FRIENDLY_NAME +            "Find PVP-Attr '" + PvpAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_FRIENDLY_NAME                  + "':" + currentLoA + " --> Parse QAA-Level from that attribute.");        }      }      if (StringUtils.isNotEmpty(currentLoA)) { -      if (currentLoA.startsWith(EAAFConstants.EIDAS_LOA_PREFIX)) { +      if (currentLoA.startsWith(EaafConstants.EIDAS_LOA_PREFIX)) {          authData.setEidasLoa(currentLoA);        } else { @@ -285,20 +285,19 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati        }      } else { -      log.info("No QAA level found. Set to default level " + EAAFConstants.EIDAS_LOA_LOW); -      authData.setEidasLoa(EAAFConstants.EIDAS_LOA_LOW); +      log.info("No QAA level found. Set to default level " + EaafConstants.EIDAS_LOA_LOW); +      authData.setEidasLoa(EaafConstants.EIDAS_LOA_LOW);      }    } -    private void setFlagForeigner(final AuthenticationData authData,        final IAuthProcessDataContainer authProcessData) {      // TODO: change to new eIDAS-token attribute identifier      if (authProcessData -        .getGenericDataFromSession(PVPAttributeDefinitions.EID_STORK_TOKEN_NAME) != null) { -      log.debug("Find PVP-Attr: " + PVPAttributeDefinitions.EID_STORK_TOKEN_FRIENDLY_NAME +        .getGenericDataFromSession(PvpAttributeDefinitions.EID_STORK_TOKEN_NAME) != null) { +      log.debug("Find PVP-Attr: " + PvpAttributeDefinitions.EID_STORK_TOKEN_FRIENDLY_NAME            + " --> Set 'isForeigner' flag to TRUE");        authData.setForeigner(true); @@ -309,8 +308,9 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati    }    /** -   * Build authentication data by using information from citizen-card or mobile-phone signature This -   * builder uses IdentityLink, AuthBlock, full MIS mandate as input information. +   * Build authentication data by using information from citizen-card or +   * mobile-phone signature This builder uses IdentityLink, AuthBlock, full MIS +   * mandate as input information.     *     * @param pendingReq current pendingRequest     * @return {@link IAuthData} but never <code>null</code> @@ -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<String, String> getEncryptedBpkFromPvpAttribute(        IAuthProcessDataContainer authProcessDataContainer, AuthenticationData authData, -      IspConfiguration spConfig) throws EaafBuilderException; +      ISpConfiguration spConfig) throws EaafBuilderException;    // request baseId from SRZ    @Deprecated @@ -546,13 +541,13 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati    @Deprecated    protected Pair<String, String> buildOAspecificbPK(final IRequest pendingReq,        final AuthenticationData authData) throws EaafBuilderException { -    final IspConfiguration oaParam = pendingReq.getServiceProviderConfiguration(); +    final ISpConfiguration oaParam = pendingReq.getServiceProviderConfiguration();      final String baseID = authData.getIdentificationValue();      final String baseIdType = authData.getIdentificationType();      Pair<String, String> sectorSpecId = null; -    if (EAAFConstants.URN_PREFIX_BASEID.equals(baseIdType)) { +    if (EaafConstants.URN_PREFIX_BASEID.equals(baseIdType)) {        // SAML1 legacy target parameter work-around        final String spTargetId = oaParam.getAreaSpecificTargetIdentifier();        log.debug("Use OA target identifier '" + spTargetId + "' from configuration"); @@ -575,7 +570,7 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati    }    @Deprecated -  protected IIdentityLink buildOAspecificIdentityLink(final IspConfiguration spConfig, +  protected IIdentityLink buildOAspecificIdentityLink(final ISpConfiguration spConfig,        final IIdentityLink idl, final String bpk, final String bpkType)        throws EaafConfigurationException, XPathException, DOMException, EaafParserException {      if (spConfig.hasBaseIdTransferRestriction()) { @@ -607,10 +602,11 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati     *     * @param oaParam Service-Provider configuration, never null     * @param bpkType bPK-Type to check -   * @return true, if bPK-Type matchs to Service-Provider configuration, otherwise false +   * @return true, if bPK-Type matchs to Service-Provider configuration, otherwise +   *         false     */    @Deprecated -  protected boolean matchsReceivedBpkToOnlineApplication(final IspConfiguration oaParam, +  protected boolean matchsReceivedBpkToOnlineApplication(final ISpConfiguration oaParam,        final String bpkType) {      return oaParam.getAreaSpecificTargetIdentifier().equals(bpkType); @@ -619,9 +615,10 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati    /**     * Parse information from an IdentityLink into AuthData object.     * -   * @param authData current authentication data -   * @param identityLink User's identityLink -   * @param includedGenericSessionData Generic AuthSession Data from PVP attributes +   * @param authData                   current authentication data +   * @param identityLink               User's identityLink +   * @param includedGenericSessionData Generic AuthSession Data from PVP +   *                                   attributes     */    @Deprecated    private void parseBasicUserInfosFromIdl(final AuthenticationData authData, @@ -631,10 +628,11 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati      /*       * GivenNames and FamilyNames with simple Apostrophe were escaped with ' in -     * IdentityLinkParser since 5 years. This feature was bug-fix for an SL1.0 AuthBlock problem. -     * However, the authentication attributes (SAML2, eIDAS, OpenID-Connect) also includes this -     * escaped values, but there it is not neccesary. We fix this problem in 3.4.3, but the fix can -     * be deactivated for dependency reasons. +     * IdentityLinkParser since 5 years. This feature was bug-fix for an SL1.0 +     * AuthBlock problem. However, the authentication attributes (SAML2, eIDAS, +     * OpenID-Connect) also includes this escaped values, but there it is not +     * neccesary. We fix this problem in 3.4.3, but the fix can be deactivated for +     * dependency reasons.       */      if (basicConfig.getBasicConfigurationBoolean(CONFIG_PROP_ENABLE_IDL_ATTRIBUTE_ESCAPEING,          false)) { @@ -649,35 +647,37 @@ public abstract class AbstractAuthenticationDataBuilder implements IAuthenticati      authData.setDateOfBirth(identityLink.getDateOfBirth()); -      // remove corresponding keys from genericSessionData if exists -    includedGenericSessionData.remove(PVPAttributeDefinitions.PRINCIPAL_NAME_NAME); -    includedGenericSessionData.remove(PVPAttributeDefinitions.GIVEN_NAME_NAME); -    includedGenericSessionData.remove(PVPAttributeDefinitions.BIRTHDATE_NAME); -    includedGenericSessionData.remove(PVPAttributeDefinitions.EID_SOURCE_PIN_NAME); -    includedGenericSessionData.remove(PVPAttributeDefinitions.EID_SOURCE_PIN_TYPE_NAME); +    includedGenericSessionData.remove(PvpAttributeDefinitions.PRINCIPAL_NAME_NAME); +    includedGenericSessionData.remove(PvpAttributeDefinitions.GIVEN_NAME_NAME); +    includedGenericSessionData.remove(PvpAttributeDefinitions.BIRTHDATE_NAME); +    includedGenericSessionData.remove(PvpAttributeDefinitions.EID_SOURCE_PIN_NAME); +    includedGenericSessionData.remove(PvpAttributeDefinitions.EID_SOURCE_PIN_TYPE_NAME);    }    /** -   * Get bPK from PVP Attribute 'BPK_NAME', which could be exist in MOASession as 'GenericData'. <br> +   * Get bPK from PVP Attribute 'BPK_NAME', which could be exist in MOASession as +   * 'GenericData'. <br>     *     * <pre>     * <code>session.getGenericDataFromSession(PVPConstants.BPK_NAME, String.class)</code>     * </pre>     *     * @param session MOASession, but never null -   * @return bPK, which was received by PVP-Attribute, or <code>null</code> if no attribute exists +   * @return bPK, which was received by PVP-Attribute, or <code>null</code> 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'. <br> +   * Get bPK-Type from PVP Attribute 'EID_SECTOR_FOR_IDENTIFIER_NAME', which could +   * be exist in MOASession as 'GenericData'. <br>     *     * <pre>     * <code>session.getGenericDataFromSession(PVPConstants.EID_SECTOR_FOR_IDENTIFIER_NAME, String.class)</code>     * </pre>     *     * @param session MOASession, but never null -   * @return bPKType, which was received by PVP-Attribute, or <code>null</code> if no attribute -   *         exists +   * @return bPKType, which was received by PVP-Attribute, or <code>null</code> 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 - * <code>"Ableitung f¨r die bereichsspezifische Personenkennzeichnung"</code> version - * <code>1.0.1</code> from <code>"reference.e-government.gv.at"</code>. + * <code>"Ableitung f¨r die bereichsspezifische Personenkennzeichnung"</code> + * version <code>1.0.1</code> from + * <code>"reference.e-government.gv.at"</code>.   *   */  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<String, String> generateAreaSpecificPersonIdentifier(final String baseID,        final String targetIdentifier) throws EaafBuilderException { -    return generateAreaSpecificPersonIdentifier(baseID, EAAFConstants.URN_PREFIX_BASEID, +    return generateAreaSpecificPersonIdentifier(baseID, EaafConstants.URN_PREFIX_BASEID,          targetIdentifier);    }    /** -   * Calculates an area specific unique person-identifier from an unique identifier with a specific -   * type. +   * Calculates an area specific unique person-identifier from an unique +   * identifier with a specific type.     * -   * @param baseID baseId from user but never null -   * @param baseIdType Type of the baseID 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 baseIdType       Type of the baseID 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<String, String> generateAreaSpecificPersonIdentifier(final String baseID,        final String baseIdType, final String targetIdentifier) throws EaafBuilderException {      if (StringUtils.isEmpty(baseID)) { -      throw new EaafBuilderException("builder.00", new Object[] {"baseID is empty or null"}, +      throw new EaafBuilderException("builder.00", new Object[] { "baseID is empty or null" },            "BaseId is empty or null");      }      if (StringUtils.isEmpty(baseIdType)) {        throw new EaafBuilderException("builder.00", -          new Object[] {"the type of baseID is empty or null"}, "Type of baseId is empty or null"); +          new Object[] { "the type of baseID is empty or null" }, "Type of baseId is empty or null");      }      if (StringUtils.isEmpty(targetIdentifier)) {        throw new EaafBuilderException("builder.00", -          new Object[] {"SP specific target identifier is empty or null"}, +          new Object[] { "SP specific target identifier is empty or null" },            "SP specific target identifier is empty or null");      } -    if (baseIdType.equals(EAAFConstants.URN_PREFIX_BASEID)) { +    if (baseIdType.equals(EaafConstants.URN_PREFIX_BASEID)) {        log.trace("Find baseID. Starting unique identifier caluclation for this target"); -      if (targetIdentifier.startsWith(EAAFConstants.URN_PREFIX_CDID) -          || targetIdentifier.startsWith(EAAFConstants.URN_PREFIX_WBPK)) { +      if (targetIdentifier.startsWith(EaafConstants.URN_PREFIX_CDID) +          || targetIdentifier.startsWith(EaafConstants.URN_PREFIX_WBPK)) {          log.trace("Calculate bPK, wbPK, or STORK identifier for target: " + targetIdentifier);          return Pair.newInstance(calculatebPKwbPK(baseID + "+" + targetIdentifier),              targetIdentifier); -      } else if (targetIdentifier.startsWith(EAAFConstants.URN_PREFIX_EIDAS)) { +      } else if (targetIdentifier.startsWith(EaafConstants.URN_PREFIX_EIDAS)) {          log.trace("Calculate eIDAS identifier for target: " + targetIdentifier);          final String[] splittedTarget = targetIdentifier.split("\\+");          final String cititzenCountryCode = splittedTarget[1]; @@ -114,15 +118,14 @@ public class BpkBuilder {          }          return buildEidasIdentifer(baseID, baseIdType, cititzenCountryCode, eidasOutboundCountry); -        } else {          throw new EaafBuilderException("builder.00", -            new Object[] {"Target identifier: " + targetIdentifier + " is NOT allowed or unknown"}, +            new Object[] { "Target identifier: " + targetIdentifier + " is NOT allowed or unknown" },              "Target identifier: " + targetIdentifier + " is NOT allowed or unknown");        }      } else { -      log.trace("BaseID is not of type " + EAAFConstants.URN_PREFIX_BASEID +      log.trace("BaseID is not of type " + EaafConstants.URN_PREFIX_BASEID            + ". Check type against requested target ...");        if (baseIdType.equals(targetIdentifier)) {          log.debug("Unique identifier is already area specific. Is nothing todo"); @@ -132,8 +135,8 @@ public class BpkBuilder {          log.warn("Get unique identifier for target: " + baseIdType + " but target: "              + targetIdentifier + " is required!");          throw new EaafBuilderException("builder.00", -            new Object[] {"Get unique identifier for target: " + baseIdType + " but target: " -                + targetIdentifier + " is required"}, +            new Object[] { "Get unique identifier for target: " + baseIdType + " but target: " +                + targetIdentifier + " is required" },              "Get unique identifier for target: " + baseIdType + " but target: " + targetIdentifier                  + " is required"); @@ -141,14 +144,15 @@ public class BpkBuilder {      }    } -    /**     * Builds the eIDAS from the given parameters.     * -   * @param baseId baseID of the citizen -   * @param baseIdType Type of the baseID -   * @param sourceCountry CountryCode of that country, which build the eIDAs ID -   * @param destinationCountry CountryCode of that country, which receives the eIDAs ID +   * @param baseId             baseID of the citizen +   * @param baseIdType         Type of the baseID +   * @param sourceCountry      CountryCode of that country, which build the eIDAs +   *                           ID +   * @param destinationCountry CountryCode of that country, which receives the +   *                           eIDAs ID     *     * @return Pair eIDAs/bPKType in a BASE64 encoding     * @throws EaafBuilderException if some input data are not valid @@ -160,8 +164,8 @@ public class BpkBuilder {      String bpkType = null;      // check if we have been called by public sector application -    if (baseIdType.startsWith(EAAFConstants.URN_PREFIX_BASEID)) { -      bpkType = EAAFConstants.URN_PREFIX_EIDAS + sourceCountry + "+" + destinationCountry; +    if (baseIdType.startsWith(EaafConstants.URN_PREFIX_BASEID)) { +      bpkType = EaafConstants.URN_PREFIX_EIDAS + sourceCountry + "+" + destinationCountry;        log.debug("Building eIDAS identification from: [identValue]+" + bpkType);        bpk = calculatebPKwbPK(baseId + "+" + bpkType); @@ -173,9 +177,9 @@ public class BpkBuilder {      if (StringUtils.isEmpty(bpk) || StringUtils.isEmpty(sourceCountry)          || StringUtils.isEmpty(destinationCountry)) {        throw new EaafBuilderException("builder.00", -          new Object[] {"eIDAS-ID", +          new Object[] { "eIDAS-ID",                "Unvollständige Parameterangaben: identificationValue=" + bpk + ", Zielland=" -                  + destinationCountry + ", Ursprungsland=" + sourceCountry}, +                  + destinationCountry + ", Ursprungsland=" + sourceCountry },            "eIDAS-ID: Unvollständige Parameterangaben: identificationValue=" + bpk + ", Zielland="                + destinationCountry + ", Ursprungsland=" + sourceCountry);      } @@ -189,8 +193,8 @@ public class BpkBuilder {    /**     * Create an encrypted bPK.     * -   * @param bpk unencrypted bPK -   * @param target bPK target +   * @param bpk       unencrypted bPK +   * @param target    bPK target     * @param publicKey Public-Key used for encryption     * @return encrypted bPK     * @throws EaafBuilderException In case of an error @@ -198,8 +202,8 @@ public class BpkBuilder {    public static String encryptBpk(final String bpk, String target, final PublicKey publicKey)        throws EaafBuilderException {      final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); -    if (target.startsWith(EAAFConstants.URN_PREFIX_CDID)) { -      target = target.substring(EAAFConstants.URN_PREFIX_CDID.length()); +    if (target.startsWith(EaafConstants.URN_PREFIX_CDID)) { +      target = target.substring(EaafConstants.URN_PREFIX_CDID.length());      }      final String input = @@ -210,8 +214,8 @@ public class BpkBuilder {        final byte[] inputBytes = input.getBytes("ISO-8859-1");        result = encrypt(inputBytes, publicKey);        return new String(Base64Utils.encode(result), "ISO-8859-1").replaceAll("\r\n", ""); -      // return new String(Base64Utils.encode(result, "ISO-8859-1")).replaceAll("\r\n", ""); - +      // return new String(Base64Utils.encode(result, +      // "ISO-8859-1")).replaceAll("\r\n", "");      } catch (final Exception e) {        throw new EaafBuilderException("bPK encryption FAILED", null, e.getMessage(), e); @@ -223,8 +227,8 @@ public class BpkBuilder {     * Decrypt an encrypted bPK.     *     * @param encryptedBpk encrypted bPK -   * @param target bPK target -   * @param privateKey private-key for decryption +   * @param target       bPK target +   * @param privateKey   private-key for decryption     * @return bPK     * @throws EaafBuilderException In case of an error     */ @@ -232,7 +236,8 @@ public class BpkBuilder {        final PrivateKey privateKey) throws EaafBuilderException {      String decryptedString;      try { -      // byte[] encryptedBytes = Base64Utils.decode(encryptedBpk, false, "ISO-8859-1"); +      // byte[] encryptedBytes = Base64Utils.decode(encryptedBpk, false, +      // "ISO-8859-1");        final byte[] encryptedBytes = Base64Utils.decode(encryptedBpk.getBytes("ISO-8859-1"));        final byte[] decryptedBytes = decrypt(encryptedBytes, privateKey);        decryptedString = new String(decryptedBytes, "ISO-8859-1"); @@ -247,8 +252,8 @@ public class BpkBuilder {      tmp = tmp.substring(tmp.indexOf("::") + 2);      final String bPK = tmp.substring(0, tmp.indexOf("::")); -    if (target.startsWith(EAAFConstants.URN_PREFIX_CDID + "+")) { -      target = target.substring((EAAFConstants.URN_PREFIX_CDID + "+").length()); +    if (target.startsWith(EaafConstants.URN_PREFIX_CDID + "+")) { +      target = target.substring((EaafConstants.URN_PREFIX_CDID + "+").length());      }      if (target.equals(sector)) { @@ -268,7 +273,7 @@ public class BpkBuilder {        return hashBase64;      } catch (final Exception ex) { -      throw new EaafBuilderException("builder.00", new Object[] {"bPK/wbPK", ex.toString()}, +      throw new EaafBuilderException("builder.00", new Object[] { "bPK/wbPK", ex.toString() },            ex.getMessage(), ex);      } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java index 7c143ca2..a6017789 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java @@ -1,4 +1,4 @@ -/******************************************************************************* +/*   * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a   * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology.   * @@ -15,24 +15,23 @@   * 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;  import java.util.Date;  import java.util.HashMap;  import java.util.Map; -import at.gv.egiz.eaaf.core.api.data.EAAFConstants; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import at.gv.egiz.eaaf.core.api.data.EaafConstants;  import at.gv.egiz.eaaf.core.api.idp.EaafAuthProcessDataConstants;  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.EaafStorageException; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory;  public class AuthProcessDataWrapper      implements IAuthProcessDataContainer, EaafAuthProcessDataConstants { @@ -48,7 +47,8 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getIssueInstant() +   * @see +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getIssueInstant()     */    @Override    public String getIssueInstant() { @@ -59,7 +59,8 @@ public class AuthProcessDataWrapper     * (non-Javadoc)     *     * @see -   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setIssueInstant(java.lang.String) +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setIssueInstant( +   * java.lang.String)     */    @Override    public void setIssueInstant(final String issueInstant) { @@ -70,7 +71,8 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#isAuthenticated() +   * @see +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#isAuthenticated()     */    @Override    public boolean isAuthenticated() { @@ -78,11 +80,12 @@ public class AuthProcessDataWrapper    } -    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setAuthenticated(boolean) +   * @see +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setAuthenticated( +   * boolean)     */    @Override    public void setAuthenticated(final boolean authenticated) { @@ -93,7 +96,8 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getIdentityLink() +   * @see +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getIdentityLink()     */    @Override    public IIdentityLink getIdentityLink() { @@ -101,13 +105,12 @@ public class AuthProcessDataWrapper    } -    /*     * (non-Javadoc)     *     * @see -   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setIdentityLink(at.gv.egovernment.moa -   * .id.auth.data.IdentityLink) +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setIdentityLink(at. +   * gv.egovernment.moa .id.auth.data.IdentityLink)     */    @Override    public void setIdentityLink(final IIdentityLink identityLink) { @@ -118,7 +121,8 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#isMandateUsed() +   * @see +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#isMandateUsed()     */    @Override    public boolean isMandateUsed() { @@ -128,7 +132,9 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setUseMandates(boolean) +   * @see +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setUseMandates( +   * boolean)     */    @Override    public void setUseMandates(final boolean useMandates) { @@ -142,18 +148,20 @@ public class AuthProcessDataWrapper     * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getQAALevel()     */    @Override -  public String getQAALevel() { +  public String getQaaLevel() {      return wrapStringObject(VALUE_QAALEVEL, null, String.class);    }    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setQAALevel(java.lang.String) +   * @see +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setQAALevel(java. +   * lang.String)     */    @Override -  public void setQAALevel(final String qAALevel) { -    authProcessData.put(VALUE_QAALEVEL, qAALevel); +  public void setQaaLevel(final String qaaLevel) { +    authProcessData.put(VALUE_QAALEVEL, qaaLevel);    } @@ -170,7 +178,8 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setForeigner(boolean) +   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setForeigner( +   * boolean)     */    @Override    public void setForeigner(final boolean isForeigner) { @@ -200,12 +209,12 @@ public class AuthProcessDataWrapper    }    @Override -  public boolean isEIDProcess() { +  public boolean isEidProcess() {      return wrapStringObject(FLAG_IS_NEW_EID_PROCESS, false, Boolean.class);    }    @Override -  public void setEIDProcess(final boolean value) { +  public void setEidProcess(final boolean value) {      authProcessData.put(FLAG_IS_NEW_EID_PROCESS, value);    } @@ -213,22 +222,24 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getSessionCreated() +   * @see +   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getSessionCreated()     */    @Override    public Date getSessionCreated() { -    return wrapStringObject(EAAFConstants.AUTH_DATA_CREATED, null, Date.class); +    return wrapStringObject(EaafConstants.AUTH_DATA_CREATED, null, Date.class);    }    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getGenericSessionDataStorage() +   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession# +   * getGenericSessionDataStorage()     */    @Override    public Map<String, Object> getGenericSessionDataStorage() {      final Map<String, Object> result = new HashMap<>(); -    for (final Map.Entry<String,Object> el : authProcessData.entrySet()) { +    for (final Map.Entry<String, Object> el : authProcessData.entrySet()) {        if (el.getKey().startsWith(GENERIC_PREFIX)) {          result.put(el.getKey().substring(GENERIC_PREFIX.length()), el.getValue());        } @@ -241,9 +252,8 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see -   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getGenericDataFromSession(java.lang. -   * String) +   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession# +   * getGenericDataFromSession(java.lang. String)     */    @Override    public Object getGenericDataFromSession(final String key) { @@ -253,9 +263,8 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see -   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#getGenericDataFromSession(java.lang. -   * String, java.lang.Class) +   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession# +   * getGenericDataFromSession(java.lang. String, java.lang.Class)     */    @Override    public <T> T getGenericDataFromSession(final String key, final Class<T> clazz) { @@ -265,9 +274,8 @@ public class AuthProcessDataWrapper    /*     * (non-Javadoc)     * -   * @see -   * at.gv.egovernment.moa.id.auth.data.IAuthenticationSession#setGenericDataToSession(java.lang. -   * String, java.lang.Object) +   * @see at.gv.egovernment.moa.id.auth.data.IAuthenticationSession# +   * setGenericDataToSession(java.lang. String, java.lang.Object)     */    @Override    public void setGenericDataToSession(final String key, final Object object) diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/IdentityLink.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/IdentityLink.java index a1faa0a4..ee1037a1 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/IdentityLink.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/IdentityLink.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,16 +23,20 @@ import java.io.ByteArrayInputStream;  import java.io.IOException;  import java.io.Serializable;  import java.security.PublicKey; +  import javax.xml.transform.TransformerException; + +import org.w3c.dom.Element; +  import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;  import at.gv.egiz.eaaf.core.impl.utils.DomUtils;  import at.gv.egiz.eaaf.core.impl.utils.XPathUtils; -import org.w3c.dom.Element; -  /** - * Data contained in an identity link issued by BMI, relevant to the MOA ID component. <br> - * <code>"IdentityLink"</code> is the translation of <code>"Personenbindung"</code>. + * Data contained in an identity link issued by BMI, relevant to the MOA ID + * component. <br> + * <code>"IdentityLink"</code> is the translation of + * <code>"Personenbindung"</code>.   *   * @author Paul Ivancsics   * @version $Id$ @@ -59,41 +46,44 @@ public class IdentityLink implements Serializable, IIdentityLink {    private static final long serialVersionUID = 1L;    /** -   * <code>"identificationValue"</code> is the translation of <code>"Stammzahl"</code>. +   * <code>"identificationValue"</code> is the translation of +   * <code>"Stammzahl"</code>.     */    private String identificationValue;    /** -   * <code>"identificationType"</code> type of the identificationValue in the IdentityLink. +   * <code>"identificationType"</code> 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 <code><saml:Assertion></code> <br> + * Parses MDS from an identity link. <code><saml:Assertion></code> <br>   * <b>This IDL parser extract NO key information!</b>   *   */ @@ -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 <code>IdentityLinkAssertionParser</code>. A DOM-representation of the incoming -   * String will be created +   * Constructor for <code>IdentityLinkAssertionParser</code>. A +   * DOM-representation of the incoming String will be created     *     * @param xmlAssertion <code><saml:Assertion></code> 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 <code>IdentityLinkAssertionParser</code>. A DOM-representation of the incoming -   * Inputstream will be created +   * Constructor for <code>IdentityLinkAssertionParser</code>. A +   * DOM-representation of the incoming Inputstream will be created     *     * @param xmlAssertion <code><saml:Assertion></code> 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 <code><saml:Assertion></code> +   * Parses the identity link from the <code><saml:Assertion></code>.     *     * @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 -   * <code><InfoboxReadResponse></code> found in the dsig-signature +   * <code><InfoboxReadResponse></code> 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.).   * </p>   * The code has been taken from {@link AuthServlet}.   */ @@ -81,7 +84,6 @@ public abstract class AbstractAuthServletTask extends AbstractTask {    public abstract void execute(ExecutionContext executionContext, HttpServletRequest request,        HttpServletResponse response) throws TaskExecutionException; -    @Override    protected final IRequest internalExecute(final IRequest pendingReq,        final ExecutionContext executionContext, final HttpServletRequest request, @@ -90,7 +92,7 @@ public abstract class AbstractAuthServletTask extends AbstractTask {      this.pendingReq = pendingReq;      // add latest pendingRequestId on execution context -    executionContext.put(EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID, +    executionContext.put(EaafConstants.PROCESS_ENGINE_PENDINGREQUESTID,          pendingReq.getPendingRequestId());      // execute task specific action @@ -101,20 +103,22 @@ public abstract class AbstractAuthServletTask extends AbstractTask {    }    /** -   * Redirect the authentication process to protocol specific finalization endpoint. +   * Redirect the authentication process to protocol specific finalization +   * endpoint.     *     * @param executionContext     * -   * @param pendingReq Actually processed protocol specific authentication request -   * @param httpResp http response object -   * @throws IOException In case of a general error +   * @param pendingReq       Actually processed protocol specific authentication +   *                         request +   * @param httpResp         http response object +   * @throws IOException   In case of a general error     * @throws EaafException In case of an application error     */    protected void performRedirectToProtocolFinialization(final ExecutionContext executionContext,        final IRequest pendingReq, final HttpServletRequest httpReq,        final HttpServletResponse httpResp) throws EaafException, IOException {      final Object frontChannelRedirectFlagObj = -        executionContext.get(EAAFConstants.PROCESS_ENGINE_REQUIRES_NO_POSTAUTH_REDIRECT); +        executionContext.get(EaafConstants.PROCESS_ENGINE_REQUIRES_NO_POSTAUTH_REDIRECT);      if (frontChannelRedirectFlagObj != null && frontChannelRedirectFlagObj instanceof Boolean          && (Boolean) frontChannelRedirectFlagObj) {        log.info("AuthProcess finished. Forward to Protocol finalization."); @@ -128,15 +132,14 @@ public abstract class AbstractAuthServletTask extends AbstractTask {      } - -    }    /**     * Redirect the authentication process to IDP itself.     * -   * @param pendingReq Actually processed protocol specific authentication request -   * @param httpResp http response +   * @param pendingReq  Actually processed protocol specific authentication +   *                    request +   * @param httpResp    http response     * @param idpEndPoint Servlet EndPoint that should receive the redirect     */    protected void performRedirectToItself(final IRequest pendingReq, @@ -151,16 +154,15 @@ public abstract class AbstractAuthServletTask extends AbstractTask {    } -    /** -   * Parses the request input stream for parameters, assuming parameters are encoded UTF-8 (no -   * standard exists how browsers should encode them). +   * Parses the request input stream for parameters, assuming parameters are +   * encoded UTF-8 (no standard exists how browsers should encode them).     *     * @param req servlet request     *     * @return mapping parameter name -> value     * -   * @throws IOException if parsing request parameters fails. +   * @throws IOException         if parsing request parameters fails.     *     * @throws FileUploadException if parsing request parameters fails.     */ @@ -215,7 +217,8 @@ public abstract class AbstractAuthServletTask extends AbstractTask {          final Entry<String, String[]> entry = requestParamIt.next();          final String key = entry.getKey();          final String[] values = entry.getValue(); -        // take the last value from the value array since the legacy code above also does it this +        // take the last value from the value array since the legacy code above also +        // does it this          // way          parameters.put(key, ArrayUtils.isEmpty(values) ? null : values[values.length - 1]);        } @@ -228,7 +231,7 @@ public abstract class AbstractAuthServletTask extends AbstractTask {    /**     * Reads bytes up to a delimiter, consuming the delimiter.     * -   * @param in input stream +   * @param in        input stream     * @param delimiter delimiter character     * @return String constructed from the read bytes     * @throws IOException In case of a general error @@ -251,8 +254,8 @@ public abstract class AbstractAuthServletTask extends AbstractTask {    /**     * Adds a parameter to a URL.     * -   * @param url the URL -   * @param paramname parameter name +   * @param url        the URL +   * @param paramname  parameter name     * @param paramvalue parameter value     * @return the URL with parameter added     */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java index 27aeab03..c4f1b505 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/modules/ModuleRegistration.java @@ -27,12 +27,9 @@ import java.util.Iterator;  import java.util.List;  import java.util.Map;  import java.util.ServiceLoader; +  import javax.annotation.PostConstruct; -import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.idp.auth.modules.AuthModule; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine; -import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParserException; +  import org.apache.commons.lang3.StringUtils;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; @@ -40,13 +37,20 @@ import org.springframework.beans.factory.annotation.Autowired;  import org.springframework.context.ApplicationContext;  import org.springframework.core.io.Resource; +import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.idp.auth.modules.AuthModule; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine; +import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParserException; +  /** - * This class handles registering modules. The modules are detected either with the ServiceLoader - * mechanism or via Spring. All detected modules are ranked according to their priority. + * This class handles registering modules. The modules are detected either with + * the ServiceLoader mechanism or via Spring. All detected modules are ranked + * according to their priority.   */  public class ModuleRegistration { -  //private static ModuleRegistration instance = new ModuleRegistration(); +  // private static ModuleRegistration instance = new ModuleRegistration();    private final List<AuthModule> priorizedModules = new ArrayList<>(); @@ -58,10 +62,6 @@ public class ModuleRegistration {    private final Logger log = LoggerFactory.getLogger(getClass()); -//  public static ModuleRegistration getInstance() { -//    return ctx.; -//  } -    private ModuleRegistration() {    } @@ -77,7 +77,7 @@ public class ModuleRegistration {      // order modules according to their priority      sortModules(); -    //instance = this; +    // instance = this;    }    /** @@ -142,10 +142,10 @@ public class ModuleRegistration {    }    /** -   * Returns the process description id of the first process, in the highest ranked module, which is -   * able to work with the given execution context. +   * Returns the process description id of the first process, in the highest +   * ranked module, which is able to work with the given execution context.     * -   * @param context the {@link ExecutionContext}. +   * @param context    the {@link ExecutionContext}.     * @param pendingReq the current processed {@link IRequest}     * @return the process id or {@code null}     */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java index a5030851..817c7aa2 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/services/ProtocolAuthenticationService.java @@ -24,14 +24,27 @@ import java.io.PrintWriter;  import java.io.StringWriter;  import java.util.Arrays;  import java.util.List; +  import javax.naming.ConfigurationException;  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.ArrayUtils; +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 org.springframework.context.ApplicationContext; +import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; +import org.springframework.stereotype.Service; +  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.EaafConstants;  import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration;  import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfigurationFactory;  import at.gv.egiz.eaaf.core.api.gui.IGuiFormBuilder; @@ -40,7 +53,7 @@ import at.gv.egiz.eaaf.core.api.idp.IAction;  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.IModulInfo; -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.auth.services.IProtocolAuthenticationService; @@ -59,16 +72,6 @@ import at.gv.egiz.eaaf.core.exceptions.ProtocolNotActiveException;  import at.gv.egiz.eaaf.core.impl.gui.AbstractGuiFormBuilderConfiguration;  import at.gv.egiz.eaaf.core.impl.idp.controller.protocols.RequestImpl;  import at.gv.egiz.eaaf.core.impl.utils.HttpUtils; -import org.apache.commons.lang3.ArrayUtils; -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 org.springframework.context.ApplicationContext; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; -import org.springframework.stereotype.Service;  @Service  public class ProtocolAuthenticationService implements IProtocolAuthenticationService { @@ -99,13 +102,13 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer    @Autowired    private IRevisionLogger revisionsLogger; -    private IGuiFormBuilder guiBuilder;    /*     * (non-Javadoc)     * -   * @see at.gv.egiz.eaaf.core.impl.idp.auth.services.IProtocolAuthenticationService# +   * @see +   * at.gv.egiz.eaaf.core.impl.idp.auth.services.IProtocolAuthenticationService#     * performAuthentication(javax.servlet.http.HttpServletRequest,     * javax.servlet.http.HttpServletResponse, at.gv.egiz.eaaf.core.api.IRequest)     */ @@ -121,16 +124,17 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer              .setPendingRequestId(pendingReqIdGenerationStrategy.generateExternalPendingRequestId());          // load Parameters from OnlineApplicationConfiguration -        final IspConfiguration oaParam = pendingReq.getServiceProviderConfiguration(); +        final ISpConfiguration oaParam = pendingReq.getServiceProviderConfiguration();          if (oaParam == null) {            throw new EaafAuthenticationException(                IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOSPCONFIG, -              new Object[] {pendingReq.getSpEntityId()}); +              new Object[] { pendingReq.getSpEntityId() });          }          if (authmanager.doAuthentication(req, resp, pendingReq)) { -          // pending request is already authenticated --> protocol-specific postProcessing can start +          // pending request is already authenticated --> protocol-specific postProcessing +          // can start            // directly            finalizeAuthentication(req, resp, pendingReq); @@ -155,7 +159,8 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer    /*     * (non-Javadoc)     * -   * @see at.gv.egiz.eaaf.core.impl.idp.auth.services.IProtocolAuthenticationService# +   * @see +   * at.gv.egiz.eaaf.core.impl.idp.auth.services.IProtocolAuthenticationService#     * finalizeAuthentication(javax.servlet.http.HttpServletRequest,     * javax.servlet.http.HttpServletResponse, at.gv.egiz.eaaf.core.api.IRequest)     */ @@ -210,11 +215,10 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer      // remove pending-request      requestStorage.removePendingRequest(pendingReq.getPendingRequestId());      revisionsLogger.logEvent(EventConstants.TRANSACTION_DESTROYED, -          pendingReq.getUniqueTransactionIdentifier()); +        pendingReq.getUniqueTransactionIdentifier());    } -    @Override    public void buildProtocolSpecificErrorResponse(final Throwable throwable,        final HttpServletRequest req, final HttpServletResponse resp, final IRequest protocolRequest) @@ -285,7 +289,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer    } -    public void setGuiBuilder(final IGuiFormBuilder guiBuilder) {      this.guiBuilder = guiBuilder;    } @@ -293,11 +296,11 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer    /**     * Finalize the requested protocol operation.     * -   * @param httpReq HttpServletRequest -   * @param httpResp HttpServletResponse +   * @param httpReq         HttpServletRequest +   * @param httpResp        HttpServletResponse     * @param protocolRequest Authentication request which is actually in process -   * @param moaSession MOASession object, which is used to generate the protocol specific -   *        authentication information +   * @param moaSession      MOASession object, which is used to generate the +   *                        protocol specific authentication information     * @throws Exception In case of an error     */    protected void internalFinalizeAuthenticationProcess(final HttpServletRequest req, @@ -352,10 +355,10 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer    /**     * Executes the requested protocol action.     * -   * @param httpReq HttpServletRequest -   * @param httpResp HttpServletResponse +   * @param httpReq         HttpServletRequest +   * @param httpResp        HttpServletResponse     * @param protocolRequest Authentication request which is actually in process -   * @param authData Service-provider specific authentication data +   * @param authData        Service-provider specific authentication data     *     * @return Return Single LogOut information or null if protocol supports no SSO     * @@ -430,7 +433,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer        final IGuiBuilderConfiguration config =            guiConfigFactory.getDefaultErrorGui(HttpUtils.extractAuthUrlFromRequest(httpReq)); -        String[] errorCodeParams = null;        if (params == null) {          errorCodeParams = new String[] {}; @@ -446,8 +448,6 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer          }        } - -        // add errorcode and errormessage        if (config instanceof ModifyableGuiBuilderConfiguration) {          ((ModifyableGuiBuilderConfiguration) config).putCustomParameter( @@ -471,15 +471,12 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer              "Can not ADD error message, because 'GUIBuilderConfiguration' is not modifieable ");        } - -        guiBuilder.build(httpReq, httpResp, config, "Error-Message");      } catch (final GuiBuildException e) {        log.warn("Can not build error-message GUI.", e);        throw new EaafException("9199", null, e); -      }    } @@ -496,7 +493,7 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer        throws IOException, EaafException {      if (e instanceof ProtocolNotActiveException) {        resp.getWriter().write(e.getMessage()); -      resp.setContentType(EAAFConstants.CONTENTTYPE_HTML_UTF8); +      resp.setContentType(EaafConstants.CONTENTTYPE_HTML_UTF8);        resp.sendError(HttpServletResponse.SC_FORBIDDEN,            StringEscapeUtils.escapeHtml4(StringEscapeUtils.escapeEcmaScript(e.getMessage()))); @@ -537,5 +534,4 @@ public class ProtocolAuthenticationService implements IProtocolAuthenticationSer    } -  } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/SimpleStringAttributeGenerator.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/SimpleStringAttributeGenerator.java index fc36f492..df4e97fc 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/SimpleStringAttributeGenerator.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/SimpleStringAttributeGenerator.java @@ -21,7 +21,8 @@ package at.gv.egiz.eaaf.core.impl.idp.builder;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  /** - * Simple String attribute generator that only generates attribute values as String. + * Simple String attribute generator that only generates attribute values as + * String.   *   * @author tlenz   * @@ -32,8 +33,8 @@ public class SimpleStringAttributeGenerator implements IAttributeGenerator<Strin     * (non-Javadoc)     *     * @see -   * at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator#buildStringAttribute( -   * java.lang.String, java.lang.String, java.lang.String) +   * at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator# +   * buildStringAttribute( java.lang.String, java.lang.String, java.lang.String)     */    @Override    public String buildStringAttribute(final String friendlyName, final String name, final String value) { @@ -45,8 +46,8 @@ public class SimpleStringAttributeGenerator implements IAttributeGenerator<Strin     * (non-Javadoc)     *     * @see -   * at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator#buildIntegerAttribute -   * (java.lang.String, java.lang.String, int) +   * at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator# +   * buildIntegerAttribute (java.lang.String, java.lang.String, int)     */    @Override    public String buildIntegerAttribute(final String friendlyName, final String name, final int value) { @@ -58,8 +59,8 @@ public class SimpleStringAttributeGenerator implements IAttributeGenerator<Strin     * (non-Javadoc)     *     * @see -   * at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator#buildLongAttribute( -   * java.lang.String, java.lang.String, long) +   * at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator# +   * buildLongAttribute( java.lang.String, java.lang.String, long)     */    @Override    public String buildLongAttribute(final String friendlyName, final String name, final long value) { @@ -71,8 +72,8 @@ public class SimpleStringAttributeGenerator implements IAttributeGenerator<Strin     * (non-Javadoc)     *     * @see -   * at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator#buildEmptyAttribute( -   * java.lang.String, java.lang.String) +   * at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator# +   * buildEmptyAttribute( java.lang.String, java.lang.String)     */    @Override    public String buildEmptyAttribute(final String friendlyName, final String name) { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BirthdateAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BirthdateAttributeBuilder.java index 505ba137..19500cb3 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BirthdateAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BirthdateAttributeBuilder.java @@ -21,10 +21,11 @@ package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;  import java.text.DateFormat;  import java.text.SimpleDateFormat; +  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; @@ -37,7 +38,7 @@ public class BirthdateAttributeBuilder implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      if (authData.getDateOfBirth() != null) { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java index 56eb5634..172d74a7 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java @@ -20,17 +20,19 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;  import javax.annotation.Nonnull; -import at.gv.egiz.eaaf.core.api.data.EAAFConstants; + +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.Assert; + +import at.gv.egiz.eaaf.core.api.data.EaafConstants;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.Assert;  @PvpMetadata  public class BpkAttributeBuilder implements IPvpAttributeBuilder { @@ -44,7 +46,7 @@ public class BpkAttributeBuilder implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      final String result = getBpkForSP(authData);      log.trace("Authenticate user with bPK/wbPK: " + result); @@ -80,12 +82,12 @@ public class BpkAttributeBuilder implements IPvpAttributeBuilder {    @Nonnull    protected String removeBpkTypePrefix(@Nonnull final String type) {      Assert.isTrue(type != null, "bPKType is 'NULL'"); -    if (type.startsWith(EAAFConstants.URN_PREFIX_WBPK)) { -      return type.substring(EAAFConstants.URN_PREFIX_WBPK.length()); -    } else if (type.startsWith(EAAFConstants.URN_PREFIX_CDID)) { -      return type.substring(EAAFConstants.URN_PREFIX_CDID.length()); -    } else if (type.startsWith(EAAFConstants.URN_PREFIX_EIDAS)) { -      return type.substring(EAAFConstants.URN_PREFIX_EIDAS.length()); +    if (type.startsWith(EaafConstants.URN_PREFIX_WBPK)) { +      return type.substring(EaafConstants.URN_PREFIX_WBPK.length()); +    } else if (type.startsWith(EaafConstants.URN_PREFIX_CDID)) { +      return type.substring(EaafConstants.URN_PREFIX_CDID.length()); +    } else if (type.startsWith(EaafConstants.URN_PREFIX_EIDAS)) { +      return type.substring(EaafConstants.URN_PREFIX_EIDAS.length());      } else {        return type;      } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidCcsUrl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidCcsUrl.java index 8029d769..27b78059 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidCcsUrl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidCcsUrl.java @@ -8,7 +8,7 @@ import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IEidAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; @@ -22,7 +22,7 @@ public class EidCcsUrl implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      if (authData instanceof IEidAuthData) {        final String bkuurl = ((IEidAuthData) authData).getVdaEndPointUrl(); @@ -30,7 +30,6 @@ public class EidCcsUrl implements IPvpAttributeBuilder {          return g.buildStringAttribute(EID_CCS_URL_FRIENDLY_NAME, EID_CCS_URL_NAME, bkuurl);        } -      } else {        log.info(EID_CCS_URL_FRIENDLY_NAME + " is only available in MOA-ID context");      } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidTokenBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidTokenBuilder.java index ccc2b4e8..be208e8e 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidTokenBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidTokenBuilder.java @@ -19,29 +19,29 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.Base64Utils; +  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IEidAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.Base64Utils;  @PvpMetadata  public class EidEidTokenBuilder implements IPvpAttributeBuilder {    private static final Logger log = LoggerFactory.getLogger(EidEidTokenBuilder.class); -    @Override    public String getName() {      return EID_E_ID_TOKEN_NAME;    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      if (authData instanceof IEidAuthData) { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidasQaaLevelAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidasQaaLevelAttributeBuilder.java index 858baf40..7d0d6a95 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidasQaaLevelAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidasQaaLevelAttributeBuilder.java @@ -19,11 +19,10 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; -  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  @PvpMetadata @@ -35,14 +34,13 @@ public class EidEidasQaaLevelAttributeBuilder implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      return g.buildStringAttribute(EID_CITIZEN_EIDAS_QAA_LEVEL_FRIENDLY_NAME,          EID_CITIZEN_EIDAS_QAA_LEVEL_NAME, authData.getEidasQaaLevel());    } -    @Override    public <ATT> ATT buildEmpty(final IAttributeGenerator<ATT> g) {      return g.buildEmptyAttribute(EID_CITIZEN_EIDAS_QAA_LEVEL_FRIENDLY_NAME, diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdAttributeBuilder.java index e828d11c..246f585c 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdAttributeBuilder.java @@ -19,18 +19,19 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; -import at.gv.egiz.eaaf.core.api.data.ExtendedPVPAttributeDefinitions; +import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions;  import at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData; -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.AttributeBuilderException;  public class EidEncryptedSourceIdAttributeBuilder -    implements IAttributeBuilder, ExtendedPVPAttributeDefinitions { +    implements IAttributeBuilder, ExtendedPvpAttributeDefinitions {    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator<ATT> g) +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData, +      final IAttributeGenerator<ATT> g)        throws AttributeBuilderException {      return g.buildStringAttribute(getFriendlyName(), getName(), authData.getEncryptedSourceId()); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdTypeAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdTypeAttributeBuilder.java index a1a245d1..3ffa6a14 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdTypeAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdTypeAttributeBuilder.java @@ -19,18 +19,19 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; -import at.gv.egiz.eaaf.core.api.data.ExtendedPVPAttributeDefinitions; +import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions;  import at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData; -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.AttributeBuilderException;  public class EidEncryptedSourceIdTypeAttributeBuilder -    implements IAttributeBuilder, ExtendedPVPAttributeDefinitions { +    implements IAttributeBuilder, ExtendedPvpAttributeDefinitions {    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator<ATT> g) +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData, +      final IAttributeGenerator<ATT> g)        throws AttributeBuilderException {      return g.buildStringAttribute(getFriendlyName(), getName(),          authData.getEncryptedSourceIdType()); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityLinkBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityLinkBuilder.java index 8f629795..b7249786 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityLinkBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityLinkBuilder.java @@ -20,29 +20,30 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;  import java.io.IOException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.Base64Utils; +  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.Base64Utils;  @Deprecated  @PvpMetadata  public class EidIdentityLinkBuilder implements IPvpAttributeBuilder {    private static final Logger log = LoggerFactory.getLogger(EidIdentityLinkBuilder.class); -    @Override    public String getName() {      return EID_IDENTITY_LINK_NAME;    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      try {        String ilAssertion = null; @@ -55,7 +56,6 @@ public class EidIdentityLinkBuilder implements IPvpAttributeBuilder {        return g.buildStringAttribute(EID_IDENTITY_LINK_FRIENDLY_NAME, EID_IDENTITY_LINK_NAME,            Base64Utils.encodeToString(ilAssertion.getBytes("UTF-8"))); -      } catch (final IOException e) {        log.warn("IdentityLink serialization error.", e);        return g.buildEmptyAttribute(EID_IDENTITY_LINK_FRIENDLY_NAME, EID_IDENTITY_LINK_NAME); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityStatusLevelAttributeBuiler.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityStatusLevelAttributeBuiler.java index 2f70e3e0..ee51564e 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityStatusLevelAttributeBuiler.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityStatusLevelAttributeBuiler.java @@ -7,7 +7,7 @@ import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IEidAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; @@ -22,7 +22,7 @@ public class EidIdentityStatusLevelAttributeBuiler implements IPvpAttributeBuild    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      if (authData instanceof IEidAuthData) { @@ -31,7 +31,7 @@ public class EidIdentityStatusLevelAttributeBuiler implements IPvpAttributeBuild        }        return g.buildStringAttribute(getFriendlyName(), getName(), -          ((IEidAuthData) authData).getEidStatus().getURI()); +          ((IEidAuthData) authData).getEidStatus().getUri());      } else {        log.info(getFriendlyName() + " is only available in EAAF context");      } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java index 04c2b379..fd85871c 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java @@ -19,12 +19,13 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; +import org.apache.commons.lang3.StringUtils; +  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException; -import org.apache.commons.lang3.StringUtils;  @PvpMetadata  public class EidIssuingNationAttributeBuilder implements IPvpAttributeBuilder { @@ -35,7 +36,7 @@ public class EidIssuingNationAttributeBuilder implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      final String countryCode = authData.getCiticenCountryCode();      if (StringUtils.isNotEmpty(countryCode)) { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSectorForIdAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSectorForIdAttributeBuilder.java index f5e37792..3aedf9ab 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSectorForIdAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSectorForIdAttributeBuilder.java @@ -19,13 +19,14 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; +import org.apache.commons.lang3.StringUtils; +  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; -import org.apache.commons.lang3.StringUtils;  @PvpMetadata  public class EidSectorForIdAttributeBuilder implements IPvpAttributeBuilder { @@ -36,7 +37,7 @@ public class EidSectorForIdAttributeBuilder implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      final String bpktype = authData.getBpkType(); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java index 8ba7f255..6f857779 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java @@ -19,17 +19,17 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.Base64Utils;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IEidAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.Base64Utils;  @PvpMetadata  public class EidSignerCertificate implements IPvpAttributeBuilder { @@ -41,7 +41,7 @@ public class EidSignerCertificate implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      if (authData instanceof IEidAuthData) { @@ -65,7 +65,6 @@ public class EidSignerCertificate implements IPvpAttributeBuilder {        log.info(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME + " is only available in AuthHandler context");      } -      throw new UnavailableAttributeException(EID_SIGNER_CERTIFICATE_NAME);    } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePin.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePin.java index fd2d51bb..591c176e 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePin.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePin.java @@ -19,14 +19,15 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; +import org.apache.commons.lang3.StringUtils; +  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.AttributePolicyException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; -import org.apache.commons.lang3.StringUtils;  @Deprecated  @PvpMetadata @@ -38,7 +39,7 @@ public class EidSourcePin implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      if (authData.isBaseIdTransferRestrication()) { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePinType.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePinType.java index 2a02fb05..4fba8d0a 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePinType.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePinType.java @@ -22,7 +22,7 @@ package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; @@ -36,7 +36,7 @@ public class EidSourcePinType implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      if (authData.isBaseIdTransferRestrication()) { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/GivenNameAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/GivenNameAttributeBuilder.java index bbd7a06c..46e22468 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/GivenNameAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/GivenNameAttributeBuilder.java @@ -19,13 +19,14 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; +import org.apache.commons.lang3.StringUtils; +  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; -import org.apache.commons.lang3.StringUtils;  @PvpMetadata  public class GivenNameAttributeBuilder implements IPvpAttributeBuilder { @@ -36,7 +37,7 @@ public class GivenNameAttributeBuilder implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      if (StringUtils.isNotEmpty(authData.getGivenName())) {        return g.buildStringAttribute(GIVEN_NAME_FRIENDLY_NAME, GIVEN_NAME_NAME, diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PrincipalNameAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PrincipalNameAttributeBuilder.java index bbe9b741..67451a07 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PrincipalNameAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PrincipalNameAttributeBuilder.java @@ -19,13 +19,14 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; +import org.apache.commons.lang3.StringUtils; +  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException; -import org.apache.commons.lang3.StringUtils;  @PvpMetadata  public class PrincipalNameAttributeBuilder implements IPvpAttributeBuilder { @@ -36,7 +37,7 @@ public class PrincipalNameAttributeBuilder implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      if (StringUtils.isNotEmpty(authData.getFamilyName())) {        return g.buildStringAttribute(PRINCIPAL_NAME_FRIENDLY_NAME, PRINCIPAL_NAME_NAME, diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PvpVersionAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PvpVersionAttributeBuilder.java index 5ff68721..204f1c45 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PvpVersionAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PvpVersionAttributeBuilder.java @@ -22,7 +22,7 @@ package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.idp.IPvpAttributeBuilder; -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.AttributeBuilderException;  @PvpMetadata @@ -34,7 +34,7 @@ public class PvpVersionAttributeBuilder implements IPvpAttributeBuilder {    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData,        final IAttributeGenerator<ATT> g) throws AttributeBuilderException {      return g.buildStringAttribute(PVP_VERSION_FRIENDLY_NAME, PVP_VERSION_NAME, PVP_VERSION_2_1);    } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpCountryCodeAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpCountryCodeAttributeBuilder.java index 86cb1dcc..fe05b28d 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpCountryCodeAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpCountryCodeAttributeBuilder.java @@ -19,15 +19,15 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; -import at.gv.egiz.eaaf.core.api.data.ExtendedPVPAttributeDefinitions; +import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions;  import at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData; -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.AttributeBuilderException;  public class SpCountryCodeAttributeBuilder -    implements IAttributeBuilder, ExtendedPVPAttributeDefinitions { +    implements IAttributeBuilder, ExtendedPvpAttributeDefinitions {    @Override    public String getName() { @@ -35,7 +35,8 @@ public class SpCountryCodeAttributeBuilder    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator<ATT> g) +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData, +      final IAttributeGenerator<ATT> g)        throws AttributeBuilderException {      // this attribute can not generated yet      return null; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpFriendlyNameAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpFriendlyNameAttributeBuilder.java index 4b905690..37102fc5 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpFriendlyNameAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpFriendlyNameAttributeBuilder.java @@ -19,15 +19,15 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; -import at.gv.egiz.eaaf.core.api.data.ExtendedPVPAttributeDefinitions; +import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions;  import at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData; -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.AttributeBuilderException;  public class SpFriendlyNameAttributeBuilder -    implements IAttributeBuilder, ExtendedPVPAttributeDefinitions { +    implements IAttributeBuilder, ExtendedPvpAttributeDefinitions {    @Override    public String getName() { @@ -35,7 +35,8 @@ public class SpFriendlyNameAttributeBuilder    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator<ATT> g) +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData, +      final IAttributeGenerator<ATT> g)        throws AttributeBuilderException {      return g.buildStringAttribute(SP_FRIENDLYNAME_FRIENDLY_NAME, SP_FRIENDLYNAME_NAME,          oaParam.getFriendlyName()); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUniqueIdAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUniqueIdAttributeBuilder.java index 47e5e8ce..760dbbe5 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUniqueIdAttributeBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUniqueIdAttributeBuilder.java @@ -19,15 +19,15 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; -import at.gv.egiz.eaaf.core.api.data.ExtendedPVPAttributeDefinitions; +import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions;  import at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData; -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.AttributeBuilderException;  public class SpUniqueIdAttributeBuilder -    implements IAttributeBuilder, ExtendedPVPAttributeDefinitions { +    implements IAttributeBuilder, ExtendedPvpAttributeDefinitions {    @Override    public String getName() { @@ -35,7 +35,8 @@ public class SpUniqueIdAttributeBuilder    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator<ATT> g) +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData, +      final IAttributeGenerator<ATT> g)        throws AttributeBuilderException {      return g.buildStringAttribute(SP_UNIQUEID_FRIENDLY_NAME, SP_UNIQUEID_NAME,          oaParam.getUniqueIdentifier()); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUsesMandates.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUsesMandates.java index ce717862..44ff4e50 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUsesMandates.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUsesMandates.java @@ -19,14 +19,14 @@  package at.gv.egiz.eaaf.core.impl.idp.builder.attributes; -import at.gv.egiz.eaaf.core.api.data.ExtendedPVPAttributeDefinitions; +import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions;  import at.gv.egiz.eaaf.core.api.idp.IAttributeBuilder;  import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;  import at.gv.egiz.eaaf.core.api.idp.IAuthData; -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.AttributeBuilderException; -public class SpUsesMandates implements IAttributeBuilder, ExtendedPVPAttributeDefinitions { +public class SpUsesMandates implements IAttributeBuilder, ExtendedPvpAttributeDefinitions {    @Override    public String getName() { @@ -34,7 +34,8 @@ public class SpUsesMandates implements IAttributeBuilder, ExtendedPVPAttributeDe    }    @Override -  public <ATT> ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator<ATT> g) +  public <ATT> ATT build(final ISpConfiguration oaParam, final IAuthData authData, +      final IAttributeGenerator<ATT> g)        throws AttributeBuilderException {      // this attribute can not generated yet      return null; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractConfigurationImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractConfigurationImpl.java index e661a2a8..d279446b 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractConfigurationImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractConfigurationImpl.java @@ -27,13 +27,15 @@ import java.net.URI;  import java.net.URISyntaxException;  import java.util.Map;  import java.util.Properties; -import at.gv.egiz.eaaf.core.api.idp.IExtendedConfiguration; -import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; -import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; +  import org.apache.commons.lang3.StringUtils;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; +import at.gv.egiz.eaaf.core.api.idp.IExtendedConfiguration; +import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; +import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; +  public abstract class AbstractConfigurationImpl implements IExtendedConfiguration {    private static final Logger log = LoggerFactory.getLogger(AbstractConfigurationImpl.class); @@ -72,7 +74,6 @@ public abstract class AbstractConfigurationImpl implements IExtendedConfiguratio        log.info("Load EAAFCore configuration from " + internalConfigPath); -        // extract configuration root directory        // TODO: check if it works with classpath        final File propertiesFile = new File(internalConfigPath); @@ -86,7 +87,6 @@ public abstract class AbstractConfigurationImpl implements IExtendedConfiguratio        configRootDirectory = new File(configDir).toURI();        log.debug("Set EAAFCore configuration root directory to " + configRootDirectory.toString()); -        // get input stream from configuration path        if (internalConfigPath.getScheme().equals(URI_SCHEME_FILESYSTEM)) {          log.trace("Load config from filesystem"); @@ -99,19 +99,16 @@ public abstract class AbstractConfigurationImpl implements IExtendedConfiguratio        } else {          log.error(              "Can not load EAAFCore configuration. Unsupported prefix! (Only 'file:' and 'classpath:')  "); -        throw new EaafConfigurationException("config.24", -            new Object[] {internalConfigPath, "'file:'"}); +        throw new EaafConfigurationException("config.24", new Object[] { internalConfigPath, "'file:'" });        }        if (is == null) {          log.error("Can NOT load EAAFCore configuration from file " + internalConfigPath.toString()); -        throw new EaafConfigurationException("config.03", -            new Object[] {internalConfigPath.toString()}); +        throw new EaafConfigurationException("config.03", new Object[] { internalConfigPath.toString() });        } -        // load EAAF core configuration into properties object        properties = new Properties();        properties.load(is); @@ -120,8 +117,9 @@ public abstract class AbstractConfigurationImpl implements IExtendedConfiguratio      } catch (URISyntaxException | IOException e) {        log.error("Can not parse configuration path " + configPath + " or " + getBackupConfigPath()); -      throw new EaafConfigurationException("config.03", -          new Object[] {configPath + " or " + getBackupConfigPath()}, e); +      throw new EaafConfigurationException("config.03", new Object[] { configPath + " or " +          + getBackupConfigPath() }, +          e);      } finally {        if (is != null) { @@ -161,24 +159,17 @@ public abstract class AbstractConfigurationImpl implements IExtendedConfiguratio      return defaultValue;    } -    @Override    public boolean getBasicConfigurationBoolean(final String key) { -    final String value = getBasicConfiguration(key); -    if (value != null) { -      return Boolean.parseBoolean(value); -    } else { -      return false; -    } +    return getBasicConfigurationBoolean(key, false);    } -    @Override    public boolean getBasicConfigurationBoolean(final String key, final boolean defaultValue) { -    final Boolean result = getBasicConfigurationBoolean(key); -    if (result != null) { -      return result; +    final String value = getBasicConfiguration(key); +    if (value != null) { +      return Boolean.parseBoolean(value);      } else {        return defaultValue;      } @@ -187,8 +178,8 @@ public abstract class AbstractConfigurationImpl implements IExtendedConfiguratio    @Override    public Map<String, String> getBasicConfigurationWithPrefix(final String prefix) { -    return KeyValueUtils.getSubSetWithPrefix(KeyValueUtils.convertPropertiesToMap(properties), -        addPrefixToKey(prefix)); +    return KeyValueUtils.getSubSetWithPrefix(KeyValueUtils.convertPropertiesToMap(properties), addPrefixToKey( +        prefix));    } @@ -224,7 +215,6 @@ public abstract class AbstractConfigurationImpl implements IExtendedConfiguratio     */    public abstract String getApplicationSpecificKeyPrefix(); -    private String addPrefixToKey(final String key) {      if (StringUtils.isNotEmpty(getApplicationSpecificKeyPrefix())) {        if (getApplicationSpecificKeyPrefix().endsWith(KeyValueUtils.KEY_DELIMITER)) { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractSpringBootConfigurationImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractSpringBootConfigurationImpl.java index 3a6cc67d..1c7806ef 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractSpringBootConfigurationImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/AbstractSpringBootConfigurationImpl.java @@ -25,10 +25,9 @@ import java.util.Arrays;  import java.util.HashMap;  import java.util.Map;  import java.util.Map.Entry; +  import javax.annotation.PostConstruct; -import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP; -import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; -import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; +  import org.apache.commons.lang3.StringUtils;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; @@ -39,9 +38,12 @@ import org.springframework.core.env.EnumerablePropertySource;  import org.springframework.core.env.Environment;  import org.springframework.core.env.PropertySource; +import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP; +import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; +import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; +  public abstract class AbstractSpringBootConfigurationImpl implements IConfigurationWithSP { -  private static final Logger log = -      LoggerFactory.getLogger(AbstractSpringBootConfigurationImpl.class); +  private static final Logger log = LoggerFactory.getLogger(AbstractSpringBootConfigurationImpl.class);    @Autowired    private Environment env; @@ -51,8 +53,8 @@ public abstract class AbstractSpringBootConfigurationImpl implements IConfigurat    @PostConstruct    private void initialize() throws EaafConfigurationException {      if (getConfigurationRootDirectory() == null) { -      throw new EaafConfigurationException("config.08", -          new Object[] {addPrefixToKey(PROP_CONFIG_ROOT_DIR)}); +      throw new EaafConfigurationException("config.08", new Object[] { addPrefixToKey( +          PROP_CONFIG_ROOT_DIR) });      } @@ -84,28 +86,23 @@ public abstract class AbstractSpringBootConfigurationImpl implements IConfigurat    @Override    public Map<String, String> getBasicConfigurationWithPrefix(final String prefix) { -    final Map<String, String> configProps = -        getPropertiesStartingWith((ConfigurableEnvironment) env, addPrefixToKey(prefix)); +    final Map<String, String> configProps = getPropertiesStartingWith((ConfigurableEnvironment) env, +        addPrefixToKey(prefix));      return KeyValueUtils.removePrefixFromKeys(configProps, addPrefixToKey(prefix) + "."); -    }    @Override    public boolean getBasicConfigurationBoolean(final String key) { -    final String value = getBasicConfiguration(key); -    if (StringUtils.isNotEmpty(value)) { -      return Boolean.valueOf(value.trim()); -    } else { -      return false; -    } +    return getBasicConfigurationBoolean(key, false); +    }    @Override    public boolean getBasicConfigurationBoolean(final String key, final boolean defaultValue) { -    final Boolean value = getBasicConfigurationBoolean(key); -    if (value != null) { -      return value; +    final String value = getBasicConfiguration(key); +    if (StringUtils.isNotEmpty(value)) { +      return Boolean.valueOf(value.trim());      } else {        return defaultValue;      } @@ -124,7 +121,6 @@ public abstract class AbstractSpringBootConfigurationImpl implements IConfigurat    } -    /**     * Get the path to backup configuration.     * @@ -139,7 +135,6 @@ public abstract class AbstractSpringBootConfigurationImpl implements IConfigurat     */    public abstract String getApplicationSpecificKeyPrefix(); -    private String addPrefixToKey(final String key) {      if (StringUtils.isNotEmpty(getApplicationSpecificKeyPrefix())) {        if (getApplicationSpecificKeyPrefix().endsWith(KeyValueUtils.KEY_DELIMITER)) { @@ -192,7 +187,8 @@ public abstract class AbstractSpringBootConfigurationImpl implements IConfigurat        return result;      } -    // note: Most descendants of PropertySource are EnumerablePropertySource. There are some +    // note: Most descendants of PropertySource are EnumerablePropertySource. There +    // are some      // few others like JndiPropertySource or StubPropertySource      log.debug("Given PropertySource is instanceof " + apropSource.getClass().getName()          + " and cannot be iterated"); @@ -201,8 +197,7 @@ public abstract class AbstractSpringBootConfigurationImpl implements IConfigurat    } -  private static void addAll(final Map<String, Object> abase, -      final Map<String, Object> atoBeAdded) { +  private static void addAll(final Map<String, Object> abase, final Map<String, Object> atoBeAdded) {      for (final Entry<String, Object> entry : atoBeAdded.entrySet()) {        if (abase.containsKey(entry.getKey())) {          continue; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SpConfigurationImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SpConfigurationImpl.java index 07284cd3..de54d103 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SpConfigurationImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SpConfigurationImpl.java @@ -22,15 +22,17 @@ package at.gv.egiz.eaaf.core.impl.idp.conf;  import java.util.Collections;  import java.util.List;  import java.util.Map; -import at.gv.egiz.eaaf.core.api.data.EAAFConfigConstants; -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.impl.utils.KeyValueUtils; +  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; -public class SpConfigurationImpl implements IspConfiguration { +import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants; +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.impl.utils.KeyValueUtils; + +public class SpConfigurationImpl implements ISpConfiguration {    private static final long serialVersionUID = 688541755446463453L;    private static final Logger log = LoggerFactory.getLogger(SpConfigurationImpl.class); @@ -42,7 +44,7 @@ public class SpConfigurationImpl implements IspConfiguration {    /**     * Service-provider configuration holder.     * -   * @param spConfig Key/value based configuration +   * @param spConfig   Key/value based configuration     * @param authConfig Basic application configuration     */    public SpConfigurationImpl(final Map<String, String> spConfig, final IConfiguration authConfig) { @@ -51,11 +53,11 @@ public class SpConfigurationImpl implements IspConfiguration {      // set oa specific restrictions      targetAreasWithNoInteralBaseIdRestriction = Collections          .unmodifiableList(KeyValueUtils.getListOfCsvValues(authConfig.getBasicConfiguration( -            CONFIG_KEY_RESTRICTIONS_BASEID_INTERNAL, EAAFConstants.URN_PREFIX_CDID))); +            CONFIG_KEY_RESTRICTIONS_BASEID_INTERNAL, EaafConstants.URN_PREFIX_CDID)));      targetAreasWithNoBaseIdTransmissionRestriction = Collections          .unmodifiableList(KeyValueUtils.getListOfCsvValues(authConfig.getBasicConfiguration( -            CONFIG_KEY_RESTRICTIONS_BASEID_TRANSMISSION, EAAFConstants.URN_PREFIX_CDID))); +            CONFIG_KEY_RESTRICTIONS_BASEID_TRANSMISSION, EaafConstants.URN_PREFIX_CDID)));      if (log.isTraceEnabled()) {        log.trace("Internal policy for OA: " + getUniqueIdentifier()); @@ -69,7 +71,6 @@ public class SpConfigurationImpl implements IspConfiguration {      }    } -    @Override    public final Map<String, String> getFullConfiguration() {      return this.spConfiguration; @@ -96,19 +97,12 @@ public class SpConfigurationImpl implements IspConfiguration {      }    } -    @Override    public final boolean isConfigurationValue(final String key) { -    final String value = getConfigurationValue(key); -    if (value != null) { -      return Boolean.parseBoolean(value); - -    } +    return isConfigurationValue(key, false); -    return false;    } -    @Override    public final boolean isConfigurationValue(final String key, final boolean defaultValue) {      final String value = getConfigurationValue(key); @@ -132,7 +126,7 @@ public class SpConfigurationImpl implements IspConfiguration {    @Override    public String getUniqueIdentifier() { -    return getConfigurationValue(EAAFConfigConstants.SERVICE_UNIQUEIDENTIFIER); +    return getConfigurationValue(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER);    } @@ -148,19 +142,16 @@ public class SpConfigurationImpl implements IspConfiguration {    } -    @Override    public final List<String> getTargetsWithNoBaseIdInternalProcessingRestriction() {      return this.targetAreasWithNoInteralBaseIdRestriction;    } -    @Override    public final List<String> getTargetsWithNoBaseIdTransferRestriction() {      return this.targetAreasWithNoBaseIdTransmissionRestriction;    } -    @Override    public List<String> getRequiredLoA() {      log.warn( @@ -182,7 +173,6 @@ public class SpConfigurationImpl implements IspConfiguration {      return null;    } -    @Override    public String getFriendlyName() {      log.warn( diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java index b15dfeba..c09efc37 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/AbstractController.java @@ -20,12 +20,21 @@  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 org.springframework.context.ApplicationContext; +import org.springframework.web.bind.annotation.ExceptionHandler; +  import at.gv.egiz.components.eventlog.api.EventConstants;  import at.gv.egiz.eaaf.core.api.IRequest;  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.data.ExceptionContainer;  import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;  import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService; @@ -37,13 +46,6 @@ import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException;  import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;  import at.gv.egiz.eaaf.core.impl.utils.Random;  import at.gv.egiz.eaaf.core.impl.utils.ServletUtils; -import org.apache.commons.text.StringEscapeUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.web.bind.annotation.ExceptionHandler; -  /**   * Basic application controller that implements core error-handling. @@ -72,16 +74,16 @@ public abstract class AbstractController {    /**     * EAAF framework exception handler.     * -   *<p> -   *This handler start a protocol-specific error handling. -   *</p> +   * <p> +   * This handler start a protocol-specific error handling. +   * </p>     * -   * @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     * </p>     * -   * @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     * </p>     * -   * @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     *     * <p/> -   * 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<String, Object> genericDataStorage = new HashMap<>(); -    /**     * Initialize this pendingRequest object.     * -   * @param req {@link HttpServletRequest} +   * @param req        {@link HttpServletRequest}     * @param authConfig {@link IConfiguration}     * @throws EaafException     * @@ -107,10 +109,10 @@ public abstract class RequestImpl implements IRequest, Serializable {    /**     * Initialize this pendingRequest object.     * -   * @param req {@link HttpServletRequest} -   * @param authConfig {@link IConfiguration} -   * @param transactionId transactionId that should be used in this pendingRequest for logging. If -   *        'null' a new one will be generated +   * @param req           {@link HttpServletRequest} +   * @param authConfig    {@link IConfiguration} +   * @param transactionId transactionId that should be used in this pendingRequest +   *                      for logging. If 'null' a new one will be generated     *     * @throws EaafException     * @@ -129,8 +131,9 @@ public abstract class RequestImpl implements IRequest, Serializable {      TransactionIdUtils.setTransactionId(uniqueTransactionIdentifer);      // initialize session object -    genericDataStorage.put(EAAFConstants.AUTH_DATA_CREATED, new Date()); -    // genericDataStorage.put(EAAFConstants.VALUE_SESSIONID, Random.nextLongRandom()); +    genericDataStorage.put(EaafConstants.AUTH_DATA_CREATED, new Date()); +    // genericDataStorage.put(EAAFConstants.VALUE_SESSIONID, +    // Random.nextLongRandom());      // check if End-Point is valid      final String authUrlString = HttpUtils.extractAuthUrlFromRequest(req); @@ -140,19 +143,19 @@ public abstract class RequestImpl implements IRequest, Serializable {      } catch (final MalformedURLException e) {        log.error("IDP AuthenticationServiceURL Prefix is not a valid URL." + authUrlString, e); -      throw new EaafAuthenticationException("errorId", new Object[] {authUrlString}, e); +      throw new EaafAuthenticationException("errorId", new Object[] { authUrlString }, e);      }      this.idpAuthUrl = authConfig.validateIdpUrl(authReqUrl);      if (this.idpAuthUrl == null) {        log.warn(            "Extract AuthenticationServiceURL: " + authReqUrl + " is NOT found in configuration."); -      throw new EaafAuthenticationException("errorId", new Object[] {authUrlString}); +      throw new EaafAuthenticationException("errorId", new Object[] { authUrlString });      }      // set unique session identifier -    final String uniqueID = (String) req.getAttribute(EAAFConstants.UNIQUESESSIONIDENTIFIER); +    final String uniqueID = (String) req.getAttribute(EaafConstants.UNIQUESESSIONIDENTIFIER);      if (StringUtils.isNotEmpty(uniqueID)) {        this.uniqueSessionIdentifer = uniqueID;      } else { @@ -267,10 +270,9 @@ public abstract class RequestImpl implements IRequest, Serializable {    }    @Override -  public final IspConfiguration getServiceProviderConfiguration() { +  public final ISpConfiguration getServiceProviderConfiguration() {      return this.spConfiguration; -    }    @Override @@ -291,7 +293,7 @@ public abstract class RequestImpl implements IRequest, Serializable {    } -  public void setOnlineApplicationConfiguration(final IspConfiguration spConfig) { +  public void setOnlineApplicationConfiguration(final ISpConfiguration spConfig) {      this.spConfiguration = spConfig;    } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/AbstractLocaleAuthServletTask.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/AbstractLocaleAuthServletTask.java index 3c8fd604..dcd5a1d1 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/AbstractLocaleAuthServletTask.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/AbstractLocaleAuthServletTask.java @@ -10,8 +10,8 @@ import org.apache.commons.text.StringEscapeUtils;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; -import at.gv.egiz.eaaf.core.api.data.EAAFConstants; -import at.gv.egiz.eaaf.core.api.data.EAAFEventCodes; +import at.gv.egiz.eaaf.core.api.data.EaafConstants; +import at.gv.egiz.eaaf.core.api.data.EaafEventCodes;  import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;  import at.gv.egiz.eaaf.core.exceptions.EaafException;  import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; @@ -28,22 +28,20 @@ public abstract class AbstractLocaleAuthServletTask extends AbstractAuthServletT        throws TaskExecutionException {      final Serializable changeLangFlag = -        executionContext.get(EAAFConstants.PROCESSCONTEXT_SWITCH_LANGUAGE); +        executionContext.get(EaafConstants.PROCESSCONTEXT_SWITCH_LANGUAGE);      final String localeParam =          StringEscapeUtils.escapeHtml4(request.getParameter(PROP_REQ_PARAM_LOCALE));      if (StringUtils.isNotEmpty(localeParam)          && (changeLangFlag == null || !((Boolean) changeLangFlag))) {        log.debug("Find {} parameter. Reload last task with new locale: {}", PROP_REQ_PARAM_LOCALE,            localeParam); -      executionContext.put(EAAFConstants.PROCESSCONTEXT_SWITCH_LANGUAGE, true); - - +      executionContext.put(EaafConstants.PROCESSCONTEXT_SWITCH_LANGUAGE, true);      } else {        log.trace("Find {} parameter. Processing this task ... ", PROP_REQ_PARAM_LOCALE); -      executionContext.put(EAAFConstants.PROCESSCONTEXT_SWITCH_LANGUAGE, false); +      executionContext.put(EaafConstants.PROCESSCONTEXT_SWITCH_LANGUAGE, false); -      if (parseFlagFromHttpRequest(request, EAAFConstants.PARAM_HTTP_STOP_PROCESS, false)) { +      if (parseFlagFromHttpRequest(request, EaafConstants.PARAM_HTTP_STOP_PROCESS, false)) {          log.info("Authentication process WAS stopped by entity. Stopping auth. process ... ");          stopProcessFromUserDecision(executionContext, request, response); @@ -59,7 +57,7 @@ public abstract class AbstractLocaleAuthServletTask extends AbstractAuthServletT        final HttpServletRequest request, final HttpServletResponse response)        throws TaskExecutionException {      try { -      revisionsLogger.logEvent(pendingReq, EAAFEventCodes.PROCESS_STOPPED_BY_USER); +      revisionsLogger.logEvent(pendingReq, EaafEventCodes.PROCESS_STOPPED_BY_USER);        pendingReq.setAbortedByUser(true);        pendingReq.setAuthenticated(false);        performRedirectToProtocolFinialization(executionContext, pendingReq, request, response); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/FinalizeAuthenticationTask.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/FinalizeAuthenticationTask.java index 7991c093..892121c0 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/FinalizeAuthenticationTask.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/FinalizeAuthenticationTask.java @@ -21,15 +21,17 @@ package at.gv.egiz.eaaf.core.impl.idp.controller.tasks;  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse; -import at.gv.egiz.eaaf.core.api.data.EAAFConstants; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import at.gv.egiz.eaaf.core.api.data.EaafConstants;  import at.gv.egiz.eaaf.core.api.idp.auth.IAuthenticationManager;  import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;  import at.gv.egiz.eaaf.core.exceptions.EaafException;  import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;  import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component;  /**   * Finalize the authentication process-flow. @@ -45,9 +47,9 @@ public class FinalizeAuthenticationTask extends AbstractAuthServletTask {    /*     * (non-Javadoc)     * -   * @see -   * at.gv.egovernment.moa.id.process.springweb.MoaIdTask#execute(at.gv.egovernment.moa.id.process. -   * api.ExecutionContext, javax.servlet.http.HttpServletRequest, +   * @see at.gv.egovernment.moa.id.process.springweb.MoaIdTask#execute(at.gv. +   * egovernment.moa.id.process. api.ExecutionContext, +   * javax.servlet.http.HttpServletRequest,     * javax.servlet.http.HttpServletResponse)     */    @Override @@ -61,7 +63,6 @@ public class FinalizeAuthenticationTask extends AbstractAuthServletTask {            IAuthenticationManager.EVENT_AUTHENTICATION_PROCESS_FINISHED);        performRedirectToProtocolFinialization(executionContext, pendingReq, request, response); -      } catch (final EaafException e) {        throw new TaskExecutionException(pendingReq, e.getMessage(), e); @@ -70,7 +71,7 @@ public class FinalizeAuthenticationTask extends AbstractAuthServletTask {        throw new TaskExecutionException(pendingReq, e.getMessage(), e);      } finally { -      executionContext.remove(EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID); +      executionContext.remove(EaafConstants.PROCESS_ENGINE_PENDINGREQUESTID);      } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java index 7a2c5f08..328a25c5 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/tasks/RestartAuthProzessManagement.java @@ -20,8 +20,15 @@  package at.gv.egiz.eaaf.core.impl.idp.controller.tasks;  import java.util.Set; +  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +  import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;  import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine;  import at.gv.egiz.eaaf.core.exceptions.EaafException; @@ -30,10 +37,6 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask;  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 org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component;  /**   * Restart the authentication process-flow. @@ -45,15 +48,17 @@ import org.springframework.stereotype.Component;  public class RestartAuthProzessManagement extends AbstractAuthServletTask {    private static final Logger log = LoggerFactory.getLogger(RestartAuthProzessManagement.class); -  @Autowired ProcessEngine processEngine; -  @Autowired ModuleRegistration moduleRegistration; +  @Autowired +  ProcessEngine processEngine; +  @Autowired +  ModuleRegistration moduleRegistration;    /*     * (non-Javadoc)     * -   * @see -   * at.gv.egovernment.moa.id.process.springweb.MoaIdTask#execute(at.gv.egovernment.moa.id.process. -   * api.ExecutionContext, javax.servlet.http.HttpServletRequest, +   * @see at.gv.egovernment.moa.id.process.springweb.MoaIdTask#execute(at.gv. +   * egovernment.moa.id.process. api.ExecutionContext, +   * javax.servlet.http.HttpServletRequest,     * javax.servlet.http.HttpServletResponse)     */    @Override @@ -82,7 +87,7 @@ public class RestartAuthProzessManagement extends AbstractAuthServletTask {          if (processDefinitionId == null) {            log.warn("No suitable authentication process found for SessionID "                + pendingReq.getPendingRequestId()); -          throw new EaafException("process.02", new Object[] {pendingReq.getPendingRequestId()}); +          throw new EaafException("process.02", new Object[] { pendingReq.getPendingRequestId() });          }          final String processInstanceId = diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExecutionContextImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExecutionContextImpl.java index 619911c1..27bc829d 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExecutionContextImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExecutionContextImpl.java @@ -24,6 +24,7 @@ import java.util.Collections;  import java.util.HashMap;  import java.util.Map;  import java.util.Set; +  import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;  /** diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExpressionEvaluationContextImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExpressionEvaluationContextImpl.java index 72ad456f..67604a03 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExpressionEvaluationContextImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ExpressionEvaluationContextImpl.java @@ -24,6 +24,7 @@ import java.util.Collections;  import java.util.HashMap;  import java.util.Map;  import java.util.Set; +  import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;  import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext; @@ -40,7 +41,8 @@ public class ExpressionEvaluationContextImpl implements ExpressionEvaluationCont    private final Map<String, Serializable> ctxData;    /** -   * Creates a new instance and initializes it with data from a given process instance. +   * Creates a new instance and initializes it with data from a given process +   * instance.     *     * @param processInstance The process instance.     */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParser.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParser.java index 63ae66d5..c693b87e 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParser.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParser.java @@ -25,6 +25,7 @@ import java.util.ArrayList;  import java.util.Iterator;  import java.util.List;  import java.util.Objects; +  import javax.xml.XMLConstants;  import javax.xml.namespace.QName;  import javax.xml.stream.XMLEventReader; @@ -40,19 +41,21 @@ import javax.xml.transform.stream.StreamSource;  import javax.xml.validation.Schema;  import javax.xml.validation.SchemaFactory;  import javax.xml.validation.Validator; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.SAXException; +  import at.gv.egiz.eaaf.core.impl.idp.process.model.EndEvent;  import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessDefinition;  import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessNode;  import at.gv.egiz.eaaf.core.impl.idp.process.model.StartEvent;  import at.gv.egiz.eaaf.core.impl.idp.process.model.TaskInfo;  import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.xml.sax.SAXException;  /** - * Parses an XML representation of a process definition as defined by the respective XML schema. - * The parser is thread-safe. + * Parses an XML representation of a process definition as defined by the + * respective XML schema. The parser is thread-safe.   *   * @author tknall   * @@ -81,13 +84,13 @@ public class ProcessDefinitionParser {    }    /** -   * Parses an XML representation of a process definition. The representation is being validated in -   * order to suffice the related XML schema. +   * Parses an XML representation of a process definition. The representation is +   * being validated in order to suffice the related XML schema.     *     * @param processDefinitionInputStream The process definition.     * @return A new process definition. -   * @throws ProcessDefinitionParserException Thrown in case of error parsing the process -   *         definition. +   * @throws ProcessDefinitionParserException Thrown in case of error parsing the +   *                                          process definition.     */    public ProcessDefinition parse(final InputStream processDefinitionInputStream)        throws ProcessDefinitionParserException { @@ -232,7 +235,7 @@ public class ProcessDefinitionParser {              && Objects.equals(transition.getFrom(), transition.getTo())) {            throw new ProcessDefinitionParserException(                "Transition's 'from' equals its 'to'. Since no 'conditionExpression' " -              + "has been set this will cause a loop."); +                  + "has been set this will cause a loop.");          }        }        log.debug("Process definition '{}' successfully parsed.", pd.getId()); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParserException.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParserException.java index 472d6469..d7d4928c 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParserException.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessDefinitionParserException.java @@ -30,18 +30,19 @@ public class ProcessDefinitionParserException extends Exception {    private static final long serialVersionUID = 1L;    /** -   * Creates a new parser exception providing a {@code message} describing the reason and the -   * {@code cause}. +   * Creates a new parser exception providing a {@code message} describing the +   * reason and the {@code cause}.     *     * @param message The message. -   * @param cause The cause. +   * @param cause   The cause.     */    public ProcessDefinitionParserException(final String message, final Throwable cause) {      super(message, cause);    }    /** -   * Creates a new parser exception providing a {@code message} describing the reason. +   * Creates a new parser exception providing a {@code message} describing the +   * reason.     *     * @param message The message.     */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java index fefcf331..9274ea81 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessEngineImpl.java @@ -25,8 +25,17 @@ import java.util.HashMap;  import java.util.Map;  import java.util.Map.Entry;  import java.util.concurrent.ConcurrentHashMap; + +import org.apache.commons.collections4.IterableUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +  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.process.ExecutionContext;  import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluationContext;  import at.gv.egiz.eaaf.core.api.idp.process.ExpressionEvaluator; @@ -42,17 +51,10 @@ import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessNode;  import at.gv.egiz.eaaf.core.impl.idp.process.model.StartEvent;  import at.gv.egiz.eaaf.core.impl.idp.process.model.TaskInfo;  import at.gv.egiz.eaaf.core.impl.idp.process.model.Transition; -import org.apache.commons.collections4.IterableUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext;  /** - * Process engine implementation allowing starting and continuing processes as well as providing - * means for cleanup actions. + * Process engine implementation allowing starting and continuing processes as + * well as providing means for cleanup actions.   */  public class ProcessEngineImpl implements ProcessEngine { @@ -93,8 +95,8 @@ public class ProcessEngineImpl implements ProcessEngine {     * Sets the process definitions.     *     * @param processDefinitions The process definitions. -   * @throws IllegalArgumentException In case the process definitions contain definitions with the -   *         same identifier. +   * @throws IllegalArgumentException In case the process definitions contain +   *                                  definitions with the same identifier.     */    public void setProcessDefinitions(final Iterable<ProcessDefinition> processDefinitions) {      this.processDefinitions.clear(); @@ -108,7 +110,8 @@ public class ProcessEngineImpl implements ProcessEngine {    }    /** -   * Sets an expression evaluator that should be used to process transition condition expressions. +   * Sets an expression evaluator that should be used to process transition +   * condition expressions.     *     * @param transitionConditionExpressionEvaluator The expression evaluator.     */ @@ -117,7 +120,6 @@ public class ProcessEngineImpl implements ProcessEngine {      this.transitionConditionExpressionEvaluator = transitionConditionExpressionEvaluator;    } -    @Override    public String createProcessInstance(final String processDefinitionId,        final ExecutionContext executionContext) throws ProcessExecutionException { @@ -220,7 +222,7 @@ public class ProcessEngineImpl implements ProcessEngine {        pi.setState(ProcessInstanceState.STARTED);        // put pending-request ID on execution-context because it could be changed -      pi.getExecutionContext().put(EAAFConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID, +      pi.getExecutionContext().put(EaafConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID,            pendingReq.getPendingRequestId());        execute(pi, pendingReq); @@ -238,15 +240,15 @@ public class ProcessEngineImpl implements ProcessEngine {      }    } -    /**     * Instantiates a task implementation given by a {@link TaskInfo}.     *     * @param ti The task info. -   * @return A Task implementation or {@code null} if the task info does not reference any task -   *         implementing classes. -   * @throws ProcessExecutionException Thrown in case of error (when the referenced class does not -   *         implement {@link Task} for instance). +   * @return A Task implementation or {@code null} if the task info does not +   *         reference any task implementing classes. +   * @throws ProcessExecutionException Thrown in case of error (when the +   *                                   referenced class does not implement +   *                                   {@link Task} for instance).     */    private Task createTaskInstance(final TaskInfo ti) throws ProcessExecutionException {      final String clazz = StringUtils.trimToNull(ti.getTaskImplementingClass()); @@ -283,7 +285,7 @@ public class ProcessEngineImpl implements ProcessEngine {    /**     * Starts/executes a given process instance.     * -   * @param pi The process instance. +   * @param pi         The process instance.     * @param pendingReq current pending request     * @throws ProcessExecutionException Thrown in case of error.     */ @@ -404,7 +406,8 @@ public class ProcessEngineImpl implements ProcessEngine {     * Persists a {@link ProcessInstance} to the database.     *     * @param processInstance The object to persist. -   * @throws MOADatabaseException Thrown if an error occurs while accessing the database. +   * @throws MOADatabaseException Thrown if an error occurs while accessing the +   *                              database.     */    private void saveOrUpdateProcessInstance(final ProcessInstance processInstance)        throws EaafException { @@ -431,9 +434,10 @@ public class ProcessEngineImpl implements ProcessEngine {     * Load a {@link ProcessInstance} with a certain id from the database.     *     * @param processInstanceId The process instance id -   * @return The process instance corresponding to the id or {@code null} if no such object is -   *         found. -   * @throws MOADatabaseException Thrown if an error occurs while accessing the database. +   * @return The process instance corresponding to the id or {@code null} if no +   *         such object is found. +   * @throws MOADatabaseException Thrown if an error occurs while accessing the +   *                              database.     */    private ProcessInstance loadProcessInstance(final String processInstanceId) throws EaafException { @@ -462,7 +466,9 @@ public class ProcessEngineImpl implements ProcessEngine {    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.process.ProcessEngine#deleteProcessInstance(java.lang.String) +   * @see +   * at.gv.egovernment.moa.id.process.ProcessEngine#deleteProcessInstance(java. +   * lang.String)     */    @Override    public void deleteProcessInstance(final String processInstanceId) diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstance.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstance.java index 69683529..f3ec6b2d 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstance.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstance.java @@ -21,17 +21,19 @@ package at.gv.egiz.eaaf.core.impl.idp.process;  import java.io.Serializable;  import java.util.Date; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessDefinition; -import at.gv.egiz.eaaf.core.impl.idp.process.support.SecureRandomHolder; +  import org.apache.commons.lang3.RandomStringUtils;  import org.apache.commons.lang3.time.DurationFormatUtils;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessDefinition; +import at.gv.egiz.eaaf.core.impl.idp.process.support.SecureRandomHolder; +  /** - * Represents a process being executed. The process instance provides information about the process - * and its state. + * Represents a process being executed. The process instance provides + * information about the process and its state.   *   * @author tknall   * @@ -47,19 +49,18 @@ public class ProcessInstance implements Serializable {    private final ExecutionContext executionContext;    private ProcessInstanceState state = ProcessInstanceState.NOT_STARTED; - -    /** -   * Creates a new process instance, based on a given process definition and a given execution -   * context. If the given execution context is {@code null} a new execution context will be -   * created. +   * Creates a new process instance, based on a given process definition and a +   * given execution context. If the given execution context is {@code null} a new +   * execution context will be created.     * <p/> -   * The process instance id of the execution context will be newly generated if it is {@code null} -   * in the execution context. +   * The process instance id of the execution context will be newly generated if +   * it is {@code null} in the execution context.     *     * @param processDefinition The process definition. -   * @param executionContext The execution context (may be {@code null}). If {@code null} a new -   *        execution context will be created internally. +   * @param executionContext  The execution context (may be {@code null}). If +   *                          {@code null} a new execution context will be created +   *                          internally.     */    ProcessInstance(final ProcessDefinition processDefinition, ExecutionContext executionContext) {      final Logger log = LoggerFactory.getLogger(getClass()); @@ -94,7 +95,8 @@ public class ProcessInstance implements Serializable {    /**     * Returns the id of the process node to be executed next.     * -   * @return The process node pointer indicating the process node to be executed next. +   * @return The process node pointer indicating the process node to be executed +   *         next.     */    public String getNextId() {      touch(); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstanceState.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstanceState.java index e6bfa480..f2353869 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstanceState.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/ProcessInstanceState.java @@ -28,7 +28,8 @@ package at.gv.egiz.eaaf.core.impl.idp.process;  public enum ProcessInstanceState {    /** -   * Indicates that the process with this process instance has not yet been started. +   * Indicates that the process with this process instance has not yet been +   * started.     */    NOT_STARTED, @@ -38,8 +39,8 @@ public enum ProcessInstanceState {    STARTED,    /** -   * Indicates that the process has been suspended until being waken up by someonce calling -   * {@code signal}. +   * Indicates that the process has been suspended until being waken up by +   * someonce calling {@code signal}.     */    SUSPENDED, diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStore.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStore.java index f1abaef3..07d44f36 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStore.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStore.java @@ -21,6 +21,7 @@ package at.gv.egiz.eaaf.core.impl.idp.process.dao;  import java.io.Serializable;  import java.util.Map; +  import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstanceState;  public class ProcessInstanceStore implements Serializable { @@ -28,8 +29,8 @@ public class ProcessInstanceStore implements Serializable {    private static final long serialVersionUID = -6147519767313903808L;    /** -   * A process instance identifier qualifies as natural primary key by satisfying these requirements. -   * ("unique, constant, required"): +   * A process instance identifier qualifies as natural primary key by satisfying +   * these requirements. ("unique, constant, required"):     * <ul>     * <li>unique value</li>     * <li>never changes (immutable)</li> diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java index 06c8cc1a..cca8872f 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/dao/ProcessInstanceStoreDaoImpl.java @@ -19,16 +19,18 @@  package at.gv.egiz.eaaf.core.impl.idp.process.dao; -import at.gv.egiz.eaaf.core.api.idp.process.ProcessInstanceStoreDao; -import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage; -import at.gv.egiz.eaaf.core.exceptions.EaafException;  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.idp.process.ProcessInstanceStoreDao; +import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage; +import at.gv.egiz.eaaf.core.exceptions.EaafException; +  /** - * Database backed implementation of the {@link ProcessInstanceStoreDao} interface. + * Database backed implementation of the {@link ProcessInstanceStoreDao} + * interface.   */  @Service("ProcessInstanceStoreage")  public class ProcessInstanceStoreDaoImpl implements ProcessInstanceStoreDao { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/EndEvent.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/EndEvent.java index 48919ded..ac7406ae 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/EndEvent.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/EndEvent.java @@ -20,10 +20,12 @@  package at.gv.egiz.eaaf.core.impl.idp.process.model;  import java.io.Serializable; +  import org.apache.commons.collections4.CollectionUtils;  /** - * Represents an end event. Process execution terminates when an end event is reached. + * Represents an end event. Process execution terminates when an end event is + * reached.   *   * @author tknall   */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessDefinition.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessDefinition.java index 3ab68266..39adda69 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessDefinition.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessDefinition.java @@ -23,6 +23,7 @@ import java.io.Serializable;  import java.util.LinkedHashMap;  import java.util.Map;  import java.util.Objects; +  import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser;  /** @@ -31,7 +32,8 @@ import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser;   * <li>a {@link StartEvent},</li>   * <li>one or more {@linkplain TaskInfo Tasks},</li>   * <li>one or more {@linkplain EndEvent EndEvents} and</li> - * <li>some {@linkplain Transition Transitions} linking StartEvents, Tasks and EndEvents. + * <li>some {@linkplain Transition Transitions} linking StartEvents, Tasks and + * EndEvents.   * </ul>   *   * @author tknall @@ -49,8 +51,8 @@ public class ProcessDefinition implements Serializable {    /**     * Returns the unique identifier of the process definition.     * -   * @return The unique identifier (never {@code null} if process definition comes from -   *         {@link ProcessDefinitionParser}). +   * @return The unique identifier (never {@code null} if process definition comes +   *         from {@link ProcessDefinitionParser}).     */    public String getId() {      return id; @@ -106,8 +108,8 @@ public class ProcessDefinition implements Serializable {    /**     * Returns a map containing the end events of the process description.     * -   * @return The map containing the end events (map is never {@code null} if process definition -   *         comes from {@link ProcessDefinitionParser}). +   * @return The map containing the end events (map is never {@code null} if +   *         process definition comes from {@link ProcessDefinitionParser}).     */    public Map<String, EndEvent> getEndEvents() {      return endEvents; @@ -126,8 +128,8 @@ public class ProcessDefinition implements Serializable {     * Returns the process node associated with the given {@code id}.     *     * @param id The identifier of the process node. -   * @return The process node (may be {code null} when no process node with the given {@code id} -   *         exists). +   * @return The process node (may be {code null} when no process node with the +   *         given {@code id} exists).     */    public ProcessNode getProcessNode(final String id) {      Objects.requireNonNull(id, "Identifier must not be null."); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessNode.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessNode.java index 92858edf..46f086f9 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessNode.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/ProcessNode.java @@ -21,10 +21,12 @@ package at.gv.egiz.eaaf.core.impl.idp.process.model;  import java.util.ArrayList;  import java.util.List; +  import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser;  /** - * Represents a {@link StartEvent}, an {@link EndEvent} or a {@linkplain TaskInfo Task}. + * Represents a {@link StartEvent}, an {@link EndEvent} or a + * {@linkplain TaskInfo Task}.   *   * @author tknall   * @@ -38,8 +40,8 @@ public abstract class ProcessNode {    /**     * Returns the unique identifier of the process node.     * -   * @return The unique identifier (never {@code null} if process node comes from a process -   *         definition from {@link ProcessDefinitionParser}). +   * @return The unique identifier (never {@code null} if process node comes from +   *         a process definition from {@link ProcessDefinitionParser}).     */    public String getId() {      return id; @@ -57,8 +59,8 @@ public abstract class ProcessNode {    /**     * Returns a list of transitions pointing from this process node to another one.     * -   * @return A list of transitions (never {@code null} if process node comes from a process -   *         definition from {@link ProcessDefinitionParser}). +   * @return A list of transitions (never {@code null} if process node comes from +   *         a process definition from {@link ProcessDefinitionParser}).     */    public List<Transition> getOutgoingTransitions() {      return outgoingTransitions; @@ -67,7 +69,8 @@ public abstract class ProcessNode {    /**     * Sets the list of transitions pointing from this process node to another one.     * -   * @param outgoingTransitions The list of transitions originating from this process node. +   * @param outgoingTransitions The list of transitions originating from this +   *                            process node.     */    public void setOutgoingTransitions(final List<Transition> outgoingTransitions) {      this.outgoingTransitions = outgoingTransitions; @@ -76,8 +79,8 @@ public abstract class ProcessNode {    /**     * Returns a list of transitions pointing from another process node to this one.     * -   * @return A list of transitions (never {@code null} if process node comes from a process -   *         definition from {@link ProcessDefinitionParser}). +   * @return A list of transitions (never {@code null} if process node comes from +   *         a process definition from {@link ProcessDefinitionParser}).     */    public List<Transition> getIncomingTransitions() {      return incomingTransitions; @@ -86,7 +89,8 @@ public abstract class ProcessNode {    /**     * Sets the list of transitions pointing from another process node to this one.     * -   * @param incomingTransitions A list of transitions pointing to this process node. +   * @param incomingTransitions A list of transitions pointing to this process +   *                            node.     */    public void setIncomingTransitions(final List<Transition> incomingTransitions) {      this.incomingTransitions = incomingTransitions; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/StartEvent.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/StartEvent.java index 698312c7..ef6bc7ef 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/StartEvent.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/StartEvent.java @@ -20,11 +20,12 @@  package at.gv.egiz.eaaf.core.impl.idp.process.model;  import java.io.Serializable; +  import org.apache.commons.collections4.CollectionUtils;  /** - * Represents a start event. Each process description contains a single start event. Process - * execution starts with a start event. + * Represents a start event. Each process description contains a single start + * event. Process execution starts with a start event.   *   * @author tknall   * diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/TaskInfo.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/TaskInfo.java index 9e384b4c..c8eea1bb 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/TaskInfo.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/TaskInfo.java @@ -20,11 +20,14 @@  package at.gv.egiz.eaaf.core.impl.idp.process.model;  import java.io.Serializable; -import at.gv.egiz.eaaf.core.api.idp.process.Task; +  import org.apache.commons.collections4.CollectionUtils; +import at.gv.egiz.eaaf.core.api.idp.process.Task; +  /** - * Represents information about a single task to be performed upon process execution. + * Represents information about a single task to be performed upon process + * execution.   *   * @author tknall   * @@ -38,17 +41,19 @@ public class TaskInfo extends ProcessNode implements Serializable {    private boolean async = DEFAULT_ASYNC;    /** -   * Determines if the task is marked asynchronous ({@code true}) or synchronous ({@code false}). +   * Determines if the task is marked asynchronous ({@code true}) or synchronous +   * ({@code false}).     * -   * @return A flag indicating if the task should be executed asynchronously or synchronously. -   *         (Default: {@code false}) +   * @return A flag indicating if the task should be executed asynchronously or +   *         synchronously. (Default: {@code false})     */    public boolean isAsync() {      return async;    }    /** -   * Marks a task to executed asynchronously ({@code true}) or synchronously ({@code false}). +   * Marks a task to executed asynchronously ({@code true}) or synchronously +   * ({@code false}).     *     * @param async The flag.     */ @@ -57,7 +62,8 @@ public class TaskInfo extends ProcessNode implements Serializable {    }    /** -   * Returns the class that implements the actual task (must implement {@link Task}). +   * Returns the class that implements the actual task (must implement +   * {@link Task}).     *     * @return The task implementing class.     */ diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/Transition.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/Transition.java index 4c7b70f0..39c5f437 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/Transition.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/model/Transition.java @@ -20,11 +20,13 @@  package at.gv.egiz.eaaf.core.impl.idp.process.model;  import java.io.Serializable; +  import at.gv.egiz.eaaf.core.impl.idp.process.ProcessDefinitionParser;  /** - * Represents a single transition from a {@link StartEvent} or {@linkplain TaskInfo Task} to another - * {@linkplain TaskInfo Task} or {@link EndEvent}. + * Represents a single transition from a {@link StartEvent} or + * {@linkplain TaskInfo Task} to another {@linkplain TaskInfo Task} or + * {@link EndEvent}.   *   * @author tknall   * @@ -39,11 +41,12 @@ public class Transition implements Serializable {    private ProcessNode to;    /** -   * Returns the process node (effectively a {@link StartEvent} or {@linkplain TaskInfo Task}) the -   * transition is pointing from. +   * Returns the process node (effectively a {@link StartEvent} or +   * {@linkplain TaskInfo Task}) the transition is pointing from.     * -   * @return The transition's source process node (never {@code null} if transition comes from a -   *         process definition from {@link ProcessDefinitionParser}). +   * @return The transition's source process node (never {@code null} if +   *         transition comes from a process definition from +   *         {@link ProcessDefinitionParser}).     */    public ProcessNode getFrom() {      return from; @@ -59,11 +62,12 @@ public class Transition implements Serializable {    }    /** -   * Returns the process node (effectively a {@linkplain TaskInfo Task} or {@link EndEvent}) the -   * transition is pointing to. +   * Returns the process node (effectively a {@linkplain TaskInfo Task} or +   * {@link EndEvent}) the transition is pointing to.     * -   * @return The transition's destination process node (never {@code null} if transition comes from -   *         a process definition from {@link ProcessDefinitionParser}). +   * @return The transition's destination process node (never {@code null} if +   *         transition comes from a process definition from +   *         {@link ProcessDefinitionParser}).     */    public ProcessNode getTo() {      return to; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/SpringExpressionEvaluator.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/SpringExpressionEvaluator.java index fc01463e..588a3bde 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/SpringExpressionEvaluator.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/SpringExpressionEvaluator.java @@ -20,10 +20,9 @@  package at.gv.egiz.eaaf.core.impl.idp.process.spring;  import java.util.Objects; +  import javax.annotation.PostConstruct; -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; @@ -35,9 +34,13 @@ 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.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 reference Spring - * beans from the application context. + * Expression evaluator for processing {@link Transition} conditions allowing to + * reference Spring beans from the application context.   *   * @author tknall   * diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractAuthSourceServlet.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractAuthSourceServlet.java index cc899641..bd352bef 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractAuthSourceServlet.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractAuthSourceServlet.java @@ -21,9 +21,7 @@ package at.gv.egiz.eaaf.core.impl.idp.process.springweb;  import javax.servlet.http.HttpServlet;  import javax.servlet.http.HttpServletRequest; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine; -import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstance; +  import org.apache.commons.lang3.StringUtils;  import org.springframework.beans.BeansException;  import org.springframework.beans.factory.NoSuchBeanDefinitionException; @@ -31,10 +29,14 @@ import org.springframework.beans.factory.NoUniqueBeanDefinitionException;  import org.springframework.web.context.WebApplicationContext;  import org.springframework.web.context.support.WebApplicationContextUtils; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.api.idp.process.ProcessEngine; +import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstance; +  /** - * Abstract HttpServlet that provides means for retrieving the process engine (Spring Web required) - * as well as retrieving the underlying process instance and execution context evaluating a certain - * request parameter. + * Abstract HttpServlet that provides means for retrieving the process engine + * (Spring Web required) as well as retrieving the underlying process instance + * and execution context evaluating a certain request parameter.   *   * @author tknall   * @@ -46,7 +48,8 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet {    private ProcessEngine processEngine;    /** -   * Returns the name of the request parameter representing the respective instance id. +   * Returns the name of the request parameter representing the respective +   * instance id.     * <p/>     * Default is {@code processInstanceId}.     * @@ -60,11 +63,16 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet {     * Returns the underlying process engine instance.     *     * @return The process engine (never {@code null}). -   * @throws NoSuchBeanDefinitionException if no {@link ProcessEngine} bean was found. -   * @throws NoUniqueBeanDefinitionException if more than one {@link ProcessEngine} bean was found. -   * @throws BeansException if a problem getting the {@link ProcessEngine} bean occurred. -   * @throws IllegalStateException if the Spring WebApplicationContext was not found, which means -   *         that the servlet is used outside a Spring web environment. +   * @throws NoSuchBeanDefinitionException   if no {@link ProcessEngine} bean was +   *                                         found. +   * @throws NoUniqueBeanDefinitionException if more than one +   *                                         {@link ProcessEngine} bean was found. +   * @throws BeansException                  if a problem getting the +   *                                         {@link ProcessEngine} bean occurred. +   * @throws IllegalStateException           if the Spring WebApplicationContext +   *                                         was not found, which means that the +   *                                         servlet is used outside a Spring web +   *                                         environment.     */    public synchronized ProcessEngine getProcessEngine() {      if (processEngine == null) { @@ -73,7 +81,7 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet {        if (ctx == null) {          throw new IllegalStateException(              "Unable to find Spring WebApplicationContext. " -            + "Servlet needs to be executed within a Spring web environment."); +                + "Servlet needs to be executed within a Spring web environment.");        }        processEngine = ctx.getBean(ProcessEngine.class);      } @@ -86,13 +94,20 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet {     *     * @param request The HttpServletRequest.     * @return The process instance (never {@code null}). -   * @throws NoSuchBeanDefinitionException if no {@link ProcessEngine} bean was found. -   * @throws NoUniqueBeanDefinitionException if more than one {@link ProcessEngine} bean was found. -   * @throws BeansException if a problem getting the {@link ProcessEngine} bean occurred. -   * @throws IllegalStateException if the Spring WebApplicationContext was not found, which means -   *         that the servlet is used outside a Spring web environment. -   * @throws IllegalArgumentException in case the process instance id referenced by the request -   *         parameter {@link #getProcessInstanceIdParameterName()} does not exist. +   * @throws NoSuchBeanDefinitionException   if no {@link ProcessEngine} bean was +   *                                         found. +   * @throws NoUniqueBeanDefinitionException if more than one +   *                                         {@link ProcessEngine} bean was found. +   * @throws BeansException                  if a problem getting the +   *                                         {@link ProcessEngine} bean occurred. +   * @throws IllegalStateException           if the Spring WebApplicationContext +   *                                         was not found, which means that the +   *                                         servlet is used outside a Spring web +   *                                         environment. +   * @throws IllegalArgumentException        in case the process instance id +   *                                         referenced by the request parameter +   *                                         {@link #getProcessInstanceIdParameterName()} +   *                                         does not exist.     */    public ProcessInstance getProcessInstance(final HttpServletRequest request) {      final String processInstanceId = @@ -105,18 +120,26 @@ public abstract class AbstractAuthSourceServlet extends HttpServlet {    }    /** -   * Retrieves the execution context for the respective process instance referenced by the request -   * parameter {@link #getProcessInstanceIdParameterName()}. +   * Retrieves the execution context for the respective process instance +   * referenced by the request parameter +   * {@link #getProcessInstanceIdParameterName()}.     *     * @param request The HttpServletRequest.     * @return The execution context (never {@code null}). -   * @throws NoSuchBeanDefinitionException if no {@link ProcessEngine} bean was found. -   * @throws NoUniqueBeanDefinitionException if more than one {@link ProcessEngine} bean was found. -   * @throws BeansException if a problem getting the {@link ProcessEngine} bean occurred. -   * @throws IllegalStateException if the Spring WebApplicationContext was not found, which means -   *         that the servlet is used outside a Spring web environment. -   * @throws IllegalArgumentException in case the process instance id referenced by the request -   *         parameter {@link #getProcessInstanceIdParameterName()} does not exist. +   * @throws NoSuchBeanDefinitionException   if no {@link ProcessEngine} bean was +   *                                         found. +   * @throws NoUniqueBeanDefinitionException if more than one +   *                                         {@link ProcessEngine} bean was found. +   * @throws BeansException                  if a problem getting the +   *                                         {@link ProcessEngine} bean occurred. +   * @throws IllegalStateException           if the Spring WebApplicationContext +   *                                         was not found, which means that the +   *                                         servlet is used outside a Spring web +   *                                         environment. +   * @throws IllegalArgumentException        in case the process instance id +   *                                         referenced by the request parameter +   *                                         {@link #getProcessInstanceIdParameterName()} +   *                                         does not exist.     */    public ExecutionContext getExecutionContext(final HttpServletRequest request) {      return getProcessInstance(request).getExecutionContext(); diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractTask.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractTask.java index 02db6686..2cdb84c5 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractTask.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/process/springweb/AbstractTask.java @@ -21,15 +21,17 @@ package at.gv.egiz.eaaf.core.impl.idp.process.springweb;  import javax.servlet.http.HttpServletRequest;  import javax.servlet.http.HttpServletResponse; -import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; -import at.gv.egiz.eaaf.core.api.idp.process.Task; -import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; +  import org.springframework.web.context.request.RequestAttributes;  import org.springframework.web.context.request.RequestContextHolder;  import org.springframework.web.context.request.ServletRequestAttributes;  import org.springframework.web.filter.RequestContextFilter; +import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.api.idp.process.Task; +import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; +  /**   * Abstract task implementation providing {@link HttpServletRequest} and   * {@link HttpServletResponse}. @@ -68,8 +70,8 @@ public abstract class AbstractTask implements Task {        if (request == null || response == null) {          throw new IllegalStateException(              "Spring's RequestContextHolder did not provide HttpServletResponse. " -            + "Did you forget to set the required " -            + "org.springframework.web.filter.RequestContextFilter in your web.xml."); +                + "Did you forget to set the required " +                + "org.springframework.web.filter.RequestContextFilter in your web.xml.");        }        return internalExecute(pendingReq, executionContext, request, response);      } else { @@ -78,43 +80,45 @@ public abstract class AbstractTask implements Task {    }    /** -   * Executes the task providing the underlying {@link ExecutionContext} {@code executionContext} as -   * well as the respective {@link HttpServletRequest} and {@link HttpServletResponse}. +   * Executes the task providing the underlying {@link ExecutionContext} +   * {@code executionContext} as well as the respective {@link HttpServletRequest} +   * and {@link HttpServletResponse}.     *     * @param executionContext The execution context (never {@code null}). -   * @param request The HttpServletRequest (never {@code null}). -   * @param response The HttpServletResponse (never {@code null}). -   * @throws IllegalStateException Thrown in case the task is nur being run within the required -   *         environment. Refer to javadoc for further information. -   * @throws Exception Thrown in case of error executing the task. +   * @param request          The HttpServletRequest (never {@code null}). +   * @param response         The HttpServletResponse (never {@code null}). +   * @throws IllegalStateException Thrown in case the task is nur being run within +   *                               the required environment. Refer to javadoc for +   *                               further information. +   * @throws Exception             Thrown in case of error executing the task.     */    public abstract void execute(ExecutionContext executionContext, HttpServletRequest request,        HttpServletResponse response) throws TaskExecutionException;    /** -   * Executes the task providing the underlying {@link ExecutionContext} {@code executionContext} -   * and the {@link IRequest} {@code pendingReq }as well as the respective -   * {@link HttpServletRequest} and {@link HttpServletResponse}. +   * Executes the task providing the underlying {@link ExecutionContext} +   * {@code executionContext} and the {@link IRequest} {@code pendingReq }as well +   * as the respective {@link HttpServletRequest} and {@link HttpServletResponse}.     *     * <p> -   * 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     * </p>     * -   * @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.   * <ul> - * <li>reference Spring beans from the application context using {@code @myBeanName...},</li> + * <li>reference Spring beans from the application context using + * {@code @myBeanName...},</li>   * <li>{@link ExecutionContext} properties using {@code ctx['property']},</li> - * <li>Multi valued {@link HttpServletRequest} parameters using {@code requestParameters['foo']} - * (keep in mind that this expression returns an array of String values) and</li> + * <li>Multi valued {@link HttpServletRequest} parameters using + * {@code requestParameters['foo']} (keep in mind that this expression returns + * an array of String values) and</li>   * <li>Single valued {@link HttpServletRequest} parameters using   * {@code requestParameter['foo']}</li>   * </ul> @@ -70,9 +76,10 @@ public class SpringWebExpressionEvaluator implements ExpressionEvaluator {    }    /** -   * Evaluation context that provides access to {@link HttpServletRequest} parameters using -   * {@code requestParameter['foo']} for single value parameters or {@code requestParameters['foo']} -   * for multi value parameters. Basic calls to {@code ctx} will be delegated. +   * Evaluation context that provides access to {@link HttpServletRequest} +   * parameters using {@code requestParameter['foo']} for single value parameters +   * or {@code requestParameters['foo']} for multi value parameters. Basic calls +   * to {@code ctx} will be delegated.     *     * @author tknall     * @@ -82,11 +89,11 @@ public class SpringWebExpressionEvaluator implements ExpressionEvaluator {      private static final long serialVersionUID = 1L;      /** -     * Creates a new expression evaluation context, providing access to HttpServletRequest -     * parameter(s). +     * Creates a new expression evaluation context, providing access to +     * HttpServletRequest parameter(s).       * -     * @param delegate The original {@link ExpressionEvaluationContext} to be delegated to for -     *        {@code ctx['foo']} expressions. +     * @param delegate The original {@link ExpressionEvaluationContext} to be +     *                 delegated to for {@code ctx['foo']} expressions.       */      public SpringWebExpressionEvaluationContext(final ExpressionEvaluationContext delegate) {        this.delegate = delegate; diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyRevisionsLogger.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyRevisionsLogger.java index 0c5129bc..4438181f 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyRevisionsLogger.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyRevisionsLogger.java @@ -19,18 +19,18 @@  package at.gv.egiz.eaaf.core.impl.logging; -import at.gv.egiz.eaaf.core.api.IRequest; -import at.gv.egiz.eaaf.core.api.idp.IspConfiguration; -import at.gv.egiz.eaaf.core.api.logging.IRevisionLogger;  import org.slf4j.Logger;  import org.slf4j.LoggerFactory; +import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration; +import at.gv.egiz.eaaf.core.api.logging.IRevisionLogger; +  public class DummyRevisionsLogger implements IRevisionLogger {    private static final Logger log = LoggerFactory.getLogger(DummyStatisticLogger.class); -    @Override -  public void logEvent(final IspConfiguration oaConfig, final int eventCode, final String message) { +  public void logEvent(final ISpConfiguration oaConfig, final int eventCode, final String message) {      log.trace("Dummy-logEventOperation");    } @@ -42,7 +42,8 @@ public class DummyRevisionsLogger implements IRevisionLogger {    }    @Override -  public void logEvent(final String sessionID, final String transactionID, final int eventCode, final String message) { +  public void logEvent(final String sessionID, final String transactionID, final int eventCode, +      final String message) {      log.trace("Dummy-logEventOperation");    } diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyStatisticLogger.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyStatisticLogger.java index 3d4a2e5e..411ab1f5 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyStatisticLogger.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/logging/DummyStatisticLogger.java @@ -19,14 +19,13 @@  package at.gv.egiz.eaaf.core.impl.logging; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service;  import at.gv.egiz.eaaf.core.api.IRequest;  import at.gv.egiz.eaaf.core.api.idp.IAuthData;  import at.gv.egiz.eaaf.core.api.logging.IStatisticLogger; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service;  @Service("DummyStatisticLogger")  public class DummyStatisticLogger implements IStatisticLogger { @@ -51,7 +50,8 @@ public class DummyStatisticLogger implements IStatisticLogger {    /*     * (non-Javadoc)     * -   * @see at.gv.egovernment.moa.id.advancedlogging.IStatisticLogger#testConnection() +   * @see +   * at.gv.egovernment.moa.id.advancedlogging.IStatisticLogger#testConnection()     */    @Override    public void internalTesting() throws Exception { diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/DomUtils.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/DomUtils.java index aafea776..e1a02c64 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/DomUtils.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/utils/DomUtils.java @@ -17,8 +17,6 @@   * 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.ByteArrayInputStream; @@ -34,6 +32,7 @@ import java.util.Map;  import java.util.Map.Entry;  import java.util.Set;  import java.util.Vector; +  import javax.xml.parsers.DocumentBuilder;  import javax.xml.parsers.DocumentBuilderFactory;  import javax.xml.parsers.ParserConfigurationException; @@ -45,7 +44,7 @@ import javax.xml.transform.TransformerException;  import javax.xml.transform.TransformerFactory;  import javax.xml.transform.dom.DOMSource;  import javax.xml.transform.stream.StreamResult; -import at.gv.egiz.eaaf.core.api.data.XMLNamespaceConstants; +  import org.apache.commons.io.IOUtils;  import org.apache.commons.lang3.StringUtils;  import org.apache.xerces.parsers.DOMParser; @@ -70,14 +69,17 @@ import org.xml.sax.ErrorHandler;  import org.xml.sax.InputSource;  import org.xml.sax.SAXException; +import at.gv.egiz.eaaf.core.api.data.XmlNamespaceConstants; +  /**   * Various utility functions for handling XML DOM trees.   * - *<p> - * 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. - *</p> + * <p> + * 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. + * </p>   *   */  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 same <code>systemId</code> (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 <code>systemId</code> +   * (namespace URI) is not already present in the pool.     * -   * @param inputStream An <code>InputStream</code> providing the contents of the schema. -   * @param systemId The systemId (namespace URI) to use for the schema. +   * @param inputStream An <code>InputStream</code> 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 <code>InputStream</code>.     * -   *<p> -   * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code> and a -   * <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>. -   *</p> +   * <p> +   * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code> +   * and a <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>. +   * </p>     * -   * @param inputStream The <code>InputStream</code> containing the XML document. -   * @param validating If <code>true</code>, parse validating. -   * @param externalSchemaLocations A <code>String</code> containing namespace URI to schema -   *        location pairs, the same way it is accepted by the <code>xsi: -   * schemaLocation</code> attribute. -   * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without -   *        a namespace, the same way it is accepted by the -   *        <code>xsi:noNamespaceSchemaLocation</code> attribute. -   * @param parserFeatures Map of features that should be set into XML parser +   * @param inputStream                       The <code>InputStream</code> +   *                                          containing the XML document. +   * @param validating                        If <code>true</code>, parse +   *                                          validating. +   * @param externalSchemaLocations           A <code>String</code> containing +   *                                          namespace URI to schema location +   *                                          pairs, the same way it is accepted +   *                                          by the <code>xsi: +   * schemaLocation</code>                 attribute. +   * @param externalNoNamespaceSchemaLocation The schema location of the schema +   *                                          for elements without a namespace, +   *                                          the same way it is accepted by the +   *                                          <code>xsi:noNamespaceSchemaLocation</code> +   *                                          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 <code>String</code>.     * -   *<p> -   * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code> and a -   * <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>. -   *</p> +   * <p> +   * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code> +   * and a <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>. +   * </p>     * -   * @param xmlString The <code>String</code> containing the XML document. -   * @param encoding The encoding of the XML document. -   * @param validating If <code>true</code>, parse validating. -   * @param externalSchemaLocations A <code>String</code> containing namespace URI to schema -   *        location pairs, the same way it is accepted by the <code>xsi: -   * schemaLocation</code> attribute. -   * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without -   *        a namespace, the same way it is accepted by the -   *        <code>xsi:noNamespaceSchemaLocation</code> attribute. +   * @param xmlString                         The <code>String</code> containing +   *                                          the XML document. +   * @param encoding                          The encoding of the XML document. +   * @param validating                        If <code>true</code>, parse +   *                                          validating. +   * @param externalSchemaLocations           A <code>String</code> containing +   *                                          namespace URI to schema location +   *                                          pairs, the same way it is accepted +   *                                          by the <code>xsi: +   * schemaLocation</code>                 attribute. +   * @param externalNoNamespaceSchemaLocation The schema location of the schema +   *                                          for elements without a namespace, +   *                                          the same way it is accepted by the +   *                                          <code>xsi:noNamespaceSchemaLocation</code> +   *                                          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 <code>String</code>.     * -   *<p> -   * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code> and a -   * <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>. -   *</p> +   * <p> +   * It uses a <code>MOAEntityResolver</code> as the <code>EntityResolver</code> +   * and a <code>MOAErrorHandler</code> as the <code>ErrorHandler</code>. +   * </p>     * -   * @param xmlString The <code>String</code> containing the XML document. -   * @param encoding The encoding of the XML document. -   * @param validating If <code>true</code>, parse validating. -   * @param externalSchemaLocations A <code>String</code> containing namespace URI to schema -   *        location pairs, the same way it is accepted by the <code>xsi: -   * schemaLocation</code> attribute. -   * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without -   *        a namespace, the same way it is accepted by the -   *        <code>xsi:noNamespaceSchemaLocation</code> attribute. +   * @param xmlString                         The <code>String</code> containing +   *                                          the XML document. +   * @param encoding                          The encoding of the XML document. +   * @param validating                        If <code>true</code>, parse +   *                                          validating. +   * @param externalSchemaLocations           A <code>String</code> containing +   *                                          namespace URI to schema location +   *                                          pairs, the same way it is accepted +   *                                          by the <code>xsi: +   * schemaLocation</code>                 attribute. +   * @param externalNoNamespaceSchemaLocation The schema location of the schema +   *                                          for elements without a namespace, +   *                                          the same way it is accepted by the +   *                                          <code>xsi:noNamespaceSchemaLocation</code> +   *                                          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 <code>String</code>.     * -   * @param xmlString The <code>String</code> containing the XML document. -   * @param validating If <code>true</code>, parse validating. -   * @param externalSchemaLocations A <code>String</code> containing namespace URI to schema -   *        location pairs, the same way it is accepted by the <code>xsi: -   * schemaLocation</code> attribute. -   * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without -   *        a namespace, the same way it is accepted by the -   *        <code>xsi:noNamespaceSchemaLocation</code> attribute. +   * @param xmlString                         The <code>String</code> containing +   *                                          the XML document. +   * @param validating                        If <code>true</code>, parse +   *                                          validating. +   * @param externalSchemaLocations           A <code>String</code> containing +   *                                          namespace URI to schema location +   *                                          pairs, the same way it is accepted +   *                                          by the <code>xsi: +   * schemaLocation</code>                 attribute. +   * @param externalNoNamespaceSchemaLocation The schema location of the schema +   *                                          for elements without a namespace, +   *                                          the same way it is accepted by the +   *                                          <code>xsi:noNamespaceSchemaLocation</code> +   *                                          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 <code>InputStream</code>.     * -   * @param inputStream The <code>InputStream</code> containing the XML document. -   * @param validating If <code>true</code>, parse validating. -   * @param externalSchemaLocations A <code>String</code> containing namespace URI to schema -   *        location pairs, the same way it is accepted by the <code>xsi: -   * schemaLocation</code> attribute. -   * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without -   *        a namespace, the same way it is accepted by the -   *        <code>xsi:noNamespaceSchemaLocation</code> attribute. -   * @param entityResolver An <code>EntityResolver</code> to resolve external entities (schemas and -   *        DTDs). If <code>null</code>, it will not be set. -   * @param errorHandler An <code>ErrorHandler</code> to decide what to do with parsing errors. If -   *        <code>null</code>, it will not be set. +   * @param inputStream                       The <code>InputStream</code> +   *                                          containing the XML document. +   * @param validating                        If <code>true</code>, parse +   *                                          validating. +   * @param externalSchemaLocations           A <code>String</code> containing +   *                                          namespace URI to schema location +   *                                          pairs, the same way it is accepted +   *                                          by the <code>xsi: +   * schemaLocation</code>                 attribute. +   * @param externalNoNamespaceSchemaLocation The schema location of the schema +   *                                          for elements without a namespace, +   *                                          the same way it is accepted by the +   *                                          <code>xsi:noNamespaceSchemaLocation</code> +   *                                          attribute. +   * @param entityResolver                    An <code>EntityResolver</code> to +   *                                          resolve external entities (schemas +   *                                          and DTDs). If <code>null</code>, it +   *                                          will not be set. +   * @param errorHandler                      An <code>ErrorHandler</code> to +   *                                          decide what to do with parsing +   *                                          errors. If <code>null</code>, 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 <code>InputStream</code> 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 <code>InputStream</code> containing the XML document. +   * @param inputStream    The <code>InputStream</code> 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 Map<String, Object> parserFeatures)        throws ParserConfigurationException, SAXException, IOException { -    return DomUtils.parseDocument(inputStream, true, XMLNamespaceConstants.ALL_SCHEMA_LOCATIONS, +    return DomUtils.parseDocument(inputStream, true, XmlNamespaceConstants.ALL_SCHEMA_LOCATIONS,          null, parserFeatures).getDocumentElement();    }    /** -   * A convenience method to parse an XML document non validating. This method disallow DocType -   * declarations +   * A convenience method to parse an XML document non validating. This method +   * disallow DocType declarations     *     * @param inputStream The <code>InputStream</code> 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 HashMap<String, Object>() {            private static final long serialVersionUID = 1L;            { @@ -514,19 +548,25 @@ public class DomUtils {    /**     * Schema validate a given DOM element.     * -   * @param element The element to validate. -   * @param externalSchemaLocations A <code>String</code> containing namespace URI to schema -   *        location pairs, the same way it is accepted by the <code>xsi: -   * schemaLocation</code> attribute. -   * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without -   *        a namespace, the same way it is accepted by the -   *        <code>xsi:noNamespaceSchemaLocation</code> attribute. -   * @return <code>true</code>, if the <code>element</code> 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 <code>String</code> containing +   *                                          namespace URI to schema location +   *                                          pairs, the same way it is accepted +   *                                          by the <code>xsi: +   * schemaLocation</code>                 attribute. +   * @param externalNoNamespaceSchemaLocation The schema location of the schema +   *                                          for elements without a namespace, +   *                                          the same way it is accepted by the +   *                                          <code>xsi:noNamespaceSchemaLocation</code> +   *                                          attribute. +   * @return <code>true</code>, if the <code>element</code> 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 <code>String</code> containing namespace URI to schema -   *        location pairs, the same way it is accepted by the <code>xsi: -   * schemaLocation</code> attribute. -   * @param externalNoNamespaceSchemaLocation The schema location of the schema for elements without -   *        a namespace, the same way it is accepted by the -   *        <code>xsi:noNamespaceSchemaLocation</code> attribute. -   * @return <code>true</code>, if the <code>element</code> 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 <code>String</code> containing +   *                                          namespace URI to schema location +   *                                          pairs, the same way it is accepted +   *                                          by the <code>xsi: +   * schemaLocation</code>                 attribute. +   * @param externalNoNamespaceSchemaLocation The schema location of the schema +   *                                          for elements without a namespace, +   *                                          the same way it is accepted by the +   *                                          <code>xsi:noNamespaceSchemaLocation</code> +   *                                          attribute. +   * @return <code>true</code>, if the <code>element</code> 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.     * -   *<p> +   * <p>     * The node will be serialized using the UTF-8 encoding. -   *</p> +   * </p>     *     * @param node The node to serialize.     * @return String The <code>String</code> representation of the given DOM node. -   * @throws TransformerException An error occurred transforming the node to a <code>String</code>. -   * @throws IOException An IO error occurred writing the node to a byte array. +   * @throws TransformerException An error occurred transforming the node to a +   *                              <code>String</code>. +   * @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.     * -   *<p> +   * <p>     * The node will be serialized using the UTF-8 encoding. -   *</p> +   * </p>     * -   * @param node The node to serialize. +   * @param node               The node to serialize.     * @param omitXmlDeclaration The boolean value for omitting the XML Declaration.     * @return String The <code>String</code> representation of the given DOM node. -   * @throws TransformerException An error occurred transforming the node to a <code>String</code>. -   * @throws IOException An IO error occurred writing the node to a byte array. +   * @throws TransformerException An error occurred transforming the node to a +   *                              <code>String</code>. +   * @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.     * -   *<p> +   * <p>     * The node will be serialized using the UTF-8 encoding. -   *</p> +   * </p>     * -   * @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 The <code>String</code> representation of the given DOM node. -   * @throws TransformerException An error occurred transforming the node to a <code>String</code>. -   * @throws IOException An IO error occurred writing the node to a byte array. +   * @throws TransformerException An error occurred transforming the node to a +   *                              <code>String</code>. +   * @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 <code>String</code>. -   * @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 <code>String</code>. +   * @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 <code>String</code>. -   * @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 <code>String</code>. +   * @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 <code>String</code>. -   * @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 <code>String</code>. +   * @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.     * -   *<p> +   * <p>     * This routine:     * </p>     * <ul>     * <li>Ignores comments and processing instructions.</li> -   * <li>Concatenates TEXT nodes, CDATA nodes, and the results recursively processing EntityRef -   * nodes.</li> -   * <li>Ignores any element nodes in the sublist. (Other possible options are to recurse into -   * element sublists or throw an exception.)</li> +   * <li>Concatenates TEXT nodes, CDATA nodes, and the results recursively +   * processing EntityRef nodes.</li> +   * <li>Ignores any element nodes in the sublist. (Other possible options are to +   * recurse into element sublists or throw an exception.)</li>     * </ul>     *     * @param node A DOM node from which to extract text. @@ -788,11 +842,12 @@ public class DomUtils {    }    /** -   * Build the namespace prefix to namespace URL mapping in effect for a given node. +   * Build the namespace prefix to namespace URL mapping in effect for a given +   * node.     *     * @param node The context node for which build the map. -   * @return The namespace prefix to namespace URL mapping ( a <code>String</code> value to -   *         <code>String</code> value mapping). +   * @return The namespace prefix to namespace URL mapping ( a <code>String</code> +   *         value to <code>String</code> 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 <code>context</code>, including the ones used -   *         in <code>context</code> itself. +   * @return All namespace URIs used in the subtree of <code>context</code>, +   *         including the ones used in <code>context</code> 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 <code>collectNamespaceURIs</code>.     *     * @param context The context element to evaluate. -   * @param result The result, passed as a parameter to avoid unnecessary instantiations of -   *        <code>Set</code>. +   * @param result  The result, passed as a parameter to avoid unnecessary +   *                instantiations of <code>Set</code>.     */    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 <code>NodeList</code> has its parent in the -   * <code>NodeList</code> as well. +   * Check, that each attribute node in the given <code>NodeList</code> has its +   * parent in the <code>NodeList</code> as well.     *     * @param nodes The <code>NodeList</code> to check. -   * @return <code>true</code>, if each attribute node in <code>nodes</code> has its parent in -   *         <code>nodes</code> as well. +   * @return <code>true</code>, if each attribute node in <code>nodes</code> has +   *         its parent in <code>nodes</code> as well.     */    public static boolean checkAttributeParentsInNodeList(final NodeList nodes) {      final Set nodeSet = new HashSet(); @@ -939,15 +994,19 @@ public class DomUtils {    }    /** -   * Convert an unstructured <code>NodeList</code> into a <code>DocumentFragment</code>. +   * Convert an unstructured <code>NodeList</code> into a +   * <code>DocumentFragment</code>.     * -   * @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 <code>nodeList2DocumentFragment</code>.     * -   * @param nodeList The <code>NodeList</code> to convert. -   * @param currPos The current position in the <code>nodeList</code>. -   * @param result The resulting <code>DocumentFragment</code>. -   * @param currOrgElem The current original element. +   * @param nodeList       The <code>NodeList</code> to convert. +   * @param currPos        The current position in the <code>nodeList</code>. +   * @param result         The resulting <code>DocumentFragment</code>. +   * @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 <code>true</code>, if the attribute is a namespace declaration, <code>false</code> -   *         otherwise. +   * @return <code>true</code>, if the attribute is a namespace declaration, +   *         <code>false</code> 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 <code>true</code>, if <code>candAnc</code> is an (indirect) ancestor of -   *         <code>cand</code>; <code>false</code> otherwise. +   * @param cand    The node to check for being the child. +   * @return <code>true</code>, if <code>candAnc</code> is an (indirect) ancestor +   *         of <code>cand</code>; <code>false</code> 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 <code>null</code> if the node list is -   *         <code>null</code> or empty or no element is included in the list. +   * @return The (first) element included in the node list or <code>null</code> if +   *         the node list is <code>null</code> 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 <code>EntityResolver</code> that looks up entities stored as local resources. + * An <code>EntityResolver</code> that looks up entities stored as local + * resources.   *   * <p>   * The following DTDs are mapped to local resources: @@ -39,25 +40,27 @@ import org.xml.sax.InputSource;   * </ul>   * </p>   * </p> - * For all other resources, an attempt is made to resolve them as resources, either absolute or - * relative to <code>Constants.SCHEMA_ROOT</code>. + * For all other resources, an attempt is made to resolve them as resources, + * either absolute or relative to <code>Constants.SCHEMA_ROOT</code>.   *   */  public class EaafDomEntityResolver implements EntityResolver {    /**     * Resolve an entity. -   *<p> -   * The <code>systemId</code> parameter is used to perform the lookup of the entity as a resource, -   * either by interpreting the <code>systemId</code> as an absolute resource path, or by appending -   * the last path component of <code>systemId</code> to <code>Constants.SCHEMA_ROOT</code>. -   *</p> +   * <p> +   * The <code>systemId</code> parameter is used to perform the lookup of the +   * entity as a resource, either by interpreting the <code>systemId</code> as an +   * absolute resource path, or by appending the last path component of +   * <code>systemId</code> to <code>Constants.SCHEMA_ROOT</code>. +   * </p>     *     * @param publicId The public ID of the resource.     * @param systemId The system ID of the resource. -   * @return An <code>InputSource</code> from which the entity can be read, or <code>null</code>, if -   *         the entity could not be found. -   * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) +   * @return An <code>InputSource</code> from which the entity can be read, or +   *         <code>null</code>, 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 <code>NodeIterator</code> over the nodes matching the XPath expression. +   * Return a <code>NodeIterator</code> over the nodes matching the XPath +   * expression.     * -   *<p> -   * All namespace URIs and prefixes declared in the <code>Constants</code> interface are used for -   * resolving namespaces. -   *</p> +   * <p> +   * All namespace URIs and prefixes declared in the <code>Constants</code> +   * interface are used for resolving namespaces. +   * </p>     *     * @param contextNode The root node from which to evaluate the XPath expression. -   * @param exp The XPath expression to evaluate. +   * @param exp         The XPath expression to evaluate.     * @return An iterator over the resulting nodes.     * @throws XPathException An error occurred evaluating the XPath expression.     */ @@ -110,12 +112,14 @@ public class XPathUtils {    }    /** -   * Return a <code>NodeIterator</code> over the nodes matching the XPath expression. +   * Return a <code>NodeIterator</code> 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 <code>NodeIterator</code> over the nodes matching the XPath expression. +   * Return a <code>NodeIterator</code> 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 (<code>String</code> to -   *        <code>String</code>) 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 +   *                         (<code>String</code> to <code>String</code>) 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 <code>NodeIterator</code> over the nodes matching the XPath expression. +   * Return a <code>NodeIterator</code> over the nodes matching the XPath +   * expression.     *     * @param contextNode The root node from which to evaluate the XPath expression. -   * @param nsContext The <code>NamespaceContext</code> for resolving namespace prefixes to -   *        namespace URIs for evaluating the XPath expression. -   * @param exp The XPath expression to evaluate. +   * @param nsContext   The <code>NamespaceContext</code> 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 <code>NodeList</code> of all the nodes matching the XPath expression. -   *<p> -   * All namespace URIs and prefixes declared in the <code>Constants</code> interface are used for -   * resolving namespaces. -   *</p> +   * Return a <code>NodeList</code> of all the nodes matching the XPath +   * expression. +   * <p> +   * All namespace URIs and prefixes declared in the <code>Constants</code> +   * interface are used for resolving namespaces. +   * </p> +   *     * @param contextNode The root node from which to evaluate the XPath expression. -   * @param exp The XPath expression to evaluate. +   * @param exp         The XPath expression to evaluate.     * @return A <code>NodeList</code> containing the matching nodes.     * @throws XPathException An error occurred evaluating the XPath expression.     */ @@ -196,12 +207,14 @@ public class XPathUtils {    }    /** -   * Return a <code>NodeList</code> of all the nodes matching the XPath expression. +   * Return a <code>NodeList</code> 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 <code>NodeList</code> containing the matching nodes.     * @throws XPathException An error occurred evaluating the XPath expression.     */ @@ -221,12 +234,15 @@ public class XPathUtils {    }    /** -   * Return a <code>NodeList</code> of all the nodes matching the XPath expression. +   * Return a <code>NodeList</code> 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 (<code>String</code> to -   *        <code>String</code>) 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 +   *                         (<code>String</code> to <code>String</code>) for +   *                         evaluating the XPath expression. +   * @param exp              The XPath expression to evaluate.     * @return A <code>NodeList</code> containing the matching nodes.     * @throws XPathException An error occurred evaluating the XPath expression.     */ @@ -239,12 +255,14 @@ public class XPathUtils {    }    /** -   * Return a <code>NodeList</code> of all the nodes matching the XPath expression. +   * Return a <code>NodeList</code> of all the nodes matching the XPath +   * expression.     *     * @param contextNode The root node from which to evaluate the XPath expression. -   * @param nsContext The <code>NamespaceContext</code> for resolving namespace prefixes to -   *        namespace URIs for evaluating the XPath expression. -   * @param exp The XPath expression to evaluate. +   * @param nsContext   The <code>NamespaceContext</code> for resolving namespace +   *                    prefixes to namespace URIs for evaluating the XPath +   *                    expression. +   * @param exp         The XPath expression to evaluate.     * @return A <code>NodeList</code> 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. -   *<p> -   * All namespace URIs and prefixes declared in the <code>Constants</code> interface are used for -   * resolving namespaces. -   *</p> +   * <p> +   * All namespace URIs and prefixes declared in the <code>Constants</code> +   * interface are used for resolving namespaces. +   * </p> +   *     * @param contextNode The root node from which to evaluate the XPath expression. -   * @param exp The XPath expression to evaluate. -   * @return Node The first node matching the XPath expression, or <code>null</code>, if no node -   *         matched. +   * @param exp         The XPath expression to evaluate. +   * @return Node The first node matching the XPath expression, or +   *         <code>null</code>, 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 <code>null</code>, 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 +   *         <code>null</code>, 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 (<code>String</code> to -   *        <code>String</code>) for evaluating the XPath expression. -   * @param exp The XPath expression to evaluate. -   * @return Node The first node matching the XPath expression, or <code>null</code>, 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 +   *                         (<code>String</code> to <code>String</code>) for +   *                         evaluating the XPath expression. +   * @param exp              The XPath expression to evaluate. +   * @return Node The first node matching the XPath expression, or +   *         <code>null</code>, 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 <code>NamespaceContext</code> 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 <code>null</code>, if no node -   *         matched. +   * @param nsContext   The <code>NamespaceContext</code> 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 +   *         <code>null</code>, 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 -   *        <code>xpath</code>. -   * @return The element value, if it can be located using the <code>xpath</code>. Otherwise, -   *         <code>def</code> 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 <code>xpath</code>. +   * @return The element value, if it can be located using the <code>xpath</code>. +   *         Otherwise, <code>def</code> 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 -   *        <code>xpath</code>. -   * @return The element value, if it can be located using the <code>xpath</code>. Otherwise, -   *         <code>def</code> 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 <code>xpath</code>. +   * @return The element value, if it can be located using the <code>xpath</code>. +   *         Otherwise, <code>def</code> 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 <code>XPathUtils</code> for referring to the namespace -   * of the specified (Security Layer command) element. -   *<p> -   * This namespace prefix can be used in various XPath expression evaluation methods within -   * <code> XPathUtils</code> without explicitely binding it to the particular namespace. -   *</p> +   * Returns the namespace prefix used within <code>XPathUtils</code> for +   * referring to the namespace of the specified (Security Layer command) element. +   * <p> +   * This namespace prefix can be used in various XPath expression evaluation +   * methods within <code> XPathUtils</code> without explicitely binding it to the +   * particular namespace. +   * </p> +   *     * @param contextElement The (Security Layer command) element.     * -   * @return the namespace prefix used within <code>XPathUtils</code> for referring to the namespace -   *         of the specified (Security Layer command) element. +   * @return the namespace prefix used within <code>XPathUtils</code> 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 <code>xmlns:sl10</code>, <code>sl11</code> or <code>sl</code> attribute of the -   * context element. -   *<p> +   * 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 +   * <code>xmlns:sl10</code>, <code>sl11</code> or <code>sl</code> attribute of +   * the context element. +   * <p>     * The returned prefix is needed for evaluating XPATH expressions. -   *</p> -   * @param contextElement The element to get a prefix for the Securitylayer namespace, that is used -   *        within the corresponding document. +   * </p> +   * +   * @param contextElement The element to get a prefix for the Securitylayer +   *                       namespace, that is used within the corresponding +   *                       document.     * -   * @return The string <code>sl10</code>, <code>sl11</code> or <code>sl</code>, depending on the -   *         SecurityLayer namespace of the contextElement. +   * @return The string <code>sl10</code>, <code>sl11</code> or <code>sl</code>, +   *         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 <code>xmlns:slPrefix</code> and if the prefix of -   * that attribute corresponds with a valid SecurityLayer namespace. +   * Checks if the context element has an attribute <code>xmlns:slPrefix</code> +   * 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 <code>null</code> if this prefix is not used. +   * @return The valid SecurityLayer prefix or <code>null</code> if this prefix is +   *         not used.     * @throws XPathException In case of an error     */    private static String checkSLnsDeclaration(final Element contextElement, final String slPrefix, | 
