- * The parser use the VelocityEngine as internal template evaluator.
- *
- * @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
- */
- void build(HttpServletRequest httpReq, HttpServletResponse httpResp, IVelocityGUIBuilderConfiguration config, String loggerName)
- throws GUIBuildException;
+ /**
+ * Parse a GUI template, with parameters into a http servlet-response and use the default
+ * http-response content-type.
+ *
+ * The parser use the VelocityEngine as internal template evaluator.
+ *
+ * @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
+ */
+ void build(HttpServletRequest httpReq, HttpServletResponse httpResp,
+ IVelocityGuiBuilderConfiguration config, String loggerName) throws GuiBuildException;
- /**
- * Parse a GUI template, with parameters into a http servlet-response.
- *
- * The parser use the VelocityEngine as internal template evaluator.
- *
- * @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
- *
- * @throws GUIBuildException
- */
- void build(HttpServletRequest httpReq, HttpServletResponse httpResp, IVelocityGUIBuilderConfiguration config, String contentType,
- String loggerName) throws GUIBuildException;
+ /**
+ * Parse a GUI template, with parameters into a http servlet-response.
+ *
+ * The parser use the VelocityEngine as internal template evaluator.
+ *
+ * @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
+ *
+ * @throws GuiBuildException In case of an error
+ */
+ void build(HttpServletRequest httpReq, HttpServletResponse httpResp,
+ IVelocityGuiBuilderConfiguration config, String contentType, String loggerName)
+ throws GuiBuildException;
}
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 31b8a219..7315dbf1 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
@@ -1,48 +1,42 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
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;
/**
* Context used for evaluation of condition expressions set for {@linkplain Transition Transitions}.
- *
+ *
* @author tknall
- *
+ *
*/
public interface ExpressionEvaluationContext extends Serializable {
- /**
- * Returns the context data map used for expression evaluation.
- *
- * @return An unmodifiable map (never {@code null}).
- */
- Map getCtx();
+ /**
+ * Returns the context data map used for expression evaluation.
+ *
+ * @return An unmodifiable map (never {@code null}).
+ */
+ Map getCtx();
}
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 ef147bff..7fa67ae4 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
@@ -1,51 +1,40 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
package at.gv.egiz.eaaf.core.api.idp.process;
/**
* Evaluates a given {@code expression} returning a boolean value.
- *
+ *
* @author tknall
*/
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}).
- * @return A boolean value.
- * @throws IllegalArgumentException
- * In case of an invalid {@code expression}.
- * @throws NullPointerException
- * In case of a {@code null} expression.
- */
- boolean evaluate(ExpressionEvaluationContext expressionContext, String expression);
+ /**
+ * 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}).
+ * @return A boolean value.
+ * @throws IllegalArgumentException In case of an invalid {@code 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 6f6d6938..d4c221e0 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
@@ -1,34 +1,26 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
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;
@@ -37,102 +29,98 @@ import at.gv.egiz.eaaf.core.impl.idp.process.model.ProcessDefinition;
/**
* Process engine providing means for starting and resuming processes.
- *
+ *
* @author tknall
*/
public interface ProcessEngine {
- /**
- * 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. 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.
+ *
+ * @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.
+ */
+ 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.
+ *
+ * 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}).
+ * @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.
+ */
+ String createProcessInstance(String processDefinitionId, ExecutionContext executionContext)
+ throws ProcessExecutionException;
- /**
- * 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.
- * @throws ProcessDefinitionParserException Thrown in case of an error parsing the process definition.
- * @return The process definition's identifier.
- */
- 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.
+ *
+ * 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.
+ * @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.
+ */
+ String createProcessInstance(String processDefinitionId) throws ProcessExecutionException;
- /**
- * Creates a process instance according to the referenced process definition, persists it into the database and returns it identifier.
- *
- * Note that the method returns the identifier of a process instance which will be needed in order to start a process or to continue
- * process execution after asynchronous task execution (refer to {@link #start(String)} and
- * {@link #signal(String)} for further information).
- *
- * @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.
- */
- 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.
- *
- * 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.
- * @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.
- */
- 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.
+ */
+ void deleteProcessInstance(String processInstanceId) 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.
- */
- void deleteProcessInstance(String processInstanceId) throws ProcessExecutionException;
-
- /**
- * Returns the process instance with a given {@code processInstanceId}.
- *
- * @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.
- */
- ProcessInstance getProcessInstance(String processInstanceId);
+ /**
+ * Returns the process instance with a given {@code processInstanceId}.
+ *
+ * @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.
+ */
+ ProcessInstance getProcessInstance(String processInstanceId);
- /**
- * Starts the process using the given {@code pendingReq}.
- *
- * @param pendingReq
- * The protocol request for which a process should be started.
- * @throws ProcessExecutionException
- * Thrown in case of error.
- */
- void start(IRequest pendingReq) throws ProcessExecutionException;
+ /**
+ * Starts the process using the given {@code pendingReq}.
+ *
+ * @param pendingReq The protocol request for which a process should be started.
+ * @throws ProcessExecutionException Thrown in case of error.
+ */
+ void start(IRequest pendingReq) throws ProcessExecutionException;
- /**
- * Resumes process execution after an asynchronous task has been executed.
- *
- * @param pendingReq
- * The process instance id.
- * @throws ProcessExecutionException
- * Thrown in case of error.
- */
- void signal(IRequest pendingReq) throws ProcessExecutionException;
+ /**
+ * Resumes process execution after an asynchronous task has been executed.
+ *
+ * @param pendingReq The process instance id.
+ * @throws ProcessExecutionException Thrown in case of error.
+ */
+ void signal(IRequest pendingReq) throws ProcessExecutionException;
-}
\ No newline at end of file
+}
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
deleted file mode 100644
index 305af911..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessInstanceStoreDAO.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.api.idp.process;
-
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException;
-import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstance;
-import at.gv.egiz.eaaf.core.impl.idp.process.dao.ProcessInstanceStore;
-
-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.
- */
- 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.
- *
- * @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.
- */
- ProcessInstanceStore load(String processInstanceId) throws EAAFException;
-
- /**
- * 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.
- */
- void remove(String processInstanceId) throws EAAFException;
-
-}
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
new file mode 100644
index 00000000..641eeab8
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/api/idp/process/ProcessInstanceStoreDao.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+package at.gv.egiz.eaaf.core.api.idp.process;
+
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
+import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
+import at.gv.egiz.eaaf.core.impl.idp.process.ProcessInstance;
+import at.gv.egiz.eaaf.core.impl.idp.process.dao.ProcessInstanceStore;
+
+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.
+ */
+ 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.
+ *
+ * @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.
+ */
+ ProcessInstanceStore load(String processInstanceId) throws EaafException;
+
+ /**
+ * 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.
+ */
+ 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 435dff12..06573403 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
@@ -1,29 +1,22 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
package at.gv.egiz.eaaf.core.api.idp.process;
import at.gv.egiz.eaaf.core.api.IRequest;
@@ -32,21 +25,21 @@ import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
/**
* Represents a single task to be performed upon process execution.
- *
+ *
* @author tknall
- *
+ *
*/
public interface Task {
- /**
- * Executes this task.
- * @param pendingReq
- * Provides the current processed protocol request
- * @param executionContext
- * Provides execution related information.
- * @return The pending-request object, because Process-management works recursive
- * @throws Exception An exception upon task execution.
- */
- IRequest execute(IRequest pendingReq, ExecutionContext executionContext) throws TaskExecutionException;
+ /**
+ * Executes this task.
+ *
+ * @param pendingReq Provides the current processed protocol request
+ * @param executionContext Provides execution related information.
+ * @return The pending-request object, because Process-management works recursive
+ * @throws Exception An exception upon task execution.
+ */
+ IRequest execute(IRequest pendingReq, ExecutionContext executionContext)
+ throws TaskExecutionException;
}
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 6db5a6ae..dd7e69fd 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
@@ -3,40 +3,45 @@ package at.gv.egiz.eaaf.core.api.utils;
import java.io.IOException;
import java.io.InputStream;
-import at.gv.egiz.eaaf.core.exceptions.EAAFJsonMapperException;
+import at.gv.egiz.eaaf.core.exceptions.EaafJsonMapperException;
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
- */
- 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)
- */
- Object deserialize(String value, Class clazz) throws EAAFJsonMapperException;
+ /**
+ * 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
+ */
+ String serialize(Object value) 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)
- */
- Object deserialize(InputStream is, Class clazz) throws EAAFJsonMapperException;
-
-}
\ No newline at end of file
+ /**
+ * 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)
+ */
+ Object deserialize(String value, Class 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)
+ */
+ Object deserialize(InputStream is, Class 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 9f025979..c0980b0b 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,24 +1,20 @@
/*******************************************************************************
- * 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.
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
+ * 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.
*******************************************************************************/
/*******************************************************************************
*******************************************************************************/
@@ -27,165 +23,182 @@
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;
/**
* @author tlenz
*
*/
-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 binding = null;
- private String serviceURL = null;
- private String authURL = null;
- private String spEntityID = null;
-
- public SLOInformationImpl(String authURL, String spEntityID, String sessionID, String nameID, String nameIDFormat, String protocolType) {
- new SLOInformationImpl(authURL, spEntityID, sessionID, nameID, nameIDFormat, protocolType, null, null);
- }
-
- public SLOInformationImpl(String authURL, String spEntityID, String sessionID, String nameID, String nameIDFormat, String protocolType, String sloBinding, String sloLocationURL) {
- this.sessionIndex = sessionID;
- this.nameID = nameID;
- this.nameIDFormat = nameIDFormat;
- this.protocolType = protocolType;
- this.spEntityID = spEntityID;
-
- if (authURL.endsWith("/"))
- this.authURL = authURL.substring(0, authURL.length()-1);
- else
- this.authURL = authURL;
-
-
- this.binding = sloBinding;
- this.serviceURL = sloLocationURL;
-
- }
-
-
- /**
- *
- */
- public SLOInformationImpl() {
-
- }
-
-
-
- /**
- * @return the spEntityID
- */
- public String getSpEntityID() {
- return spEntityID;
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getSessionIndex()
- */
- @Override
- public String getSessionIndex() {
- return sessionIndex;
-
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getUserNameIdentifier()
- */
- @Override
- public String getUserNameIdentifier() {
- return nameID;
-
- }
-
-
- /**
- * @param sessionIndex the sessionIndex to set
- */
- public void setSessionIndex(String sessionIndex) {
- this.sessionIndex = sessionIndex;
- }
-
-
- /**
- * @param nameID the nameID to set
- */
- public void setUserNameIdentifier(String nameID) {
- this.nameID = nameID;
- }
-
-
-
- /**
- * @param protocolType the protocolType to set
- */
- public void setProtocolType(String protocolType) {
- this.protocolType = protocolType;
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getProtocolType()
- */
- @Override
- public String getProtocolType() {
- return protocolType;
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getUserNameIDFormat()
- */
- @Override
- public String getUserNameIDFormat() {
- return this.nameIDFormat;
- }
-
-
- /**
- * @param nameIDFormat the nameIDFormat to set
- */
- public void setNameIDFormat(String nameIDFormat) {
- this.nameIDFormat = nameIDFormat;
- }
-
- /**
- * @return the binding
- */
- public String getBinding() {
- return binding;
- }
-
- /**
- * @return the serviceURL
- */
- public String getServiceURL() {
- return serviceURL;
- }
-
- /**
- * @return the authURL from requested IDP without ending /
- */
- public String getAuthURL() {
- return authURL;
- }
-
- /**
- * @param spEntityID the spEntityID to set
- */
- public void setSpEntityID(String spEntityID) {
- this.spEntityID = spEntityID;
- }
-
-
-
-
-
+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 binding = 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,
+ 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;
+ this.protocolType = protocolType;
+ this.spEntityID = spEntityID;
+
+ if (authURL.endsWith("/")) {
+ this.authURL = authURL.substring(0, authURL.length() - 1);
+ } else {
+ this.authURL = authURL;
+ }
+
+
+ this.binding = sloBinding;
+ this.serviceURL = sloLocationURL;
+
+ }
+
+
+ /**
+ *
+ */
+ public SLOInformationImpl() {
+
+ }
+
+
+
+ /**
+ * @return the spEntityID
+ */
+ @Override
+ public String getSpEntityID() {
+ return spEntityID;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getSessionIndex()
+ */
+ @Override
+ public String getSessionIndex() {
+ return sessionIndex;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getUserNameIdentifier()
+ */
+ @Override
+ public String getUserNameIdentifier() {
+ return nameID;
+
+ }
+
+
+ /**
+ * @param sessionIndex the sessionIndex to set
+ */
+ @Override
+ public void setSessionIndex(final String sessionIndex) {
+ this.sessionIndex = sessionIndex;
+ }
+
+
+ /**
+ * @param nameID the nameID to set
+ */
+ @Override
+ public void setUserNameIdentifier(final String nameID) {
+ this.nameID = nameID;
+ }
+
+
+
+ /**
+ * @param protocolType the protocolType to set
+ */
+ public void setProtocolType(final String protocolType) {
+ this.protocolType = protocolType;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getProtocolType()
+ */
+ @Override
+ public String getProtocolType() {
+ return protocolType;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see at.gv.egovernment.moa.id.data.SLOInformationInterface#getUserNameIDFormat()
+ */
+ @Override
+ public String getUserNameIdFormat() {
+ return this.nameIDFormat;
+ }
+
+
+ /**
+ * @param nameIDFormat the nameIDFormat to set
+ */
+ @Override
+ public void setNameIdFormat(final String nameIDFormat) {
+ this.nameIDFormat = nameIDFormat;
+ }
+
+ /**
+ * @return the binding
+ */
+ @Override
+ public String getBinding() {
+ return binding;
+ }
+
+ /**
+ * @return the serviceURL
+ */
+ @Override
+ public String getServiceUrl() {
+ return serviceURL;
+ }
+
+ /**
+ * @return the authURL from requested IDP without ending /
+ */
+ @Override
+ public String getAuthUrl() {
+ return authURL;
+ }
+
+ /**
+ * @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
deleted file mode 100644
index dde5ab70..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/gui/AbstractGUIFormBuilderConfiguration.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.gui;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-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;
-
-/**
- * @author tlenz
- *
- */
-public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilderConfiguration {
- private static final Logger log = LoggerFactory.getLogger(AbstractGUIFormBuilderConfiguration.class);
-
- public static final GroupDefinition PARAM_GROUP_FORM = GroupDefinition.getInstance("form", TYPE.MAP);
- public static final GroupDefinition PARAM_GROUP_ACTIONS = GroupDefinition.getInstance("actions", TYPE.LIST);
- public static final GroupDefinition PARAM_GROUP_PARAMS = GroupDefinition.getInstance("params", TYPE.MAP);
- public static final GroupDefinition PARAM_GROUP_UIOPTIONS = GroupDefinition.getInstance("uiOptions", TYPE.MAP);
- 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";
- @Deprecated public static final String PARAM_PENDINGREQUESTID_DEPRECATED = "pendingReqID";
- public static final String PARAM_PENDINGREQUESTID = "pendingid";
-
- private String authURL = null;
- private String viewName = null;
- private String formSubmitEndpoint = null;
-
- private final Map params = new HashMap();
-
- /**
- * @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(String authURL, String viewName, String formSubmitEndpoint) {
- if (viewName.startsWith("/"))
- this.viewName = viewName.substring(1);
- else
- this.viewName = viewName;
-
- if (authURL.endsWith("/"))
- this.authURL = authURL.substring(0, authURL.length() - 1);
- else
- this.authURL = authURL;
-
- if (StringUtils.isNotEmpty(formSubmitEndpoint)) {
- if (formSubmitEndpoint.startsWith("/"))
- this.formSubmitEndpoint = formSubmitEndpoint;
- else
- this.formSubmitEndpoint = "/" + formSubmitEndpoint;
- }
- }
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewName()
- */
- @Override
- public final String getViewName() {
- return this.viewName;
-
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewParameters()
- */
- @Override
- public final Map getViewParameters() {
- //set generic parameters
- setViewParameter(getFromGroup(), PARAM_AUTHCONTEXT, this.authURL);
- setViewParameter(getFromGroup(), PARAM_FORMSUBMITENDPOINT, this.formSubmitEndpoint);
- setViewParameter(getFromGroup(), PARAM_VIEWNAME, this.viewName);
-
- //get parameters from detail implementation
- putSpecificViewParameters();
-
- try {
- log.trace("Full view parameters: {}", StringUtils.join(params, ","));
- } catch (final Exception e) {
- log.info("Can NOT trace view parameters. Reason: {}", e.getMessage() );
- }
-
- return params;
-
- }
-
- /**
- * Define the parameters, which should be evaluated in the template
- * IMPORTANT: external HTML escapetion is required, because it is NOT done internally during the building process
- *
- */
- abstract protected void putSpecificViewParameters();
-
- /**
- * Get the Group for generic form elements
- *
- * @return {@link GroupDefinition} or null if no groups are used
- */
- abstract protected GroupDefinition getFromGroup();
-
- @SuppressWarnings("unchecked")
- protected void setViewParameter(GroupDefinition groupDefinition, String key, Object value) {
-
- if (groupDefinition != null) {
- log.trace("Adding group object ... ");
- Object groupMap = params.get(groupDefinition.getName());
- if (groupMap == null) {
- if (groupDefinition.getType().equals(TYPE.MAP)) {
- groupMap = new HashMap();;
- log.trace("Build new MAP based group element");
-
- } else if (groupDefinition.getType().equals(TYPE.LIST)) {
- groupMap = new ArrayList
The code has been taken from {@link AuthServlet}.
+ * Task based counterpart to {@link AuthServlet}, providing the same utility methods (error
+ * handling, parameter parsing etc.).
+ *
+ * The code has been taken from {@link AuthServlet}.
*/
public abstract class AbstractAuthServletTask extends AbstractTask {
- private static final Logger log = LoggerFactory.getLogger(AbstractAuthServletTask.class);
-
- @Autowired(required=true) IProtocolAuthenticationService protAuchService;
- @Autowired(required=true) protected IRequestStorage requestStoreage;
- @Autowired(required=true) protected IConfiguration authConfig;
- @Autowired(required=true) protected ResourceLoader resourceLoader;
-
- @Autowired protected IRevisionLogger revisionsLogger;
-
- protected static final String ERROR_CODE_PARAM = "errorid";
-
- protected IRequest pendingReq = null;
-
- @Override
- public abstract void execute(ExecutionContext executionContext, HttpServletRequest request,
- HttpServletResponse response) throws TaskExecutionException;
-
-
- @Override
- protected final IRequest internalExecute(IRequest pendingReq, ExecutionContext executionContext, HttpServletRequest request,
- HttpServletResponse response) throws TaskExecutionException {
- //set pending-request object
- this.pendingReq = pendingReq;
-
- //add latest pendingRequestId on execution context
- executionContext.put(EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID, pendingReq.getPendingRequestId());
-
- //execute task specific action
- execute(executionContext, request, response);
-
- //return pending-request object
- return this.pendingReq;
- }
-
- /**
- * Redirect the authentication process to protocol specific finalization endpoint.
- * @param executionContext
- *
- * @param pendingReq Actually processed protocol specific authentication request
- * @param httpResp
- * @throws IOException
- * @throws EAAFException
- */
- protected void performRedirectToProtocolFinialization(ExecutionContext executionContext, IRequest pendingReq, HttpServletRequest httpReq, HttpServletResponse httpResp) throws EAAFException, IOException {
- final Object frontChannelRedirectFlagObj = 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.");
- protAuchService.finalizeAuthentication(httpReq, httpResp, pendingReq);
-
- } else {
- log.info("AuthProcess finished. Redirect to Protocol Dispatcher.");
- requestStoreage.storePendingRequest(pendingReq);
- performRedirectToItself(pendingReq, httpResp, ProtocolFinalizationController.ENDPOINT_FINALIZEPROTOCOL);
-
- }
-
-
-
- }
-
- /**
- * Redirect the authentication process to IDP itself
- *
- * @param pendingReq Actually processed protocol specific authentication request
- * @param httpResp
- * @param idpEndPoint Servlet EndPoint that should receive the redirect
- */
- protected void performRedirectToItself(IRequest pendingReq, HttpServletResponse httpResp, String idpEndPoint) {
- final String redirectURL = new DataURLBuilder().buildDataURL(pendingReq.getAuthURL(),
- idpEndPoint, pendingReq.getPendingRequestId());
-
- httpResp.setContentType("text/html");
- httpResp.setStatus(302);
- httpResp.addHeader("Location", redirectURL);
- log.debug("REDIRECT TO: " + redirectURL);
-
- }
-
-
- /**
- * 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 FileUploadException
- * if parsing request parameters fails.
- */
- protected Map getParameters(HttpServletRequest req) throws IOException,
- FileUploadException {
-
- final Map parameters = new HashMap();
-
- if (ServletFileUpload.isMultipartContent(req)) {
- // request is encoded as mulitpart/form-data
- final FileItemFactory factory = new DiskFileItemFactory();
- ServletFileUpload upload = null;
- upload = new ServletFileUpload(factory);
- List items = null;
- items = upload.parseRequest(req);
- for (int i = 0; i < items.size(); i++) {
- final FileItem item = (FileItem) items.get(i);
- if (item.isFormField()) {
- // Process only form fields - no file upload items
- parameters.put(item.getFieldName(), item.getString("UTF-8"));
-
- //log requests on trace
- if (log.isTraceEnabled()) {
- final String logString = item.getString("UTF-8");
-
- // TODO use RegExp
- final String startS = "";
- final String endS = "urn:publicid:gv.at:baseid";
- String logWithMaskedBaseid = logString;
- final int start = logString.indexOf(startS);
- if (start > -1) {
- final int end = logString.indexOf(endS);
- if (end > -1) {
- logWithMaskedBaseid = logString.substring(0, start);
- logWithMaskedBaseid += startS;
- logWithMaskedBaseid += "xxxxxxxxxxxxxxxxxxxxxxxx";
- logWithMaskedBaseid += logString.substring(end,
- logString.length());
- }
- }
-
- log.debug("Processed multipart/form-data request parameter: \nName: "
- + item.getFieldName()
- + "\nValue: "
- + logWithMaskedBaseid);
- }
-
- }
- }
- }
-
- else {
- final Iterator> requestParamIt = req.getParameterMap().entrySet().iterator();
- while (requestParamIt.hasNext()) {
- final Entry 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 way
- parameters.put(key, ArrayUtils.isEmpty(values) ? null : values[values.length-1]);
- }
-
- }
-
- return parameters;
- }
-
- /**
- * Reads bytes up to a delimiter, consuming the delimiter.
- *
- * @param in
- * input stream
- * @param delimiter
- * delimiter character
- * @return String constructed from the read bytes
- * @throws IOException
- */
- protected String readBytesUpTo(InputStream in, char delimiter)
- throws IOException {
- final ByteArrayOutputStream bout = new ByteArrayOutputStream();
- boolean done = false;
- int b;
- while (!done && (b = in.read()) >= 0) {
- if (b == delimiter)
- done = true;
- else
- bout.write(b);
- }
- return bout.toString();
- }
-
- /**
- * Adds a parameter to a URL.
- *
- * @param url
- * the URL
- * @param paramname
- * parameter name
- * @param paramvalue
- * parameter value
- * @return the URL with parameter added
- */
- protected static String addURLParameter(String url, String paramname,
- String paramvalue) {
- final String param = paramname + "=" + paramvalue;
- if (url.indexOf("?") < 0)
- return url + "?" + param;
- else
- return url + "&" + param;
- }
+ private static final Logger log = LoggerFactory.getLogger(AbstractAuthServletTask.class);
+
+ @Autowired(required = true)
+ IProtocolAuthenticationService protAuchService;
+ @Autowired(required = true)
+ protected IRequestStorage requestStoreage;
+ @Autowired(required = true)
+ protected IConfiguration authConfig;
+ @Autowired(required = true)
+ protected ResourceLoader resourceLoader;
+
+ @Autowired
+ protected IRevisionLogger revisionsLogger;
+
+ protected static final String ERROR_CODE_PARAM = "errorid";
+
+ protected IRequest pendingReq = null;
+
+ @Override
+ 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,
+ final HttpServletResponse response) throws TaskExecutionException {
+ // set pending-request object
+ this.pendingReq = pendingReq;
+
+ // add latest pendingRequestId on execution context
+ executionContext.put(EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID,
+ pendingReq.getPendingRequestId());
+
+ // execute task specific action
+ execute(executionContext, request, response);
+
+ // return pending-request object
+ return this.pendingReq;
+ }
+
+ /**
+ * 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
+ * @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);
+ if (frontChannelRedirectFlagObj != null && frontChannelRedirectFlagObj instanceof Boolean
+ && (Boolean) frontChannelRedirectFlagObj) {
+ log.info("AuthProcess finished. Forward to Protocol finalization.");
+ protAuchService.finalizeAuthentication(httpReq, httpResp, pendingReq);
+
+ } else {
+ log.info("AuthProcess finished. Redirect to Protocol Dispatcher.");
+ requestStoreage.storePendingRequest(pendingReq);
+ performRedirectToItself(pendingReq, httpResp,
+ ProtocolFinalizationController.ENDPOINT_FINALIZEPROTOCOL);
+
+ }
+
+
+
+ }
+
+ /**
+ * Redirect the authentication process to IDP itself.
+ *
+ * @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,
+ final HttpServletResponse httpResp, final String idpEndPoint) {
+ final String redirectUrl = new DataUrlBuilder().buildDataUrl(pendingReq.getAuthUrl(),
+ idpEndPoint, pendingReq.getPendingRequestId());
+
+ httpResp.setContentType("text/html");
+ httpResp.setStatus(302);
+ httpResp.addHeader("Location", redirectUrl);
+ log.debug("REDIRECT TO: " + redirectUrl);
+
+ }
+
+
+ /**
+ * 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 FileUploadException if parsing request parameters fails.
+ */
+ protected Map getParameters(final HttpServletRequest req)
+ throws IOException, FileUploadException {
+
+ final Map parameters = new HashMap<>();
+
+ if (ServletFileUpload.isMultipartContent(req)) {
+ // request is encoded as mulitpart/form-data
+ final FileItemFactory factory = new DiskFileItemFactory();
+ ServletFileUpload upload = null;
+ upload = new ServletFileUpload(factory);
+ List items = null;
+ items = upload.parseRequest(req);
+ for (int i = 0; i < items.size(); i++) {
+ final FileItem item = (FileItem) items.get(i);
+ if (item.isFormField()) {
+ // Process only form fields - no file upload items
+ parameters.put(item.getFieldName(), item.getString("UTF-8"));
+
+ // log requests on trace
+ if (log.isTraceEnabled()) {
+ final String logString = item.getString("UTF-8");
+
+ // TODO use RegExp
+ final String startS = "";
+ final String endS = "urn:publicid:gv.at:baseid";
+ String logWithMaskedBaseid = logString;
+ final int start = logString.indexOf(startS);
+ if (start > -1) {
+ final int end = logString.indexOf(endS);
+ if (end > -1) {
+ logWithMaskedBaseid = logString.substring(0, start);
+ logWithMaskedBaseid += startS;
+ logWithMaskedBaseid += "xxxxxxxxxxxxxxxxxxxxxxxx";
+ logWithMaskedBaseid += logString.substring(end, logString.length());
+ }
+ }
+
+ log.debug("Processed multipart/form-data request parameter: \nName: "
+ + item.getFieldName() + "\nValue: " + logWithMaskedBaseid);
+ }
+
+ }
+ }
+
+ } else {
+ final Iterator> requestParamIt =
+ req.getParameterMap().entrySet().iterator();
+ while (requestParamIt.hasNext()) {
+ final Entry 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
+ // way
+ parameters.put(key, ArrayUtils.isEmpty(values) ? null : values[values.length - 1]);
+ }
+
+ }
+
+ return parameters;
+ }
+
+ /**
+ * Reads bytes up to a delimiter, consuming the delimiter.
+ *
+ * @param in input stream
+ * @param delimiter delimiter character
+ * @return String constructed from the read bytes
+ * @throws IOException In case of a general error
+ */
+ protected String readBytesUpTo(final InputStream in, final char delimiter) throws IOException {
+ final ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ boolean done = false;
+ int b;
+ while (!done && (b = in.read()) >= 0) {
+ if (b == delimiter) {
+ done = true;
+ } else {
+ bout.write(b);
+ }
+ }
+ return bout.toString("UTF-8");
+
+ }
+
+ /**
+ * Adds a parameter to a URL.
+ *
+ * @param url the URL
+ * @param paramname parameter name
+ * @param paramvalue parameter value
+ * @return the URL with parameter added
+ */
+ protected static String addUrlParameter(final String url, final String paramname,
+ final String paramvalue) {
+ final String param = paramname + "=" + paramvalue;
+ if (url.indexOf("?") < 0) {
+ return url + "?" + param;
+ } else {
+ return url + "&" + param;
+ }
+ }
}
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 6789c802..b04b000e 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
@@ -1,43 +1,38 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.auth.modules;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
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;
@@ -45,135 +40,124 @@ 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 final List priorizedModules = new ArrayList<>();
-
- @Autowired
- private ApplicationContext ctx;
-
- @Autowired
- private ProcessEngine processEngine;
-
- private final Logger log = LoggerFactory.getLogger(getClass());
-
- public static ModuleRegistration getInstance() {
- return instance;
- }
-
- private ModuleRegistration() {
- }
-
- @PostConstruct
- private void init() {
- // load modules via the ServiceLoader
- initServiceLoaderModules();
-
- // load modules via Spring
- initSpringModules();
-
- // order modules according to their priority
- sortModules();
-
- instance = this;
- }
-
- /**
- * Discovers modules which use the ServiceLoader mechanism.
- */
- private void initServiceLoaderModules() {
- log.info("Looking for auth modules.");
- final ServiceLoader loader = ServiceLoader.load(AuthModule.class);
- final Iterator modules = loader.iterator();
- while (modules.hasNext()) {
- final AuthModule module = modules.next();
- log.info("Detected module {}", module.getClass().getName());
- registerModuleProcessDefinitions(module);
- priorizedModules.add(module);
- }
- }
-
- /**
- * Discovers modules which use Spring.
- */
- private void initSpringModules() {
- log.debug("Discovering Spring modules.");
- final Map modules = ctx.getBeansOfType(AuthModule.class);
- for (final AuthModule module : modules.values()) {
- registerModuleProcessDefinitions(module);
- priorizedModules.add(module);
- }
- }
-
- /**
- * Registers the resource uris for the module.
- *
- * @param module
- * the module.
- */
- private void registerModuleProcessDefinitions(AuthModule module) {
- for (final String uri : module.getProcessDefinitions()) {
- final Resource resource = ctx.getResource(uri);
- if (resource.isReadable()) {
- log.info("Registering process definition '{}'.", uri);
- try (InputStream processDefinitionInputStream = resource.getInputStream()) {
- processEngine.registerProcessDefinition(processDefinitionInputStream);
- } catch (final IOException e) {
- log.error("Process definition '{}' could NOT be read.", uri, e);
- } catch (final ProcessDefinitionParserException e) {
- log.error("Error while parsing process definition '{}'", uri, e);
- }
- } else {
- log.error("Process definition '{}' cannot be read.", uri);
- }
- }
- }
-
- /**
- * Order the modules in descending order according to their priority.
- */
- private void sortModules() {
- Collections.sort(priorizedModules, new Comparator() {
- @Override
- public int compare(AuthModule thisAuthModule, AuthModule otherAuthModule) {
- final int thisOrder = thisAuthModule.getPriority();
- final int otherOrder = otherAuthModule.getPriority();
- return (thisOrder < otherOrder ? 1 : (thisOrder == otherOrder ? 0 : -1));
- }
- });
- }
-
- /**
- * 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 pendingReq the current processed {@link IRequest}
- * @return the process id or {@code null}
- */
- public String selectProcess(ExecutionContext context, IRequest pendingReq) {
- for (final AuthModule module : priorizedModules) {
- final String id = module.selectProcess(context, pendingReq);
- if (StringUtils.isNotEmpty(id)) {
- log.debug("Process with id '{}' selected, for context '{}'.", id, context);
- return id;
- }
- }
- log.info("No process is able to handle context '{}'.", context);
- return null;
- }
+ //private static ModuleRegistration instance = new ModuleRegistration();
+
+ private final List priorizedModules = new ArrayList<>();
+
+ @Autowired
+ private ApplicationContext ctx;
+
+ @Autowired
+ private ProcessEngine processEngine;
+
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+// public static ModuleRegistration getInstance() {
+// return ctx.;
+// }
+
+ private ModuleRegistration() {
+
+ }
+
+ @PostConstruct
+ private void init() {
+ // load modules via the ServiceLoader
+ initServiceLoaderModules();
+
+ // load modules via Spring
+ initSpringModules();
+
+ // order modules according to their priority
+ sortModules();
+
+ //instance = this;
+ }
+
+ /**
+ * Discovers modules which use the ServiceLoader mechanism.
+ */
+ private void initServiceLoaderModules() {
+ log.info("Looking for auth modules.");
+ final ServiceLoader loader = ServiceLoader.load(AuthModule.class);
+ final Iterator modules = loader.iterator();
+ while (modules.hasNext()) {
+ final AuthModule module = modules.next();
+ log.info("Detected module {}", module.getClass().getName());
+ registerModuleProcessDefinitions(module);
+ priorizedModules.add(module);
+ }
+ }
+
+ /**
+ * Discovers modules which use Spring.
+ */
+ private void initSpringModules() {
+ log.debug("Discovering Spring modules.");
+ final Map modules = ctx.getBeansOfType(AuthModule.class);
+ for (final AuthModule module : modules.values()) {
+ registerModuleProcessDefinitions(module);
+ priorizedModules.add(module);
+ }
+ }
+
+ /**
+ * Registers the resource uris for the module.
+ *
+ * @param module the module.
+ */
+ private void registerModuleProcessDefinitions(final AuthModule module) {
+ for (final String uri : module.getProcessDefinitions()) {
+ final Resource resource = ctx.getResource(uri);
+ if (resource.isReadable()) {
+ log.info("Registering process definition '{}'.", uri);
+ try (InputStream processDefinitionInputStream = resource.getInputStream()) {
+ processEngine.registerProcessDefinition(processDefinitionInputStream);
+ } catch (final IOException e) {
+ log.error("Process definition '{}' could NOT be read.", uri, e);
+ } catch (final ProcessDefinitionParserException e) {
+ log.error("Error while parsing process definition '{}'", uri, e);
+ }
+ } else {
+ log.error("Process definition '{}' cannot be read.", uri);
+ }
+ }
+ }
+
+ /**
+ * Order the modules in descending order according to their priority.
+ */
+ private void sortModules() {
+ Collections.sort(priorizedModules, (thisAuthModule, otherAuthModule) -> {
+ final int thisOrder = thisAuthModule.getPriority();
+ final int otherOrder = otherAuthModule.getPriority();
+ return (thisOrder < otherOrder ? 1 : (thisOrder == otherOrder ? 0 : -1));
+ });
+ }
+
+ /**
+ * 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 pendingReq the current processed {@link IRequest}
+ * @return the process id or {@code null}
+ */
+ public String selectProcess(final ExecutionContext context, final IRequest pendingReq) {
+ for (final AuthModule module : priorizedModules) {
+ final String id = module.selectProcess(context, pendingReq);
+ if (StringUtils.isNotEmpty(id)) {
+ log.debug("Process with id '{}' selected, for context '{}'.", id, context);
+ return id;
+ }
+ }
+ log.info("No process is able to handle context '{}'.", context);
+ return 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 2edf8a75..a5030851 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
@@ -1,25 +1,22 @@
-/*******************************************************************************
- * Copyright 2019 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.
+/*
+ * Copyright 2019 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
+ * 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.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.auth.services;
import java.io.IOException;
@@ -27,499 +24,518 @@ 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.gui.IGUIBuilderConfiguration;
-import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfigurationFactory;
-import at.gv.egiz.eaaf.core.api.gui.IGUIFormBuilder;
+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;
import at.gv.egiz.eaaf.core.api.gui.ModifyableGuiBuilderConfiguration;
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.ISsoManager;
import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService;
-import at.gv.egiz.eaaf.core.api.idp.slo.SLOInformationInterface;
+import at.gv.egiz.eaaf.core.api.idp.slo.SloInformationInterface;
import at.gv.egiz.eaaf.core.api.logging.IRevisionLogger;
import at.gv.egiz.eaaf.core.api.logging.IStatisticLogger;
import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy;
import at.gv.egiz.eaaf.core.exceptions.AuthnRequestValidatorException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFAuthenticationException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFSSOException;
-import at.gv.egiz.eaaf.core.exceptions.GUIBuildException;
+import at.gv.egiz.eaaf.core.exceptions.EaafAuthenticationException;
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
+import at.gv.egiz.eaaf.core.exceptions.EaafSsoException;
+import at.gv.egiz.eaaf.core.exceptions.GuiBuildException;
import at.gv.egiz.eaaf.core.exceptions.InvalidProtocolRequestException;
import at.gv.egiz.eaaf.core.exceptions.ProcessExecutionException;
import at.gv.egiz.eaaf.core.exceptions.ProtocolNotActiveException;
-import at.gv.egiz.eaaf.core.impl.gui.AbstractGUIFormBuilderConfiguration;
+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 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 {
- private static final Logger log = LoggerFactory.getLogger(ProtocolAuthenticationService.class);
-
- private static final List ERROR_LOGGER_ON_INFO_LEVEL =
- Arrays.asList(
- IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_USERSTOP
- );
-
- @Autowired(required=true) private ApplicationContext applicationContext;
- @Autowired(required=true) private IAuthenticationManager authmanager;
- @Autowired(required=true) private IAuthenticationDataBuilder authDataBuilder;
- @Autowired(required=true) private IGUIBuilderConfigurationFactory guiConfigFactory;
- @Autowired(required=true) private IStatusMessenger statusMessager;
- @Autowired(required=true) private IRequestStorage requestStorage;
- @Autowired(required=true) IPendingRequestIdGenerationStrategy pendingReqIdGenerationStrategy;
-
- @Autowired(required=false) private ISSOManager ssoManager;
- @Autowired private IStatisticLogger statisticLogger;
- @Autowired private IRevisionLogger revisionsLogger;
-
-
- private IGUIFormBuilder guiBuilder;
-
- /* (non-Javadoc)
- * @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)
- */
- @Override
- public void performAuthentication(final HttpServletRequest req, final HttpServletResponse resp,
- final IRequest pendingReq) throws IOException, EAAFException {
- try {
- if (pendingReq.isNeedAuthentication()) {
- //request needs authentication --> start authentication process ...
-
- //set pendingRequestId to support asynchrony message-processing
- ((RequestImpl)pendingReq).setPendingRequestId(pendingReqIdGenerationStrategy.generateExternalPendingRequestId());
-
- //load Parameters from OnlineApplicationConfiguration
- final ISPConfiguration oaParam = pendingReq.getServiceProviderConfiguration();
-
- if (oaParam == null)
- throw new EAAFAuthenticationException(
- IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOSPCONFIG,
- new Object[] { pendingReq.getSPEntityId() });
-
- if (authmanager.doAuthentication(req, resp, pendingReq)) {
- //pending request is already authenticated --> protocol-specific postProcessing can start directly
- finalizeAuthentication(req, resp, pendingReq);
-
- //transaction is finished, log transaction finished event
- revisionsLogger.logEvent(EventConstants.TRANSACTION_DESTROYED, pendingReq.getUniqueTransactionIdentifier());
-
- }
-
- } else {
- executeProtocolSpecificAction(req, resp, pendingReq, null);
-
- }
-
- } catch (final Exception e) {
- buildProtocolSpecificErrorResponse(e, req, resp, pendingReq);
- authmanager.performOnlyIDPLogOut(req, resp, pendingReq);
-
- }
- }
-
- /* (non-Javadoc)
- * @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)
- */
- @Override
- public void finalizeAuthentication(final HttpServletRequest req, final HttpServletResponse resp, final IRequest pendingReq) throws EAAFException, IOException{
- log.debug("Finalize PendingRequest with ID " + pendingReq.getPendingRequestId());
- try {
-
- //check if pending-request has 'abortedByUser' flag set
- if (pendingReq.isAbortedByUser()) {
- //send authentication aborted error to Service Provider
- buildProtocolSpecificErrorResponse(
- new EAAFAuthenticationException(
- IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_USERSTOP,
- new Object[] {}),
- req, resp, pendingReq);
-
- //do not remove the full active SSO-Session
- // in case of only one Service-Provider authentication request is aborted
- if ( !pendingReq.needSingleSignOnFunctionality()) {
- requestStorage.removePendingRequest(pendingReq.getPendingRequestId());
-
- }
-
- //check if pending-request are authenticated
- } else if (pendingReq.isAuthenticated() && !pendingReq.isNeedUserConsent()) {
- internalFinalizeAuthenticationProcess(req, resp, pendingReq);
-
- } else {
- //suspect state: pending-request is not aborted but also are not authenticated
- log.warn("PendingRequest flag for 'authenticated':{} and 'needConsent':{}", pendingReq.isAuthenticated(), pendingReq.isNeedUserConsent());
- if (pendingReq.isNeedUserConsent()) {
- log.error("PendingRequest NEEDS user-consent. Can NOT fininalize authentication --> Abort authentication process!");
-
- } else {
- log.error("PendingRequest is NOT authenticated --> Abort authentication process!");
-
- }
-
- handleErrorNoRedirect(
- new EAAFException(
- "auth.20",
- null), req, resp, true);
-
- }
-
- } catch (final Exception e) {
- log.error("Finalize authentication protocol FAILED." , e);
- buildProtocolSpecificErrorResponse(e, req, resp, pendingReq);
-
- }
-
- //remove pending-request
- if (pendingReq != null) {
- requestStorage.removePendingRequest(pendingReq.getPendingRequestId());
- revisionsLogger.logEvent(EventConstants.TRANSACTION_DESTROYED, pendingReq.getUniqueTransactionIdentifier());
-
- }
- }
-
-
- @Override
- public void buildProtocolSpecificErrorResponse(final Throwable throwable, final HttpServletRequest req,
- final HttpServletResponse resp, final IRequest protocolRequest) throws EAAFException, IOException {
- try {
-
- final Class> clazz = Class.forName(protocolRequest.requestedModule());
-
- if (clazz == null ||
- !IModulInfo.class.isAssignableFrom(clazz)) {
- log.error("Requested protocol module Class is NULL or does not implement the IModulInfo interface.");
- throw new Exception("Requested protocol module Class is NULL or does not implement the IModulInfo interface.");
-
- }
-
- final IModulInfo handlingModule = (IModulInfo) applicationContext.getBean(clazz);
-
- if (handlingModule.generateErrorMessage(
- throwable, req, resp, protocolRequest)) {
-
- //log Error to technical log
- logExceptionToTechnicalLog(throwable);
-
- //log Error Message
- statisticLogger.logErrorOperation(throwable, protocolRequest);
-
- //write revision log entries
- revisionsLogger.logEvent(protocolRequest, EventConstants.TRANSACTION_ERROR, protocolRequest.getUniqueTransactionIdentifier());
-
- return;
-
- } else {
- handleErrorNoRedirect(throwable, req, resp, true);
-
- }
-
- } catch (final Throwable e) {
- handleErrorNoRedirect(throwable, req, resp, true);
-
- }
-
- }
-
- @Override
- public void handleErrorNoRedirect(final Throwable throwable, final HttpServletRequest req,
- final HttpServletResponse resp, final boolean writeExceptionToStatisticLog) throws IOException, EAAFException {
-
- //log Exception into statistic database
- if (writeExceptionToStatisticLog)
- statisticLogger.logErrorOperation(throwable);
-
- //write errror to console
- logExceptionToTechnicalLog(throwable);
-
- //return error to Web browser
- if (throwable instanceof EAAFException || throwable instanceof ProcessExecutionException)
- internalMOAIDExceptionHandler(req, resp, (Exception)throwable, false);
-
- else {
- //write generic message for general exceptions
- final String msg = statusMessager.getMessage(IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, null);
- writeHTMLErrorResponse(req, resp, msg, "9199", null, (Exception) throwable);
-
- }
-
- }
-
-
- public void setGuiBuilder(IGUIFormBuilder guiBuilder) {
- this.guiBuilder = guiBuilder;
- }
-
- /**
- * Finalize the requested protocol operation
- *
- * @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
- * @throws Exception
- */
- protected void internalFinalizeAuthenticationProcess(final HttpServletRequest req, final HttpServletResponse resp,
- final IRequest pendingReq) throws Exception {
-
- String newSSOSessionId = null;
-
- //if Single Sign-On functionality is enabled for this request
- if (pendingReq.needSingleSignOnFunctionality()) {
- if (ssoManager != null) {
- newSSOSessionId = ssoManager.createNewSSOSessionCookie(req, resp, pendingReq);
- if (StringUtils.isEmpty(pendingReq.getInternalSSOSessionIdentifier()))
- ssoManager.createNewSSOSession(pendingReq, newSSOSessionId);
-
- } else
- log.warn("SSO is requested but there is not SSO Session-Manager available");
-
- }
-
- //build authenticationdata from session information and OA configuration
- final IAuthData authData = authDataBuilder.buildAuthenticationData(pendingReq);
-
- //execute the protocol-specific action
- final SLOInformationInterface sloInformation = executeProtocolSpecificAction(req, resp, pendingReq, authData);
-
- //Store OA specific SSO session information if an SSO cookie is set
- if (StringUtils.isNotEmpty(newSSOSessionId)) {
- try {
- ssoManager.updateSSOSession(pendingReq, newSSOSessionId, sloInformation);
-
- } catch (final EAAFSSOException e) {
- log.warn("SSO Session information can not be stored -> SSO is not enabled!");
- authmanager.performOnlyIDPLogOut(req, resp, pendingReq);
-
- }
-
- } else {
- //remove MOASession from database
- authmanager.performOnlyIDPLogOut(req, resp, pendingReq);
-
- }
-
- //Advanced statistic logging
- statisticLogger.logSuccessOperation(pendingReq, authData, StringUtils.isNotEmpty(newSSOSessionId));
-
- }
-
- /**
- * Executes the requested protocol action
- *
- * @param httpReq HttpServletRequest
- * @param httpResp HttpServletResponse
- * @param protocolRequest Authentication request which is actually in process
- * @param authData Service-provider specific authentication data
- *
- * @return Return Single LogOut information or null if protocol supports no SSO
- *
- * @throws Exception
- */
- private SLOInformationInterface executeProtocolSpecificAction(final HttpServletRequest httpReq, final HttpServletResponse httpResp,
- final IRequest pendingReq, final IAuthData authData) throws Exception {
- try {
- // request needs no authentication --> start request processing
- final Class> clazz = Class.forName(pendingReq.requestedAction());
- if (clazz == null ||
- !IAction.class.isAssignableFrom(clazz)) {
- log.error("Requested protocol-action processing Class is NULL or does not implement the IAction interface.");
- throw new Exception("Requested protocol-action processing Class is NULL or does not implement the IAction interface.");
-
- }
-
- final IAction protocolAction = (IAction) applicationContext.getBean(clazz);
- return protocolAction.processRequest(pendingReq, httpReq, httpResp, authData);
-
- } catch (final ClassNotFoundException e) {
- log.error("Requested Auth. protocol processing Class is NULL or does not implement the IAction interface.");
- throw new Exception("Requested Auth. protocol processing Class is NULL or does not implement the IAction interface.");
- }
-
- }
-
- /**
- * Write a Exception to the MOA-ID-Auth internal technical log
- *
- * @param loggedException Exception to log
- */
- protected void logExceptionToTechnicalLog(final Throwable loggedException) {
- if (!( loggedException instanceof EAAFException
- || loggedException instanceof ProcessExecutionException )) {
- log.error("Receive an internal error: Message=" + loggedException.getMessage(), loggedException);
-
- } else {
- if (loggedException instanceof EAAFAuthenticationException &&
- ERROR_LOGGER_ON_INFO_LEVEL.contains(
- ((EAAFAuthenticationException) loggedException).getErrorId())) {
- if (log.isDebugEnabled() || log.isTraceEnabled()) {
- log.info(loggedException.getMessage(), loggedException);
-
- } else {
- log.info(loggedException.getMessage());
-
- }
-
- } else {
- if (log.isDebugEnabled() || log.isTraceEnabled()) {
- log.warn(loggedException.getMessage(), loggedException);
-
- } else {
- log.warn(loggedException.getMessage());
-
- }
- }
- }
- }
-
- private void writeHTMLErrorResponse(@NonNull final HttpServletRequest httpReq, @NonNull final HttpServletResponse httpResp,
- @NonNull final String msg, @NonNull final String errorCode, @Nullable final Object[] params, @NonNull final Exception error) throws IOException, EAAFException {
-
- try {
- final IGUIBuilderConfiguration config
- = guiConfigFactory.getDefaultErrorGUI(HTTPUtils.extractAuthURLFromRequest(httpReq));
-
-
- String[] errorCodeParams = null;
- if (params == null)
- errorCodeParams = new String[] {};
- else {
- errorCodeParams = new String[params.length];
- for (int i=0; i ERROR_LOGGER_ON_INFO_LEVEL =
+ Arrays.asList(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_USERSTOP);
+
+ @Autowired(required = true)
+ private ApplicationContext applicationContext;
+ @Autowired(required = true)
+ private IAuthenticationManager authmanager;
+ @Autowired(required = true)
+ private IAuthenticationDataBuilder authDataBuilder;
+ @Autowired(required = true)
+ private IGuiBuilderConfigurationFactory guiConfigFactory;
+ @Autowired(required = true)
+ private IStatusMessenger statusMessager;
+ @Autowired(required = true)
+ private IRequestStorage requestStorage;
+ @Autowired(required = true)
+ IPendingRequestIdGenerationStrategy pendingReqIdGenerationStrategy;
+
+ @Autowired(required = false)
+ private ISsoManager ssoManager;
+ @Autowired
+ private IStatisticLogger statisticLogger;
+ @Autowired
+ private IRevisionLogger revisionsLogger;
+
+
+ private IGuiFormBuilder guiBuilder;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @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)
+ */
+ @Override
+ public void performAuthentication(final HttpServletRequest req, final HttpServletResponse resp,
+ final IRequest pendingReq) throws IOException, EaafException {
+ try {
+ if (pendingReq.isNeedAuthentication()) {
+ // request needs authentication --> start authentication process ...
+
+ // set pendingRequestId to support asynchrony message-processing
+ ((RequestImpl) pendingReq)
+ .setPendingRequestId(pendingReqIdGenerationStrategy.generateExternalPendingRequestId());
+
+ // load Parameters from OnlineApplicationConfiguration
+ final IspConfiguration oaParam = pendingReq.getServiceProviderConfiguration();
+
+ if (oaParam == null) {
+ throw new EaafAuthenticationException(
+ IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOSPCONFIG,
+ new Object[] {pendingReq.getSpEntityId()});
+ }
+
+ if (authmanager.doAuthentication(req, resp, pendingReq)) {
+ // pending request is already authenticated --> protocol-specific postProcessing can start
+ // directly
+ finalizeAuthentication(req, resp, pendingReq);
+
+ // transaction is finished, log transaction finished event
+ revisionsLogger.logEvent(EventConstants.TRANSACTION_DESTROYED,
+ pendingReq.getUniqueTransactionIdentifier());
+
+ }
+
+ } else {
+ executeProtocolSpecificAction(req, resp, pendingReq, null);
+
+ }
+
+ } catch (final Exception e) {
+ buildProtocolSpecificErrorResponse(e, req, resp, pendingReq);
+ authmanager.performOnlyIdpLogOut(req, resp, pendingReq);
+
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @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)
+ */
+ @Override
+ public void finalizeAuthentication(final HttpServletRequest req, final HttpServletResponse resp,
+ final IRequest pendingReq) throws EaafException, IOException {
+ log.debug("Finalize PendingRequest with ID " + pendingReq.getPendingRequestId());
+ try {
+
+ // check if pending-request has 'abortedByUser' flag set
+ if (pendingReq.isAbortedByUser()) {
+ // send authentication aborted error to Service Provider
+ buildProtocolSpecificErrorResponse(
+ new EaafAuthenticationException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_USERSTOP,
+ new Object[] {}),
+ req, resp, pendingReq);
+
+ // do not remove the full active SSO-Session
+ // in case of only one Service-Provider authentication request is aborted
+ if (!pendingReq.needSingleSignOnFunctionality()) {
+ requestStorage.removePendingRequest(pendingReq.getPendingRequestId());
+
+ }
+
+ // check if pending-request are authenticated
+ } else if (pendingReq.isAuthenticated() && !pendingReq.isNeedUserConsent()) {
+ internalFinalizeAuthenticationProcess(req, resp, pendingReq);
+
+ } else {
+ // suspect state: pending-request is not aborted but also are not authenticated
+ log.warn("PendingRequest flag for 'authenticated':{} and 'needConsent':{}",
+ pendingReq.isAuthenticated(), pendingReq.isNeedUserConsent());
+ if (pendingReq.isNeedUserConsent()) {
+ log.error(
+ "PendingRequest NEEDS user-consent. Can NOT fininalize authentication --> Abort authentication process!");
+
+ } else {
+ log.error("PendingRequest is NOT authenticated --> Abort authentication process!");
+
+ }
+
+ handleErrorNoRedirect(new EaafException("auth.20", null), req, resp, true);
+
+ }
+
+ } catch (final Exception e) {
+ log.error("Finalize authentication protocol FAILED.", e);
+ buildProtocolSpecificErrorResponse(e, req, resp, pendingReq);
+
+ }
+
+ // remove pending-request
+ requestStorage.removePendingRequest(pendingReq.getPendingRequestId());
+ revisionsLogger.logEvent(EventConstants.TRANSACTION_DESTROYED,
+ pendingReq.getUniqueTransactionIdentifier());
+
+ }
+
+
+ @Override
+ public void buildProtocolSpecificErrorResponse(final Throwable throwable,
+ final HttpServletRequest req, final HttpServletResponse resp, final IRequest protocolRequest)
+ throws EaafException, IOException {
+ try {
+
+ final Class> clazz = Class.forName(protocolRequest.requestedModule());
+
+ if (clazz == null || !IModulInfo.class.isAssignableFrom(clazz)) {
+ log.error(
+ "Requested protocol module Class is NULL or does not implement the IModulInfo interface.");
+ throw new Exception(
+ "Requested protocol module Class is NULL or does not implement the IModulInfo interface.");
+
+ }
+
+ final IModulInfo handlingModule = (IModulInfo) applicationContext.getBean(clazz);
+
+ if (handlingModule.generateErrorMessage(throwable, req, resp, protocolRequest)) {
+
+ // log Error to technical log
+ logExceptionToTechnicalLog(throwable);
+
+ // log Error Message
+ statisticLogger.logErrorOperation(throwable, protocolRequest);
+
+ // write revision log entries
+ revisionsLogger.logEvent(protocolRequest, EventConstants.TRANSACTION_ERROR,
+ protocolRequest.getUniqueTransactionIdentifier());
+
+ return;
+
+ } else {
+ handleErrorNoRedirect(throwable, req, resp, true);
+
+ }
+
+ } catch (final Throwable e) {
+ handleErrorNoRedirect(throwable, req, resp, true);
+
+ }
+
+ }
+
+ @Override
+ public void handleErrorNoRedirect(final Throwable throwable, final HttpServletRequest req,
+ final HttpServletResponse resp, final boolean writeExceptionToStatisticLog)
+ throws IOException, EaafException {
+
+ // log Exception into statistic database
+ if (writeExceptionToStatisticLog) {
+ statisticLogger.logErrorOperation(throwable);
+ }
+
+ // write errror to console
+ logExceptionToTechnicalLog(throwable);
+
+ // return error to Web browser
+ if (throwable instanceof EaafException || throwable instanceof ProcessExecutionException) {
+ internalMoaidExceptionHandler(req, resp, (Exception) throwable, false);
+ } else {
+ // write generic message for general exceptions
+ final String msg =
+ statusMessager.getMessage(IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC, null);
+ writeHtmlErrorResponse(req, resp, msg, "9199", null, (Exception) throwable);
+
+ }
+
+ }
+
+
+ public void setGuiBuilder(final IGuiFormBuilder guiBuilder) {
+ this.guiBuilder = guiBuilder;
+ }
+
+ /**
+ * Finalize the requested protocol operation.
+ *
+ * @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
+ * @throws Exception In case of an error
+ */
+ protected void internalFinalizeAuthenticationProcess(final HttpServletRequest req,
+ final HttpServletResponse resp, final IRequest pendingReq) throws Exception {
+
+ String newSsoSessionId = null;
+
+ // if Single Sign-On functionality is enabled for this request
+ if (pendingReq.needSingleSignOnFunctionality()) {
+ if (ssoManager != null) {
+ newSsoSessionId = ssoManager.createNewSsoSessionCookie(req, resp, pendingReq);
+ if (StringUtils.isEmpty(pendingReq.getInternalSsoSessionIdentifier())) {
+ ssoManager.createNewSsoSession(pendingReq, newSsoSessionId);
+ }
+
+ } else {
+ log.warn("SSO is requested but there is not SSO Session-Manager available");
+ }
+
+ }
+
+ // build authenticationdata from session information and OA configuration
+ final IAuthData authData = authDataBuilder.buildAuthenticationData(pendingReq);
+
+ // execute the protocol-specific action
+ final SloInformationInterface sloInformation =
+ executeProtocolSpecificAction(req, resp, pendingReq, authData);
+
+ // Store OA specific SSO session information if an SSO cookie is set
+ if (StringUtils.isNotEmpty(newSsoSessionId)) {
+ try {
+ ssoManager.updateSsoSession(pendingReq, newSsoSessionId, sloInformation);
+
+ } catch (final EaafSsoException e) {
+ log.warn("SSO Session information can not be stored -> SSO is not enabled!");
+ authmanager.performOnlyIdpLogOut(req, resp, pendingReq);
+
+ }
+
+ } else {
+ // remove MOASession from database
+ authmanager.performOnlyIdpLogOut(req, resp, pendingReq);
+
+ }
+
+ // Advanced statistic logging
+ statisticLogger.logSuccessOperation(pendingReq, authData,
+ StringUtils.isNotEmpty(newSsoSessionId));
+
+ }
+
+ /**
+ * Executes the requested protocol action.
+ *
+ * @param httpReq HttpServletRequest
+ * @param httpResp HttpServletResponse
+ * @param protocolRequest Authentication request which is actually in process
+ * @param authData Service-provider specific authentication data
+ *
+ * @return Return Single LogOut information or null if protocol supports no SSO
+ *
+ * @throws Exception in case of an error
+ */
+ private SloInformationInterface executeProtocolSpecificAction(final HttpServletRequest httpReq,
+ final HttpServletResponse httpResp, final IRequest pendingReq, final IAuthData authData)
+ throws Exception {
+ try {
+ // request needs no authentication --> start request processing
+ final Class> clazz = Class.forName(pendingReq.requestedAction());
+ if (clazz == null || !IAction.class.isAssignableFrom(clazz)) {
+ log.error(
+ "Requested protocol-action processing Class is NULL or does not implement the IAction interface.");
+ throw new Exception(
+ "Requested protocol-action processing Class is NULL or does not implement the IAction interface.");
+
+ }
+
+ final IAction protocolAction = (IAction) applicationContext.getBean(clazz);
+ return protocolAction.processRequest(pendingReq, httpReq, httpResp, authData);
+
+ } catch (final ClassNotFoundException e) {
+ log.error(
+ "Requested Auth. protocol processing Class is NULL or does not implement the IAction interface.");
+ throw new Exception(
+ "Requested Auth. protocol processing Class is NULL or does not implement the IAction interface.");
+ }
+
+ }
+
+ /**
+ * Write a Exception to the MOA-ID-Auth internal technical log.
+ *
+ * @param loggedException Exception to log
+ */
+ protected void logExceptionToTechnicalLog(final Throwable loggedException) {
+ if (!(loggedException instanceof EaafException
+ || loggedException instanceof ProcessExecutionException)) {
+ log.error("Receive an internal error: Message=" + loggedException.getMessage(),
+ loggedException);
+
+ } else {
+ if (loggedException instanceof EaafAuthenticationException && ERROR_LOGGER_ON_INFO_LEVEL
+ .contains(((EaafAuthenticationException) loggedException).getErrorId())) {
+ if (log.isDebugEnabled() || log.isTraceEnabled()) {
+ log.info(loggedException.getMessage(), loggedException);
+
+ } else {
+ log.info(loggedException.getMessage());
+
+ }
+
+ } else {
+ if (log.isDebugEnabled() || log.isTraceEnabled()) {
+ log.warn(loggedException.getMessage(), loggedException);
+
+ } else {
+ log.warn(loggedException.getMessage());
+
+ }
+ }
+ }
+ }
+
+ private void writeHtmlErrorResponse(@NonNull final HttpServletRequest httpReq,
+ @NonNull final HttpServletResponse httpResp, @NonNull final String msg,
+ @NonNull final String errorCode, @Nullable final Object[] params,
+ @NonNull final Exception error) throws IOException, EaafException {
+
+ try {
+ final IGuiBuilderConfiguration config =
+ guiConfigFactory.getDefaultErrorGui(HttpUtils.extractAuthUrlFromRequest(httpReq));
+
+
+ String[] errorCodeParams = null;
+ if (params == null) {
+ errorCodeParams = new String[] {};
+ } else {
+ errorCodeParams = new String[params.length];
+ for (int i = 0; i < params.length; i++) {
+ if (params[i] != null) {
+ errorCodeParams[i] = params[i].toString();
+ } else {
+ errorCodeParams[i] = "null";
+ }
+
+ }
+ }
+
+
+
+ // add errorcode and errormessage
+ if (config instanceof ModifyableGuiBuilderConfiguration) {
+ ((ModifyableGuiBuilderConfiguration) config).putCustomParameter(
+ AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_ERROMSG, msg);
+ ((ModifyableGuiBuilderConfiguration) config).putCustomParameter(
+ AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_ERRORCODE, errorCode);
+ ((ModifyableGuiBuilderConfiguration) config).putCustomParameterWithOutEscaption(
+ AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_ERRORCODEPARAMS,
+ ArrayUtils.toString(errorCodeParams));
+
+ // add stacktrace if debug is enabled
+ if (log.isTraceEnabled()) {
+ ((ModifyableGuiBuilderConfiguration) config).putCustomParameter(
+ AbstractGuiFormBuilderConfiguration.PARAM_GROUP_MSG, PARAM_GUI_ERRORSTACKTRACE,
+ getStacktraceFromException(error));
+
+ }
+
+ } else {
+ log.info(
+ "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);
+
+
+ }
+
+ }
+
+ private String getStacktraceFromException(final Exception ex) {
+ final StringWriter errors = new StringWriter();
+ ex.printStackTrace(new PrintWriter(errors));
+ return errors.toString();
+
+ }
+
+ private void internalMoaidExceptionHandler(final HttpServletRequest req,
+ final HttpServletResponse resp, final Exception e, final boolean writeExceptionToStatisicLog)
+ throws IOException, EaafException {
+ if (e instanceof ProtocolNotActiveException) {
+ resp.getWriter().write(e.getMessage());
+ resp.setContentType(EAAFConstants.CONTENTTYPE_HTML_UTF8);
+ resp.sendError(HttpServletResponse.SC_FORBIDDEN,
+ StringEscapeUtils.escapeHtml4(StringEscapeUtils.escapeEcmaScript(e.getMessage())));
+
+ } else if (e instanceof AuthnRequestValidatorException) {
+ final AuthnRequestValidatorException ex = (AuthnRequestValidatorException) e;
+ // log Error Message
+ if (writeExceptionToStatisicLog) {
+ statisticLogger.logErrorOperation(ex, ex.getErrorRequest());
+ }
+
+ // write error message
+ // writeBadRequestErrorResponse(req, resp, (EAAFException) e);
+ writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
+ null, e);
+
+ } else if (e instanceof InvalidProtocolRequestException) {
+ // send error response
+ // writeBadRequestErrorResponse(req, resp, (EAAFException) e);
+ writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
+ null, e);
+
+ } else if (e instanceof ConfigurationException) {
+ // send HTML formated error message
+ writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
+ null, e);
+
+ } else if (e instanceof EaafException) {
+ // send HTML formated error message
+ writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
+ ((EaafException) e).getParams(), e);
+
+ } else if (e instanceof ProcessExecutionException) {
+ // send HTML formated error message
+ writeHtmlErrorResponse(req, resp, e.getMessage(), statusMessager.getResponseErrorCode(e),
+ null, e);
+
+ }
+
+ }
+
+
}
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 77bd9b8a..fc36f492 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
@@ -1,68 +1,82 @@
/*
- * 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.
+ * 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/
+ * 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.
+ * 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.
+ * 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.builder;
import at.gv.egiz.eaaf.core.api.idp.IAttributeGenerator;
/**
+ * Simple String attribute generator that only generates attribute values as String.
+ *
* @author tlenz
*
*/
public class SimpleStringAttributeGenerator implements IAttributeGenerator {
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator#buildStringAttribute(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override
- public String buildStringAttribute(String friendlyName, String name, String value) {
- return value;
-
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * 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) {
+ return value;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * 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) {
+ return String.valueOf(value);
+
+ }
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator#buildIntegerAttribute(java.lang.String, java.lang.String, int)
- */
- @Override
- public String buildIntegerAttribute(String friendlyName, String name, int value) {
- return String.valueOf(value);
-
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * 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) {
+ return String.valueOf(value);
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator#buildLongAttribute(java.lang.String, java.lang.String, long)
- */
- @Override
- public String buildLongAttribute(String friendlyName, String name, long value) {
- return String.valueOf(value);
-
- }
+ }
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.protocols.builder.attributes.IAttributeGenerator#buildEmptyAttribute(java.lang.String, java.lang.String)
- */
- @Override
- public String buildEmptyAttribute(String friendlyName, String name) {
- return null;
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * 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) {
+ return 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
deleted file mode 100644
index 714ffc9d..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BPKAttributeBuilder.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
-
-import javax.annotation.Nonnull;
-
-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.exceptions.AttributeBuilderException;
-import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
-
-@PVPMETADATA
-public class BPKAttributeBuilder implements IPVPAttributeBuilder {
-
- private static final Logger log = LoggerFactory.getLogger(BPKAttributeBuilder.class);
- public static final String DELIMITER_BPKTYPE_BPK = ":";
-
- @Override
- public String getName() {
- return BPK_NAME;
- }
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
- final String result = getBpkForSP(authData);
- log.trace("Authenticate user with bPK/wbPK: " + result);
- return g.buildStringAttribute(BPK_FRIENDLY_NAME, BPK_NAME, result);
-
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(BPK_FRIENDLY_NAME, BPK_NAME);
- }
-
- /**
- * Generate the bPK String for this specific SP
- *
- * @param authData
- * @return
- * @throws UnavailableAttributeException
- */
- protected String getBpkForSP(IAuthData authData) throws UnavailableAttributeException {
- final String bpk = attrMaxSize(authData.getBPK());
- final String type = removeBpkTypePrefix(authData.getBPKType());
-
- if (StringUtils.isEmpty(bpk))
- throw new UnavailableAttributeException(BPK_NAME);
-
- return type + DELIMITER_BPKTYPE_BPK + bpk;
-
- }
-
- /**
- * Limit the attribute value to maximum size
- *
- * @param attr
- * @return
- */
- protected String attrMaxSize(String attr) {
- if (attr != null && attr.length() > BPK_MAX_LENGTH) {
- attr = attr.substring(0, BPK_MAX_LENGTH);
- }
- return attr;
-
- }
-
- /**
- * Remove bPKType prefix if available
- *
- * @param type
- * @return
- */
- @Nonnull
- protected String removeBpkTypePrefix(@Nonnull 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());
-
- else
- return type;
-
- }
-}
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 c52a5d82..505ba137 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
@@ -1,67 +1,60 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
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.IPvpAttributeBuilder;
+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;
-@PVPMETADATA
-public class BirthdateAttributeBuilder implements IPVPAttributeBuilder {
-
- @Override
- public String getName() {
- return BIRTHDATE_NAME;
- }
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
-
- if (authData.getDateOfBirth() != null) {
- final DateFormat pvpDateFormat = new SimpleDateFormat(BIRTHDATE_FORMAT_PATTERN);
- final String dateString = pvpDateFormat.format(authData.getDateOfBirth());
-
- return g.buildStringAttribute(BIRTHDATE_FRIENDLY_NAME, BIRTHDATE_NAME, dateString);
-
- } else
- throw new UnavailableAttributeException(BIRTHDATE_NAME);
-
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(BIRTHDATE_FRIENDLY_NAME, BIRTHDATE_NAME);
- }
-
+@PvpMetadata
+public class BirthdateAttributeBuilder implements IPvpAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return BIRTHDATE_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+
+ if (authData.getDateOfBirth() != null) {
+ final DateFormat pvpDateFormat = new SimpleDateFormat(BIRTHDATE_FORMAT_PATTERN);
+ final String dateString = pvpDateFormat.format(authData.getDateOfBirth());
+
+ return g.buildStringAttribute(BIRTHDATE_FRIENDLY_NAME, BIRTHDATE_NAME, dateString);
+
+ } else {
+ throw new UnavailableAttributeException(BIRTHDATE_NAME);
+ }
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(BIRTHDATE_FRIENDLY_NAME, BIRTHDATE_NAME);
+ }
+
}
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
new file mode 100644
index 00000000..2908ebdf
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/BpkAttributeBuilder.java
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
+
+import javax.annotation.Nonnull;
+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.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 {
+
+ private static final Logger log = LoggerFactory.getLogger(BpkAttributeBuilder.class);
+ public static final String DELIMITER_BPKTYPE_BPK = ":";
+
+ @Override
+ public String getName() {
+ return BPK_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+ final String result = getBpkForSP(authData);
+ log.trace("Authenticate user with bPK/wbPK: " + result);
+ return g.buildStringAttribute(BPK_FRIENDLY_NAME, BPK_NAME, result);
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(BPK_FRIENDLY_NAME, BPK_NAME);
+ }
+
+ protected String getBpkForSP(final IAuthData authData) throws UnavailableAttributeException {
+ final String bpk = attrMaxSize(authData.getBpk());
+ final String type = removeBpkTypePrefix(authData.getBpkType());
+
+ if (StringUtils.isEmpty(bpk)) {
+ throw new UnavailableAttributeException(BPK_NAME);
+ }
+
+ return type + DELIMITER_BPKTYPE_BPK + bpk;
+
+ }
+
+ protected String attrMaxSize(String attr) {
+ if (attr != null && attr.length() > BPK_MAX_LENGTH) {
+ attr = attr.substring(0, BPK_MAX_LENGTH);
+ }
+ return attr;
+
+ }
+
+ @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());
+ } 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
deleted file mode 100644
index ec0f5d0c..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDCcsURL.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
-
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-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.exceptions.AttributeBuilderException;
-import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
-
-@PVPMETADATA
-public class EIDCcsURL implements IPVPAttributeBuilder {
- private static final Logger log = LoggerFactory.getLogger(EID_CCS_URL_NAME);
-
- @Override
- public String getName() {
- return EID_CCS_URL_NAME;
- }
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
- if (authData instanceof IEidAuthData) {
- final String bkuurl = ((IEidAuthData)authData).getVdaEndPointUrl();
- if (StringUtils.isNotEmpty(bkuurl))
- 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");
-
- throw new UnavailableAttributeException(EID_CCS_URL_NAME);
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(EID_CCS_URL_FRIENDLY_NAME, EID_CCS_URL_NAME);
- }
-
-}
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
deleted file mode 100644
index 698393ea..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDEIDTokenBuilder.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright 2019 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-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.exceptions.AttributeBuilderException;
-import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
-
-@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 build(final ISPConfiguration oaParam, final IAuthData authData,
- final IAttributeGenerator g) throws AttributeBuilderException {
-
- if (authData instanceof IEidAuthData) {
- if (((IEidAuthData)authData).getEIDToken() == null)
- throw new UnavailableAttributeException(EID_E_ID_TOKEN_NAME);
-
- return g.buildStringAttribute(EID_E_ID_TOKEN_FRIENDLY_NAME,
- EID_E_ID_TOKEN_NAME, Base64Utils.encodeToString(((IEidAuthData)authData).getEIDToken()));
- } else
- log.info(EID_E_ID_TOKEN_FRIENDLY_NAME + " is only available in AuthHandler context");
-
- throw new UnavailableAttributeException(EID_E_ID_TOKEN_NAME);
- }
-
- @Override
- public ATT buildEmpty(final IAttributeGenerator g) {
- return g.buildEmptyAttribute(EID_E_ID_TOKEN_FRIENDLY_NAME,
- EID_E_ID_TOKEN_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
deleted file mode 100644
index 3fbdaf66..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDEncryptedSourceIdAttributeBuilder.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright 2019 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.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.exceptions.AttributeBuilderException;
-
-public class EIDEncryptedSourceIdAttributeBuilder implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g)
- throws AttributeBuilderException {
- return g.buildStringAttribute(getFriendlyName(), getName(), authData.getEncryptedSourceId());
-
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(getFriendlyName(), getName());
-
- }
-
- @Override
- public String getName() {
- return EID_ENCRYPTED_SOURCEID_NAME;
- }
-
- private String getFriendlyName() {
- return EID_ENCRYPTED_SOURCEID_FRIENDLY_NAME;
- }
-
-}
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
deleted file mode 100644
index 440ccf59..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDEncryptedSourceIdTypeAttributeBuilder.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright 2019 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.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.exceptions.AttributeBuilderException;
-
-public class EIDEncryptedSourceIdTypeAttributeBuilder implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g)
- throws AttributeBuilderException {
- return g.buildStringAttribute(getFriendlyName(), getName(), authData.getEncryptedSourceIdType());
-
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(getFriendlyName(), getName());
-
- }
-
- @Override
- public String getName() {
- return EID_ENCRYPTED_SOURCEID_TYPE_NAME;
- }
-
- private String getFriendlyName() {
- return EID_ENCRYPTED_SOURCEID_TYPE_FRIENDLY_NAME;
- }
-
-}
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
deleted file mode 100644
index 8a2cabbc..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDIdentityLinkBuilder.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.exceptions.AttributeBuilderException;
-import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
-
-@Deprecated
-@PVPMETADATA
-public class EIDIdentityLinkBuilder implements IPVPAttributeBuilder {
- private static final Logger log = LoggerFactory.getLogger(EIDIdentityLinkBuilder.class);
-
-
- public String getName() {
- return EID_IDENTITY_LINK_NAME;
- }
-
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
- try {
- String ilAssertion = null;
- if (authData.getIdentityLink() == null)
- throw new UnavailableAttributeException(EID_IDENTITY_LINK_NAME);
-
- ilAssertion = authData.getIdentityLink().getSerializedSamlAssertion();
-
- return g.buildStringAttribute(EID_IDENTITY_LINK_FRIENDLY_NAME,
- EID_IDENTITY_LINK_NAME, Base64Utils.encodeToString(ilAssertion.getBytes("UTF-8")));
-
-
- } catch (IOException e) {
- log.warn("IdentityLink serialization error.", e);
- return g.buildEmptyAttribute(EID_IDENTITY_LINK_FRIENDLY_NAME,
- EID_IDENTITY_LINK_NAME);
- }
-
- }
-
- public ATT buildEmpty(IAttributeGenerator g) {
- 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/EIDIssuingNationAttributeBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDIssuingNationAttributeBuilder.java
deleted file mode 100644
index a52197cb..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDIssuingNationAttributeBuilder.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.exceptions.AttributeBuilderException;
-
-@PVPMETADATA
-public class EIDIssuingNationAttributeBuilder implements IPVPAttributeBuilder {
-
- public String getName() {
- return EID_ISSUING_NATION_NAME;
- }
-
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
- String countryCode = authData.getCiticenCountryCode();
- if (StringUtils.isNotEmpty(countryCode))
- return g.buildStringAttribute(EID_ISSUING_NATION_FRIENDLY_NAME,
- EID_ISSUING_NATION_NAME, countryCode);
-
- else
- return null;
- }
-
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(EID_ISSUING_NATION_FRIENDLY_NAME,
- EID_ISSUING_NATION_NAME);
- }
-
-}
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
deleted file mode 100644
index 39c9db8f..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDSectorForIDAttributeBuilder.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.exceptions.AttributeBuilderException;
-import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
-
-@PVPMETADATA
-public class EIDSectorForIDAttributeBuilder implements IPVPAttributeBuilder {
-
- public String getName() {
- return EID_SECTOR_FOR_IDENTIFIER_NAME;
- }
-
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
- String bpktype = authData.getBPKType();
-
- if (StringUtils.isEmpty(authData.getBPKType()))
- throw new UnavailableAttributeException(EID_SECTOR_FOR_IDENTIFIER_NAME);
-
- return g.buildStringAttribute(EID_SECTOR_FOR_IDENTIFIER_FRIENDLY_NAME,
- EID_SECTOR_FOR_IDENTIFIER_NAME, bpktype);
- }
-
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(EID_SECTOR_FOR_IDENTIFIER_FRIENDLY_NAME,
- EID_SECTOR_FOR_IDENTIFIER_NAME);
- }
-
-}
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
deleted file mode 100644
index bab521b4..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDSignerCertificate.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright 2019 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-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.exceptions.AttributeBuilderException;
-import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
-
-@PVPMETADATA
-public class EIDSignerCertificate implements IPVPAttributeBuilder {
- private static final Logger log = LoggerFactory.getLogger(EIDSignerCertificate.class);
-
- @Override
- public String getName() {
- return EID_SIGNER_CERTIFICATE_NAME;
- }
-
- @Override
- public ATT build(final ISPConfiguration oaParam, final IAuthData authData,
- final IAttributeGenerator g) throws AttributeBuilderException {
-
- if (authData instanceof IEidAuthData) {
- try {
-
- final byte[] signerCertificate = ((IEidAuthData)authData).getSignerCertificate();
- if (signerCertificate != null) {
- return g.buildStringAttribute(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME, EID_SIGNER_CERTIFICATE_NAME,
- Base64Utils.encodeToString(signerCertificate));
-
- } else
- log.info(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME + " is only available in MOA-ID context");
-
- } catch (final Exception e) {
- log.info("Signer certificate BASE64 encoding error");
-
- }
-
- } else
- log.info(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME + " is only available in AuthHandler context");
-
-
- throw new UnavailableAttributeException(EID_SIGNER_CERTIFICATE_NAME);
-
- }
-
- @Override
- public ATT buildEmpty(final IAttributeGenerator g) {
- return g.buildEmptyAttribute(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME, 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
deleted file mode 100644
index 4db2d87d..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDSourcePIN.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.exceptions.AttributeBuilderException;
-import at.gv.egiz.eaaf.core.exceptions.AttributePolicyException;
-import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
-
-@Deprecated
-@PVPMETADATA
-public class EIDSourcePIN implements IPVPAttributeBuilder {
-
- public String getName() {
- return EID_SOURCE_PIN_NAME;
- }
-
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
-
- if (authData.isBaseIDTransferRestrication())
- throw new AttributePolicyException(EID_SOURCE_PIN_NAME);
-
- else {
- if (StringUtils.isEmpty(authData.getIdentificationValue()))
- throw new UnavailableAttributeException(EID_SOURCE_PIN_NAME);
-
- return g.buildStringAttribute(EID_SOURCE_PIN_FRIENDLY_NAME, EID_SOURCE_PIN_NAME, authData.getIdentificationValue());
- }
- }
-
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(EID_SOURCE_PIN_FRIENDLY_NAME, EID_SOURCE_PIN_NAME);
- }
-
-}
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
deleted file mode 100644
index 42e47a42..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDSourcePINType.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.exceptions.AttributeBuilderException;
-import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
-
-@Deprecated
-@PVPMETADATA
-public class EIDSourcePINType implements IPVPAttributeBuilder {
-
- public String getName() {
- return EID_SOURCE_PIN_TYPE_NAME;
- }
-
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
-
- if (authData.isBaseIDTransferRestrication())
- throw new UnavailableAttributeException(EID_SOURCE_PIN_TYPE_NAME);
-
- else {
- return g.buildStringAttribute(EID_SOURCE_PIN_TYPE_FRIENDLY_NAME, EID_SOURCE_PIN_TYPE_NAME, authData.getIdentificationType());
- }
- }
-
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(EID_SOURCE_PIN_TYPE_FRIENDLY_NAME, EID_SOURCE_PIN_TYPE_NAME);
- }
-
-}
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
deleted file mode 100644
index 1e7b323b..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EIDeIDASQAALevelAttributeBuilder.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.exceptions.AttributeBuilderException;
-
-@PVPMETADATA
-public class EIDeIDASQAALevelAttributeBuilder implements IPVPAttributeBuilder {
-
- public String getName() {
- return EID_CITIZEN_EIDAS_QAA_LEVEL_NAME;
- }
-
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
-
- return g.buildStringAttribute(EID_CITIZEN_EIDAS_QAA_LEVEL_FRIENDLY_NAME,
- EID_CITIZEN_EIDAS_QAA_LEVEL_NAME, authData.getEIDASQAALevel());
- }
-
-
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(EID_CITIZEN_EIDAS_QAA_LEVEL_FRIENDLY_NAME,
- EID_CITIZEN_EIDAS_QAA_LEVEL_NAME);
- }
-
-}
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
new file mode 100644
index 00000000..8029d769
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidCcsUrl.java
@@ -0,0 +1,46 @@
+package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.exceptions.AttributeBuilderException;
+import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
+
+@PvpMetadata
+public class EidCcsUrl implements IPvpAttributeBuilder {
+ private static final Logger log = LoggerFactory.getLogger(EID_CCS_URL_NAME);
+
+ @Override
+ public String getName() {
+ return EID_CCS_URL_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+ if (authData instanceof IEidAuthData) {
+ final String bkuurl = ((IEidAuthData) authData).getVdaEndPointUrl();
+ if (StringUtils.isNotEmpty(bkuurl)) {
+ 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");
+ }
+
+ throw new UnavailableAttributeException(EID_CCS_URL_NAME);
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(EID_CCS_URL_FRIENDLY_NAME, EID_CCS_URL_NAME);
+ }
+
+}
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
new file mode 100644
index 00000000..ccc2b4e8
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidTokenBuilder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2019 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.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.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 build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+
+ if (authData instanceof IEidAuthData) {
+ if (((IEidAuthData) authData).getEidToken() == null) {
+ throw new UnavailableAttributeException(EID_E_ID_TOKEN_NAME);
+ }
+
+ return g.buildStringAttribute(EID_E_ID_TOKEN_FRIENDLY_NAME, EID_E_ID_TOKEN_NAME,
+ Base64Utils.encodeToString(((IEidAuthData) authData).getEidToken()));
+ } else {
+ log.info(EID_E_ID_TOKEN_FRIENDLY_NAME + " is only available in AuthHandler context");
+ }
+
+ throw new UnavailableAttributeException(EID_E_ID_TOKEN_NAME);
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(EID_E_ID_TOKEN_FRIENDLY_NAME, EID_E_ID_TOKEN_NAME);
+ }
+
+}
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
new file mode 100644
index 00000000..858baf40
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEidasQaaLevelAttributeBuilder.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+ */
+
+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.exceptions.AttributeBuilderException;
+
+@PvpMetadata
+public class EidEidasQaaLevelAttributeBuilder implements IPvpAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return EID_CITIZEN_EIDAS_QAA_LEVEL_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+
+ return g.buildStringAttribute(EID_CITIZEN_EIDAS_QAA_LEVEL_FRIENDLY_NAME,
+ EID_CITIZEN_EIDAS_QAA_LEVEL_NAME, authData.getEidasQaaLevel());
+ }
+
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(EID_CITIZEN_EIDAS_QAA_LEVEL_FRIENDLY_NAME,
+ EID_CITIZEN_EIDAS_QAA_LEVEL_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
new file mode 100644
index 00000000..e828d11c
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdAttributeBuilder.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2019 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.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.exceptions.AttributeBuilderException;
+
+public class EidEncryptedSourceIdAttributeBuilder
+ implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator g)
+ throws AttributeBuilderException {
+ return g.buildStringAttribute(getFriendlyName(), getName(), authData.getEncryptedSourceId());
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(getFriendlyName(), getName());
+
+ }
+
+ @Override
+ public String getName() {
+ return EID_ENCRYPTED_SOURCEID_NAME;
+ }
+
+ private String getFriendlyName() {
+ return EID_ENCRYPTED_SOURCEID_FRIENDLY_NAME;
+ }
+
+}
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
new file mode 100644
index 00000000..a1a245d1
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidEncryptedSourceIdTypeAttributeBuilder.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.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.exceptions.AttributeBuilderException;
+
+public class EidEncryptedSourceIdTypeAttributeBuilder
+ implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator g)
+ throws AttributeBuilderException {
+ return g.buildStringAttribute(getFriendlyName(), getName(),
+ authData.getEncryptedSourceIdType());
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(getFriendlyName(), getName());
+
+ }
+
+ @Override
+ public String getName() {
+ return EID_ENCRYPTED_SOURCEID_TYPE_NAME;
+ }
+
+ private String getFriendlyName() {
+ return EID_ENCRYPTED_SOURCEID_TYPE_FRIENDLY_NAME;
+ }
+
+}
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
new file mode 100644
index 00000000..8f629795
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIdentityLinkBuilder.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
+
+import java.io.IOException;
+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.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 build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+ try {
+ String ilAssertion = null;
+ if (authData.getIdentityLink() == null) {
+ throw new UnavailableAttributeException(EID_IDENTITY_LINK_NAME);
+ }
+
+ ilAssertion = authData.getIdentityLink().getSerializedSamlAssertion();
+
+ 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);
+ }
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ 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 6a8de559..2f70e3e0 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
@@ -6,42 +6,45 @@ import org.slf4j.LoggerFactory;
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.IPvpAttributeBuilder;
+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;
-@PVPMETADATA
-public class EidIdentityStatusLevelAttributeBuiler implements IPVPAttributeBuilder {
- private static final Logger log = LoggerFactory.getLogger(EidIdentityStatusLevelAttributeBuiler.class);
-
- @Override
- public String getName() {
- return EID_IDENTITY_STATUS_LEVEL_NAME;
- }
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g)
- throws AttributeBuilderException {
-
- if (authData instanceof IEidAuthData) {
- if (((IEidAuthData)authData).getEIDStatus() == null)
- throw new UnavailableAttributeException(getName());
-
- return g.buildStringAttribute(getFriendlyName(),
- getName(), ((IEidAuthData)authData).getEIDStatus().getURI());
- } else
- log.info(getFriendlyName() + " is only available in EAAF context");
-
- throw new UnavailableAttributeException(getName());
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(getFriendlyName(), getName());
- }
-
- private String getFriendlyName() {
- return EID_IDENTITY_STATUS_LEVEL_FRIENDLY_NAME;
- }
+@PvpMetadata
+public class EidIdentityStatusLevelAttributeBuiler implements IPvpAttributeBuilder {
+ private static final Logger log =
+ LoggerFactory.getLogger(EidIdentityStatusLevelAttributeBuiler.class);
+
+ @Override
+ public String getName() {
+ return EID_IDENTITY_STATUS_LEVEL_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+
+ if (authData instanceof IEidAuthData) {
+ if (((IEidAuthData) authData).getEidStatus() == null) {
+ throw new UnavailableAttributeException(getName());
+ }
+
+ return g.buildStringAttribute(getFriendlyName(), getName(),
+ ((IEidAuthData) authData).getEidStatus().getURI());
+ } else {
+ log.info(getFriendlyName() + " is only available in EAAF context");
+ }
+
+ throw new UnavailableAttributeException(getName());
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(getFriendlyName(), getName());
+ }
+
+ private String getFriendlyName() {
+ return EID_IDENTITY_STATUS_LEVEL_FRIENDLY_NAME;
+ }
}
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
new file mode 100644
index 00000000..04c2b379
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidIssuingNationAttributeBuilder.java
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.exceptions.AttributeBuilderException;
+import org.apache.commons.lang3.StringUtils;
+
+@PvpMetadata
+public class EidIssuingNationAttributeBuilder implements IPvpAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return EID_ISSUING_NATION_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+ final String countryCode = authData.getCiticenCountryCode();
+ if (StringUtils.isNotEmpty(countryCode)) {
+ return g.buildStringAttribute(EID_ISSUING_NATION_FRIENDLY_NAME, EID_ISSUING_NATION_NAME,
+ countryCode);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(EID_ISSUING_NATION_FRIENDLY_NAME, EID_ISSUING_NATION_NAME);
+ }
+
+}
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
new file mode 100644
index 00000000..f5e37792
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSectorForIdAttributeBuilder.java
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.exceptions.AttributeBuilderException;
+import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
+import org.apache.commons.lang3.StringUtils;
+
+@PvpMetadata
+public class EidSectorForIdAttributeBuilder implements IPvpAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return EID_SECTOR_FOR_IDENTIFIER_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+ final String bpktype = authData.getBpkType();
+
+ if (StringUtils.isEmpty(authData.getBpkType())) {
+ throw new UnavailableAttributeException(EID_SECTOR_FOR_IDENTIFIER_NAME);
+ }
+
+ return g.buildStringAttribute(EID_SECTOR_FOR_IDENTIFIER_FRIENDLY_NAME,
+ EID_SECTOR_FOR_IDENTIFIER_NAME, bpktype);
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(EID_SECTOR_FOR_IDENTIFIER_FRIENDLY_NAME,
+ EID_SECTOR_FOR_IDENTIFIER_NAME);
+ }
+
+}
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
new file mode 100644
index 00000000..8ba7f255
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSignerCertificate.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2019 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+ */
+
+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.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.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 {
+ private static final Logger log = LoggerFactory.getLogger(EidSignerCertificate.class);
+
+ @Override
+ public String getName() {
+ return EID_SIGNER_CERTIFICATE_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+
+ if (authData instanceof IEidAuthData) {
+ try {
+
+ final byte[] signerCertificate = ((IEidAuthData) authData).getSignerCertificate();
+ if (signerCertificate != null) {
+ return g.buildStringAttribute(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME,
+ EID_SIGNER_CERTIFICATE_NAME, Base64Utils.encodeToString(signerCertificate));
+
+ } else {
+ log.info(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME + " is only available in MOA-ID context");
+ }
+
+ } catch (final Exception e) {
+ log.info("Signer certificate BASE64 encoding error");
+
+ }
+
+ } else {
+ log.info(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME + " is only available in AuthHandler context");
+ }
+
+
+ throw new UnavailableAttributeException(EID_SIGNER_CERTIFICATE_NAME);
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(EID_SIGNER_CERTIFICATE_FRIENDLY_NAME, 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
new file mode 100644
index 00000000..fd2d51bb
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePin.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+ */
+
+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.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
+public class EidSourcePin implements IPvpAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return EID_SOURCE_PIN_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+
+ if (authData.isBaseIdTransferRestrication()) {
+ throw new AttributePolicyException(EID_SOURCE_PIN_NAME);
+ } else {
+ if (StringUtils.isEmpty(authData.getIdentificationValue())) {
+ throw new UnavailableAttributeException(EID_SOURCE_PIN_NAME);
+ }
+
+ return g.buildStringAttribute(EID_SOURCE_PIN_FRIENDLY_NAME, EID_SOURCE_PIN_NAME,
+ authData.getIdentificationValue());
+ }
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(EID_SOURCE_PIN_FRIENDLY_NAME, EID_SOURCE_PIN_NAME);
+ }
+
+}
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
new file mode 100644
index 00000000..2a02fb05
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/EidSourcePinType.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+ */
+
+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.exceptions.AttributeBuilderException;
+import at.gv.egiz.eaaf.core.exceptions.UnavailableAttributeException;
+
+@Deprecated
+@PvpMetadata
+public class EidSourcePinType implements IPvpAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return EID_SOURCE_PIN_TYPE_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+
+ if (authData.isBaseIdTransferRestrication()) {
+ throw new UnavailableAttributeException(EID_SOURCE_PIN_TYPE_NAME);
+ } else {
+ return g.buildStringAttribute(EID_SOURCE_PIN_TYPE_FRIENDLY_NAME, EID_SOURCE_PIN_TYPE_NAME,
+ authData.getIdentificationType());
+ }
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(EID_SOURCE_PIN_TYPE_FRIENDLY_NAME, EID_SOURCE_PIN_TYPE_NAME);
+ }
+
+}
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 87512b03..bbd7a06c 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
@@ -1,60 +1,54 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
+ * 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.
+ */
-import org.apache.commons.lang3.StringUtils;
+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.IPvpAttributeBuilder;
+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 {
-@PVPMETADATA
-public class GivenNameAttributeBuilder implements IPVPAttributeBuilder {
+ @Override
+ public String getName() {
+ return GIVEN_NAME_NAME;
+ }
- @Override
- public String getName() {
- return GIVEN_NAME_NAME;
- }
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+ if (StringUtils.isNotEmpty(authData.getGivenName())) {
+ return g.buildStringAttribute(GIVEN_NAME_FRIENDLY_NAME, GIVEN_NAME_NAME,
+ authData.getGivenName());
+ } else {
+ throw new UnavailableAttributeException(GIVEN_NAME_NAME);
+ }
+ }
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
- if (StringUtils.isNotEmpty(authData.getGivenName()))
- return g.buildStringAttribute(GIVEN_NAME_FRIENDLY_NAME, GIVEN_NAME_NAME, authData.getGivenName());
- else
- throw new UnavailableAttributeException(GIVEN_NAME_NAME);
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(GIVEN_NAME_FRIENDLY_NAME, GIVEN_NAME_NAME);
- }
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(GIVEN_NAME_FRIENDLY_NAME, GIVEN_NAME_NAME);
+ }
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PVPMETADATA.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PVPMETADATA.java
deleted file mode 100644
index 81ad2126..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PVPMETADATA.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
-
-import java.lang.annotation.Retention;
-
-@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
-public @interface PVPMETADATA {
-
-}
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
deleted file mode 100644
index 38377641..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PVPVersionAttributeBuilder.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.exceptions.AttributeBuilderException;
-
-@PVPMETADATA
-public class PVPVersionAttributeBuilder implements IPVPAttributeBuilder {
-
- public String getName() {
- return PVP_VERSION_NAME;
- }
-
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
- return g.buildStringAttribute(PVP_VERSION_FRIENDLY_NAME, PVP_VERSION_NAME, PVP_VERSION_2_1);
- }
-
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(PVP_VERSION_FRIENDLY_NAME, PVP_VERSION_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 d753550e..bbe9b741 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
@@ -1,60 +1,54 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
+ * 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.
+*/
-import org.apache.commons.lang3.StringUtils;
+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.IPvpAttributeBuilder;
+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 {
+
+ @Override
+ public String getName() {
+ return PRINCIPAL_NAME_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+ if (StringUtils.isNotEmpty(authData.getFamilyName())) {
+ return g.buildStringAttribute(PRINCIPAL_NAME_FRIENDLY_NAME, PRINCIPAL_NAME_NAME,
+ authData.getFamilyName());
+ } else {
+ throw new UnavailableAttributeException(PRINCIPAL_NAME_NAME);
+ }
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(PRINCIPAL_NAME_FRIENDLY_NAME, PRINCIPAL_NAME_NAME);
+ }
-@PVPMETADATA
-public class PrincipalNameAttributeBuilder implements IPVPAttributeBuilder {
-
- @Override
- public String getName() {
- return PRINCIPAL_NAME_NAME;
- }
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData,
- IAttributeGenerator g) throws AttributeBuilderException {
- if (StringUtils.isNotEmpty(authData.getFamilyName()))
- return g.buildStringAttribute(PRINCIPAL_NAME_FRIENDLY_NAME, PRINCIPAL_NAME_NAME, authData.getFamilyName());
- else
- throw new UnavailableAttributeException(PRINCIPAL_NAME_NAME);
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(PRINCIPAL_NAME_FRIENDLY_NAME, PRINCIPAL_NAME_NAME);
- }
-
}
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PvpMetadata.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PvpMetadata.java
new file mode 100644
index 00000000..6d1c40f9
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PvpMetadata.java
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+package at.gv.egiz.eaaf.core.impl.idp.builder.attributes;
+
+import java.lang.annotation.Retention;
+
+@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
+public @interface PvpMetadata {
+
+}
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
new file mode 100644
index 00000000..5ff68721
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/PvpVersionAttributeBuilder.java
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.exceptions.AttributeBuilderException;
+
+@PvpMetadata
+public class PvpVersionAttributeBuilder implements IPvpAttributeBuilder {
+
+ @Override
+ public String getName() {
+ return PVP_VERSION_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData,
+ final IAttributeGenerator g) throws AttributeBuilderException {
+ return g.buildStringAttribute(PVP_VERSION_FRIENDLY_NAME, PVP_VERSION_NAME, PVP_VERSION_2_1);
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(PVP_VERSION_FRIENDLY_NAME, PVP_VERSION_NAME);
+ }
+
+}
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
deleted file mode 100644
index 9a365eb3..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SPCountryCodeAttributeBuilder.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.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.exceptions.AttributeBuilderException;
-
-public class SPCountryCodeAttributeBuilder implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
-
- @Override
- public String getName() {
- return SP_COUNTRYCODE_NAME;
- }
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g)
- throws AttributeBuilderException {
- //this attribute can not generated yet
- return null;
-// return g.buildStringAttribute(
-// SP_COUNTRYCODE_FRIENDLY_NAME,
-// SP_COUNTRYCODE_NAME,
-// oaParam.getFriendlyName());
-
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(SP_COUNTRYCODE_FRIENDLY_NAME, SP_COUNTRYCODE_NAME);
-
- }
-
-}
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
deleted file mode 100644
index 2062f35b..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SPFriendlyNameAttributeBuilder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.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.exceptions.AttributeBuilderException;
-
-public class SPFriendlyNameAttributeBuilder implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
-
- @Override
- public String getName() {
- return SP_FRIENDLYNAME_NAME;
- }
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g)
- throws AttributeBuilderException {
- return g.buildStringAttribute(
- SP_FRIENDLYNAME_FRIENDLY_NAME,
- SP_FRIENDLYNAME_NAME,
- oaParam.getFriendlyName());
-
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(SP_FRIENDLYNAME_FRIENDLY_NAME, SP_FRIENDLYNAME_NAME);
-
- }
-
-}
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
deleted file mode 100644
index bac2ec24..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SPUniqueIdAttributeBuilder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.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.exceptions.AttributeBuilderException;
-
-public class SPUniqueIdAttributeBuilder implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
-
- @Override
- public String getName() {
- return SP_UNIQUEID_NAME;
- }
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g)
- throws AttributeBuilderException {
- return g.buildStringAttribute(
- SP_UNIQUEID_FRIENDLY_NAME,
- SP_UNIQUEID_NAME,
- oaParam.getUniqueIdentifier());
-
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(SP_UNIQUEID_FRIENDLY_NAME, SP_UNIQUEID_NAME);
-
- }
-
-}
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
deleted file mode 100644
index 7ad6cb09..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SPUsesMandates.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-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.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.exceptions.AttributeBuilderException;
-
-public class SPUsesMandates implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
-
- @Override
- public String getName() {
- return SP_USESMANDATES_NAME;
- }
-
- @Override
- public ATT build(ISPConfiguration oaParam, IAuthData authData, IAttributeGenerator g)
- throws AttributeBuilderException {
- //this attribute can not generated yet
- return null;
-
- }
-
- @Override
- public ATT buildEmpty(IAttributeGenerator g) {
- return g.buildEmptyAttribute(SP_USESMANDATES_FRIENDLY_NAME, SP_USESMANDATES_NAME);
-
- }
-
-}
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
new file mode 100644
index 00000000..86cb1dcc
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpCountryCodeAttributeBuilder.java
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.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.exceptions.AttributeBuilderException;
+
+public class SpCountryCodeAttributeBuilder
+ implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
+
+ @Override
+ public String getName() {
+ return SP_COUNTRYCODE_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator g)
+ throws AttributeBuilderException {
+ // this attribute can not generated yet
+ return null;
+ // return g.buildStringAttribute(
+ // SP_COUNTRYCODE_FRIENDLY_NAME,
+ // SP_COUNTRYCODE_NAME,
+ // oaParam.getFriendlyName());
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(SP_COUNTRYCODE_FRIENDLY_NAME, SP_COUNTRYCODE_NAME);
+
+ }
+
+}
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
new file mode 100644
index 00000000..4b905690
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpFriendlyNameAttributeBuilder.java
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.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.exceptions.AttributeBuilderException;
+
+public class SpFriendlyNameAttributeBuilder
+ implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
+
+ @Override
+ public String getName() {
+ return SP_FRIENDLYNAME_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator g)
+ throws AttributeBuilderException {
+ return g.buildStringAttribute(SP_FRIENDLYNAME_FRIENDLY_NAME, SP_FRIENDLYNAME_NAME,
+ oaParam.getFriendlyName());
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(SP_FRIENDLYNAME_FRIENDLY_NAME, SP_FRIENDLYNAME_NAME);
+
+ }
+
+}
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
new file mode 100644
index 00000000..47e5e8ce
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUniqueIdAttributeBuilder.java
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.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.exceptions.AttributeBuilderException;
+
+public class SpUniqueIdAttributeBuilder
+ implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
+
+ @Override
+ public String getName() {
+ return SP_UNIQUEID_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator g)
+ throws AttributeBuilderException {
+ return g.buildStringAttribute(SP_UNIQUEID_FRIENDLY_NAME, SP_UNIQUEID_NAME,
+ oaParam.getUniqueIdentifier());
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(SP_UNIQUEID_FRIENDLY_NAME, SP_UNIQUEID_NAME);
+
+ }
+
+}
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
new file mode 100644
index 00000000..ce717862
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/builder/attributes/SpUsesMandates.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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.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.exceptions.AttributeBuilderException;
+
+public class SpUsesMandates implements IAttributeBuilder, ExtendedPVPAttributeDefinitions {
+
+ @Override
+ public String getName() {
+ return SP_USESMANDATES_NAME;
+ }
+
+ @Override
+ public ATT build(final IspConfiguration oaParam, final IAuthData authData, final IAttributeGenerator g)
+ throws AttributeBuilderException {
+ // this attribute can not generated yet
+ return null;
+
+ }
+
+ @Override
+ public ATT buildEmpty(final IAttributeGenerator g) {
+ return g.buildEmptyAttribute(SP_USESMANDATES_FRIENDLY_NAME, SP_USESMANDATES_NAME);
+
+ }
+
+}
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 55662326..e661a2a8 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
@@ -1,29 +1,22 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.conf;
import java.io.File;
@@ -34,201 +27,215 @@ 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);
-
- private static final String URI_SCHEME_CLASSPATH = "classpath";
- private static final String URI_SCHEME_FILESYSTEM = "file";
-
- private final URI internalConfigPath;
- private final URI configRootDirectory;
- private final Properties properties;
-
- public AbstractConfigurationImpl(final String configPath) throws EAAFConfigurationException {
- InputStream is = null;
- try {
- log.debug("Starting EAAFCore initialization process .... ");
-
- if (StringUtils.isEmpty(configPath)) {
- log.debug("Primary configuration is empty. Search for backup configuration .... ");
- final String backupConfigPath = getBackupConfigPath();
- if (StringUtils.isEmpty(backupConfigPath)) {
- log.error("No configuration file found.");
- throw new EAAFConfigurationException("config.01", null);
-
- }
-
- internalConfigPath = new URI(getBackupConfigPath());
-
- } else
- internalConfigPath = new URI(configPath);
-
- log.info("Load EAAFCore configuration from " + internalConfigPath);
-
-
- //extract configuration root directory
- //TODO: check if it works with classpath
- final File propertiesFile = new File(internalConfigPath);
- if (!propertiesFile.exists()) {
- log.error("Configuration file: " + internalConfigPath + " is NOT found on filesystem");
- throw new EAAFConfigurationException("config.18", null);
-
- }
-
- final String configDir = propertiesFile.getParent();
- 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");
- is = new FileInputStream(propertiesFile);
-
- } else if (internalConfigPath.getScheme().equals(URI_SCHEME_CLASSPATH)) {
- log.trace("Load config from classpath");
- is = this.getClass().getResourceAsStream(internalConfigPath.toString());
-
- } else {
- log.error("Can not load EAAFCore configuration. Unsupported prefix! (Only 'file:' and 'classpath:') ");
- 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()});
-
- }
-
-
- //load EAAF core configuration into properties object
- properties = new Properties();
- properties.load(is);
-
- log.info("EAAFCore configuration loaded");
-
- } 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);
-
- } finally {
- if (is != null) {
- try {
- is.close();
-
- } catch (final IOException e) {
- log.warn("Can not close inputstream from configuration loader!");
-
- }
- }
- }
-
- }
-
- @Override
- public String getBasicConfiguration(String key) {
- if (StringUtils.isNotEmpty(key)) {
- final String value = properties.getProperty(addPrefixToKey(key));
- if (value != null)
- return value.trim();
- }
-
- return null;
- }
-
- @Override
- public String getBasicConfiguration(String key, String defaultValue) {
- if (StringUtils.isNotEmpty(key)) {
- final String value = properties.getProperty(addPrefixToKey(key), defaultValue);
- if (value != null)
- return value.trim();
- }
-
- return defaultValue;
- }
-
-
- @Override
- public Boolean getBasicConfigurationBoolean(String key) {
- final String value = getBasicConfiguration(key);
- if (value != null)
- return Boolean.parseBoolean(value);
- else
- return null;
-
- }
-
-
- @Override
- public boolean getBasicConfigurationBoolean(String key, boolean defaultValue) {
- final Boolean result = getBasicConfigurationBoolean(key);
- if (result != null)
- return result;
- else
- return defaultValue;
-
- }
-
- @Override
- public Map getBasicConfigurationWithPrefix(String prefix) {
- return KeyValueUtils.getSubSetWithPrefix(KeyValueUtils.convertPropertiesToMap(properties), addPrefixToKey(prefix));
-
- }
-
- @Override
- public Properties getFullConfigurationProperties() {
- return properties;
-
- }
-
- @Override
- public URI getConfigurationRootDirectory() {
- return configRootDirectory;
-
- }
-
- @Override
- public URI getConfigurationFilePath() {
- return internalConfigPath;
-
- }
-
- /**
- * Get the path to backup configuration
- *
- * @return A filepath file: or a classpath classpath:
- */
- abstract protected String getBackupConfigPath();
-
- /**
- * Get a specific configuration-key prefix for this software implementation
- *
- * @return
- */
- abstract public String getApplicationSpecificKeyPrefix();
-
-
- private String addPrefixToKey(String key) {
- if (StringUtils.isNotEmpty(getApplicationSpecificKeyPrefix())) {
- if (getApplicationSpecificKeyPrefix().endsWith(KeyValueUtils.KEY_DELIMITER))
- return getApplicationSpecificKeyPrefix() + key;
- else
- return getApplicationSpecificKeyPrefix() + KeyValueUtils.KEY_DELIMITER + key;
-
- }
-
- return key;
-
- }
+ private static final Logger log = LoggerFactory.getLogger(AbstractConfigurationImpl.class);
+
+ private static final String URI_SCHEME_CLASSPATH = "classpath";
+ private static final String URI_SCHEME_FILESYSTEM = "file";
+
+ private final URI internalConfigPath;
+ private final URI configRootDirectory;
+ private final Properties properties;
+
+ /**
+ * Basic configuration loader implementation.
+ *
+ * @param configPath Path to configuration
+ * @throws EaafConfigurationException In case of a configuration error
+ */
+ public AbstractConfigurationImpl(final String configPath) throws EaafConfigurationException {
+ InputStream is = null;
+ try {
+ log.debug("Starting EAAFCore initialization process .... ");
+
+ if (StringUtils.isEmpty(configPath)) {
+ log.debug("Primary configuration is empty. Search for backup configuration .... ");
+ final String backupConfigPath = getBackupConfigPath();
+ if (StringUtils.isEmpty(backupConfigPath)) {
+ log.error("No configuration file found.");
+ throw new EaafConfigurationException("config.01", null);
+
+ }
+
+ internalConfigPath = new URI(getBackupConfigPath());
+
+ } else {
+ internalConfigPath = new URI(configPath);
+ }
+
+ log.info("Load EAAFCore configuration from " + internalConfigPath);
+
+
+ // extract configuration root directory
+ // TODO: check if it works with classpath
+ final File propertiesFile = new File(internalConfigPath);
+ if (!propertiesFile.exists()) {
+ log.error("Configuration file: " + internalConfigPath + " is NOT found on filesystem");
+ throw new EaafConfigurationException("config.18", null);
+
+ }
+
+ final String configDir = propertiesFile.getParent();
+ 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");
+ is = new FileInputStream(propertiesFile);
+
+ } else if (internalConfigPath.getScheme().equals(URI_SCHEME_CLASSPATH)) {
+ log.trace("Load config from classpath");
+ is = this.getClass().getResourceAsStream(internalConfigPath.toString());
+
+ } else {
+ log.error(
+ "Can not load EAAFCore configuration. Unsupported prefix! (Only 'file:' and 'classpath:') ");
+ 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()});
+
+ }
+
+
+ // load EAAF core configuration into properties object
+ properties = new Properties();
+ properties.load(is);
+
+ log.info("EAAFCore configuration loaded");
+
+ } 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);
+
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+
+ } catch (final IOException e) {
+ log.warn("Can not close inputstream from configuration loader!");
+
+ }
+ }
+ }
+
+ }
+
+ @Override
+ public String getBasicConfiguration(final String key) {
+ if (StringUtils.isNotEmpty(key)) {
+ final String value = properties.getProperty(addPrefixToKey(key));
+ if (value != null) {
+ return value.trim();
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public String getBasicConfiguration(final String key, final String defaultValue) {
+ if (StringUtils.isNotEmpty(key)) {
+ final String value = properties.getProperty(addPrefixToKey(key), defaultValue);
+ if (value != null) {
+ return value.trim();
+ }
+ }
+
+ return defaultValue;
+ }
+
+
+ @Override
+ public boolean getBasicConfigurationBoolean(final String key) {
+ final String value = getBasicConfiguration(key);
+ if (value != null) {
+ return Boolean.parseBoolean(value);
+ } else {
+ return false;
+ }
+
+ }
+
+
+ @Override
+ public boolean getBasicConfigurationBoolean(final String key, final boolean defaultValue) {
+ final Boolean result = getBasicConfigurationBoolean(key);
+ if (result != null) {
+ return result;
+ } else {
+ return defaultValue;
+ }
+
+ }
+
+ @Override
+ public Map getBasicConfigurationWithPrefix(final String prefix) {
+ return KeyValueUtils.getSubSetWithPrefix(KeyValueUtils.convertPropertiesToMap(properties),
+ addPrefixToKey(prefix));
+
+ }
+
+ @Override
+ public Properties getFullConfigurationProperties() {
+ return properties;
+
+ }
+
+ @Override
+ public URI getConfigurationRootDirectory() {
+ return configRootDirectory;
+
+ }
+
+ @Override
+ public URI getConfigurationFilePath() {
+ return internalConfigPath;
+
+ }
+
+ /**
+ * Get the path to backup configuration.
+ *
+ * @return A filepath file: or a classpath classpath:
+ */
+ protected abstract String getBackupConfigPath();
+
+ /**
+ * Get a specific configuration-key prefix for this software implementation.
+ *
+ * @return
+ */
+ public abstract String getApplicationSpecificKeyPrefix();
+
+
+ private String addPrefixToKey(final String key) {
+ if (StringUtils.isNotEmpty(getApplicationSpecificKeyPrefix())) {
+ if (getApplicationSpecificKeyPrefix().endsWith(KeyValueUtils.KEY_DELIMITER)) {
+ return getApplicationSpecificKeyPrefix() + key;
+ } else {
+ return getApplicationSpecificKeyPrefix() + KeyValueUtils.KEY_DELIMITER + key;
+ }
+
+ }
+
+ return key;
+
+ }
}
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 dd13b534..3a6cc67d 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
@@ -1,29 +1,22 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.conf;
import java.net.URI;
@@ -32,9 +25,10 @@ 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;
@@ -45,175 +39,176 @@ 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);
-
- @Autowired private Environment env;
-
- public static final String PROP_CONFIG_ROOT_DIR = "core.configRootDir";
-
- @PostConstruct
- private void initialize() throws EAAFConfigurationException {
- if (getConfigurationRootDirectory() == null) {
- throw new EAAFConfigurationException("config.08", new Object[] {addPrefixToKey(PROP_CONFIG_ROOT_DIR)});
-
- }
-
- }
-
- @Override
- public String getBasicConfiguration(String key) {
- if (StringUtils.isNotEmpty(key)) {
- final String value = env.getProperty(addPrefixToKey(key));
- if (value != null)
- return value.trim();
- }
-
- return null;
- }
-
- @Override
- public String getBasicConfiguration(String key, String defaultValue) {
- if (StringUtils.isNotEmpty(key)) {
- final String value = env.getProperty(addPrefixToKey(key), defaultValue);
- if (value != null)
- return value.trim();
- }
-
- return defaultValue;
- }
-
- @Override
- public Map getBasicConfigurationWithPrefix(String prefix) {
- final Map configProps = getPropertiesStartingWith((ConfigurableEnvironment) env, addPrefixToKey(prefix));
- return KeyValueUtils.removePrefixFromKeys(configProps, addPrefixToKey(prefix) + ".");
-
-
- }
-
- @Override
- public Boolean getBasicConfigurationBoolean(String key) {
- final String value = getBasicConfiguration(key);
- if (StringUtils.isNotEmpty(value))
- return Boolean.valueOf(value.trim());
- else
- return null;
- }
-
- @Override
- public boolean getBasicConfigurationBoolean(String key, boolean defaultValue) {
- final Boolean value = getBasicConfigurationBoolean(key);
- if (value != null)
- return value;
- else
- return defaultValue;
- }
-
- @Override
- public URI getConfigurationRootDirectory() {
- try {
- return new URI(env.getRequiredProperty(addPrefixToKey(PROP_CONFIG_ROOT_DIR)));
-
- } catch (IllegalStateException | URISyntaxException e) {
- log.warn("ConfigRootDirectory is NOT set");
- return null;
-
- }
-
- }
-
-
- /**
- * Get the path to backup configuration
- *
- * @return A filepath file: or a classpath classpath:
- */
- abstract protected String getBackupConfigPath();
-
- /**
- * Get a specific configuration-key prefix for this software implementation
- *
- * @return
- */
- abstract public String getApplicationSpecificKeyPrefix();
-
-
- private String addPrefixToKey(String key) {
- if (StringUtils.isNotEmpty(getApplicationSpecificKeyPrefix())) {
- if (getApplicationSpecificKeyPrefix().endsWith(KeyValueUtils.KEY_DELIMITER))
- return getApplicationSpecificKeyPrefix() + key;
- else
- return getApplicationSpecificKeyPrefix() + KeyValueUtils.KEY_DELIMITER + key;
-
- }
-
- return key;
-
- }
-
- private static Map getPropertiesStartingWith( ConfigurableEnvironment aEnv, String aKeyPrefix ) {
- final Map result = new HashMap<>();
- final Map map = getAllProperties(aEnv);
-
- for (final Entry entry : map.entrySet()) {
- final String key = entry.getKey();
-
- if ( key.startsWith( aKeyPrefix ) )
- {
- result.put( key, (String) entry.getValue() );
- }
- }
-
- return result;
- }
-
- private static Map getAllProperties( ConfigurableEnvironment aEnv ) {
- final Map result = new HashMap<>();
- aEnv.getPropertySources().forEach( ps -> addAll( result, getAllProperties( ps ) ) );
- return result;
-
- }
-
- private static Map getAllProperties( PropertySource> aPropSource ) {
- final Map result = new HashMap<>();
-
- if ( aPropSource instanceof CompositePropertySource)
- {
- final CompositePropertySource cps = (CompositePropertySource) aPropSource;
- cps.getPropertySources().forEach( ps -> addAll( result, getAllProperties( ps ) ) );
- return result;
- }
-
- if ( aPropSource instanceof EnumerablePropertySource> )
- {
- final EnumerablePropertySource> ps = (EnumerablePropertySource>) aPropSource;
- Arrays.asList( ps.getPropertyNames() ).forEach( key -> result.put( key, ps.getProperty( key ) ) );
- return result;
- }
-
- // 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" );
-
- return result;
-
- }
-
- private static void addAll( Map aBase, Map aToBeAdded )
- {
- for (final Entry entry : aToBeAdded.entrySet())
- {
- if ( aBase.containsKey( entry.getKey() ) )
- {
- continue;
- }
-
- aBase.put( entry.getKey(), entry.getValue() );
- }
- }
+ private static final Logger log =
+ LoggerFactory.getLogger(AbstractSpringBootConfigurationImpl.class);
+
+ @Autowired
+ private Environment env;
+
+ public static final String PROP_CONFIG_ROOT_DIR = "core.configRootDir";
+
+ @PostConstruct
+ private void initialize() throws EaafConfigurationException {
+ if (getConfigurationRootDirectory() == null) {
+ throw new EaafConfigurationException("config.08",
+ new Object[] {addPrefixToKey(PROP_CONFIG_ROOT_DIR)});
+
+ }
+
+ }
+
+ @Override
+ public String getBasicConfiguration(final String key) {
+ if (StringUtils.isNotEmpty(key)) {
+ final String value = env.getProperty(addPrefixToKey(key));
+ if (value != null) {
+ return value.trim();
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public String getBasicConfiguration(final String key, final String defaultValue) {
+ if (StringUtils.isNotEmpty(key)) {
+ final String value = env.getProperty(addPrefixToKey(key), defaultValue);
+ if (value != null) {
+ return value.trim();
+ }
+ }
+
+ return defaultValue;
+ }
+
+ @Override
+ public Map getBasicConfigurationWithPrefix(final String prefix) {
+ final Map 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;
+ }
+ }
+
+ @Override
+ public boolean getBasicConfigurationBoolean(final String key, final boolean defaultValue) {
+ final Boolean value = getBasicConfigurationBoolean(key);
+ if (value != null) {
+ return value;
+ } else {
+ return defaultValue;
+ }
+ }
+
+ @Override
+ public URI getConfigurationRootDirectory() {
+ try {
+ return new URI(env.getRequiredProperty(addPrefixToKey(PROP_CONFIG_ROOT_DIR)));
+
+ } catch (IllegalStateException | URISyntaxException e) {
+ log.warn("ConfigRootDirectory is NOT set");
+ return null;
+
+ }
+
+ }
+
+
+ /**
+ * Get the path to backup configuration.
+ *
+ * @return A filepath file: or a classpath classpath:
+ */
+ protected abstract String getBackupConfigPath();
+
+ /**
+ * Get a specific configuration-key prefix for this software implementation.
+ *
+ * @return
+ */
+ public abstract String getApplicationSpecificKeyPrefix();
+
+
+ private String addPrefixToKey(final String key) {
+ if (StringUtils.isNotEmpty(getApplicationSpecificKeyPrefix())) {
+ if (getApplicationSpecificKeyPrefix().endsWith(KeyValueUtils.KEY_DELIMITER)) {
+ return getApplicationSpecificKeyPrefix() + key;
+ } else {
+ return getApplicationSpecificKeyPrefix() + KeyValueUtils.KEY_DELIMITER + key;
+ }
+
+ }
+
+ return key;
+
+ }
+
+ private static Map getPropertiesStartingWith(final ConfigurableEnvironment aenv,
+ final String akeyPrefix) {
+ final Map result = new HashMap<>();
+ final Map map = getAllProperties(aenv);
+
+ for (final Entry entry : map.entrySet()) {
+ final String key = entry.getKey();
+
+ if (key.startsWith(akeyPrefix)) {
+ result.put(key, (String) entry.getValue());
+ }
+ }
+
+ return result;
+ }
+
+ private static Map getAllProperties(final ConfigurableEnvironment aenv) {
+ final Map result = new HashMap<>();
+ aenv.getPropertySources().forEach(ps -> addAll(result, getAllProperties(ps)));
+ return result;
+
+ }
+
+ private static Map getAllProperties(final PropertySource> apropSource) {
+ final Map result = new HashMap<>();
+
+ if (apropSource instanceof CompositePropertySource) {
+ final CompositePropertySource cps = (CompositePropertySource) apropSource;
+ cps.getPropertySources().forEach(ps -> addAll(result, getAllProperties(ps)));
+ return result;
+ }
+
+ if (apropSource instanceof EnumerablePropertySource>) {
+ final EnumerablePropertySource> ps = (EnumerablePropertySource>) apropSource;
+ Arrays.asList(ps.getPropertyNames()).forEach(key -> result.put(key, ps.getProperty(key)));
+ return result;
+ }
+
+ // 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");
+
+ return result;
+
+ }
+
+ private static void addAll(final Map abase,
+ final Map atoBeAdded) {
+ for (final Entry entry : atoBeAdded.entrySet()) {
+ if (abase.containsKey(entry.getKey())) {
+ continue;
+ }
+
+ abase.put(entry.getKey(), entry.getValue());
+ }
+ }
}
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
deleted file mode 100644
index 1b99ce50..00000000
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SPConfigurationImpl.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * 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.
- *
- * Licensed under the EUPL, Version 1.2 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:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-package at.gv.egiz.eaaf.core.impl.idp.conf;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-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);
-
- private final Map spConfiguration;
- private final List targetAreasWithNoInteralBaseIdRestriction;
- private final List targetAreasWithNoBaseIdTransmissionRestriction;
-
- public SPConfigurationImpl(final Map spConfig, IConfiguration authConfig) {
- this.spConfiguration = spConfig;
-
- //set oa specific restrictions
- targetAreasWithNoInteralBaseIdRestriction = Collections.unmodifiableList(
- KeyValueUtils.getListOfCSVValues(
- authConfig.getBasicConfiguration(
- 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)));
-
- if (log.isTraceEnabled()) {
- log.trace("Internal policy for OA: " + getUniqueIdentifier());
- for (String el : targetAreasWithNoInteralBaseIdRestriction)
- log.trace(" Allow baseID processing for prefix " + el);
- for (String el : targetAreasWithNoBaseIdTransmissionRestriction)
- log.trace(" Allow baseID transfer for prefix " + el);
-
- }
- }
-
-
- @Override
- public final Map getFullConfiguration() {
- return this.spConfiguration;
-
- }
-
- @Override
- public final String getConfigurationValue(String key) {
- if (key == null)
- return null;
- else
- return this.spConfiguration.get(key);
-
- }
-
- @Override
- public final String getConfigurationValue(String key, String defaultValue) {
- String value = getConfigurationValue(key);
- if (value == null)
- return defaultValue;
- else
- return value;
- }
-
-
- @Override
- public final Boolean isConfigurationValue(String key) {
- String value = getConfigurationValue(key);
- if (value != null) {
- return Boolean.parseBoolean(value);
-
- }
-
- return null;
- }
-
-
- @Override
- public final boolean isConfigurationValue(String key, boolean defaultValue) {
- String value = getConfigurationValue(key);
- if (value != null) {
- return Boolean.parseBoolean(value);
-
- }
-
- return defaultValue;
- }
-
- @Override
- public final boolean containsConfigurationKey(String key) {
- if (key == null)
- return false;
- else
- return this.spConfiguration.containsKey(key);
-
- }
-
- @Override
- public String getUniqueIdentifier() {
- return getConfigurationValue(EAAFConfigConstants.SERVICE_UNIQUEIDENTIFIER);
-
- }
-
- @Override
- public boolean hasBaseIdInternalProcessingRestriction() {
- return false;
-
- }
-
- @Override
- public boolean hasBaseIdTransferRestriction() {
- return true;
-
- }
-
-
- @Override
- public final List getTargetsWithNoBaseIdInternalProcessingRestriction() {
- return this.targetAreasWithNoInteralBaseIdRestriction;
- }
-
-
- @Override
- public final List getTargetsWithNoBaseIdTransferRestriction() {
- return this.targetAreasWithNoBaseIdTransmissionRestriction;
- }
-
-
- @Override
- public List getRequiredLoA() {
- log.warn("Method not implemented: " + SPConfigurationImpl.class.getName() + " 'getRequiredLoA()'");
- return null;
- }
-
- @Override
- public String getLoAMatchingMode() {
- log.warn("Method not implemented: " + SPConfigurationImpl.class.getName() + " 'getLoAMatchingMode()'");
- return null;
- }
-
- @Override
- public String getAreaSpecificTargetIdentifier() {
- log.warn("Method not implemented: " + SPConfigurationImpl.class.getName() + " 'getAreaSpecificTargetIdentifier()'");
- return null;
- }
-
-
- @Override
- public String getFriendlyName() {
- log.warn("Method not implemented: " + SPConfigurationImpl.class.getName() + " 'getFriendlyName()'");
- return null;
- }
-
-}
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
new file mode 100644
index 00000000..07284cd3
--- /dev/null
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/conf/SpConfigurationImpl.java
@@ -0,0 +1,193 @@
+/*
+ * 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.
+ *
+ * Licensed under the EUPL, Version 1.2 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:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * 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.
+*/
+
+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 {
+ private static final long serialVersionUID = 688541755446463453L;
+
+ private static final Logger log = LoggerFactory.getLogger(SpConfigurationImpl.class);
+
+ private final Map spConfiguration;
+ private final List targetAreasWithNoInteralBaseIdRestriction;
+ private final List targetAreasWithNoBaseIdTransmissionRestriction;
+
+ /**
+ * Service-provider configuration holder.
+ *
+ * @param spConfig Key/value based configuration
+ * @param authConfig Basic application configuration
+ */
+ public SpConfigurationImpl(final Map spConfig, final IConfiguration authConfig) {
+ this.spConfiguration = spConfig;
+
+ // set oa specific restrictions
+ targetAreasWithNoInteralBaseIdRestriction = Collections
+ .unmodifiableList(KeyValueUtils.getListOfCsvValues(authConfig.getBasicConfiguration(
+ 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)));
+
+ if (log.isTraceEnabled()) {
+ log.trace("Internal policy for OA: " + getUniqueIdentifier());
+ for (final String el : targetAreasWithNoInteralBaseIdRestriction) {
+ log.trace(" Allow baseID processing for prefix " + el);
+ }
+ for (final String el : targetAreasWithNoBaseIdTransmissionRestriction) {
+ log.trace(" Allow baseID transfer for prefix " + el);
+ }
+
+ }
+ }
+
+
+ @Override
+ public final Map getFullConfiguration() {
+ return this.spConfiguration;
+
+ }
+
+ @Override
+ public final String getConfigurationValue(final String key) {
+ if (key == null) {
+ return null;
+ } else {
+ return this.spConfiguration.get(key);
+ }
+
+ }
+
+ @Override
+ public final String getConfigurationValue(final String key, final String defaultValue) {
+ final String value = getConfigurationValue(key);
+ if (value == null) {
+ return defaultValue;
+ } else {
+ return value;
+ }
+ }
+
+
+ @Override
+ public final boolean isConfigurationValue(final String key) {
+ final String value = getConfigurationValue(key);
+ if (value != null) {
+ return Boolean.parseBoolean(value);
+
+ }
+
+ return false;
+ }
+
+
+ @Override
+ public final boolean isConfigurationValue(final String key, final boolean defaultValue) {
+ final String value = getConfigurationValue(key);
+ if (value != null) {
+ return Boolean.parseBoolean(value);
+
+ }
+
+ return defaultValue;
+ }
+
+ @Override
+ public final boolean containsConfigurationKey(final String key) {
+ if (key == null) {
+ return false;
+ } else {
+ return this.spConfiguration.containsKey(key);
+ }
+
+ }
+
+ @Override
+ public String getUniqueIdentifier() {
+ return getConfigurationValue(EAAFConfigConstants.SERVICE_UNIQUEIDENTIFIER);
+
+ }
+
+ @Override
+ public boolean hasBaseIdInternalProcessingRestriction() {
+ return false;
+
+ }
+
+ @Override
+ public boolean hasBaseIdTransferRestriction() {
+ return true;
+
+ }
+
+
+ @Override
+ public final List getTargetsWithNoBaseIdInternalProcessingRestriction() {
+ return this.targetAreasWithNoInteralBaseIdRestriction;
+ }
+
+
+ @Override
+ public final List getTargetsWithNoBaseIdTransferRestriction() {
+ return this.targetAreasWithNoBaseIdTransmissionRestriction;
+ }
+
+
+ @Override
+ public List getRequiredLoA() {
+ log.warn(
+ "Method not implemented: " + SpConfigurationImpl.class.getName() + " 'getRequiredLoA()'");
+ return null;
+ }
+
+ @Override
+ public String getLoAMatchingMode() {
+ log.warn("Method not implemented: " + SpConfigurationImpl.class.getName()
+ + " 'getLoAMatchingMode()'");
+ return null;
+ }
+
+ @Override
+ public String getAreaSpecificTargetIdentifier() {
+ log.warn("Method not implemented: " + SpConfigurationImpl.class.getName()
+ + " 'getAreaSpecificTargetIdentifier()'");
+ return null;
+ }
+
+
+ @Override
+ public String getFriendlyName() {
+ log.warn(
+ "Method not implemented: " + SpConfigurationImpl.class.getName() + " 'getFriendlyName()'");
+ return null;
+ }
+
+}
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 4505163d..7c42f506 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
@@ -1,43 +1,27 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
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;
@@ -47,165 +31,215 @@ import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;
import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService;
import at.gv.egiz.eaaf.core.api.logging.IRevisionLogger;
import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException;
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.
+ *
* @author tlenz
*
*/
public abstract class AbstractController {
- private static final Logger log = LoggerFactory.getLogger(AbstractController.class);
-
- @Autowired(required=true) protected IProtocolAuthenticationService protAuthService;
- @Autowired(required=true) protected ApplicationContext applicationContext;
- @Autowired(required=true) protected IConfigurationWithSP authConfig;
- @Autowired(required=true) protected ITransactionStorage transactionStorage;
- @Autowired(required=true) protected IStatusMessenger statusMessager;
-
- @Autowired protected IRevisionLogger revisionsLogger;
-
- @ExceptionHandler({EAAFException.class})
- public void EAAFExceptionHandler(final HttpServletRequest req, final HttpServletResponse resp, final Exception e) throws IOException {
- try {
- protAuthService.handleErrorNoRedirect(e, req, resp, true);
-
- } catch (final EAAFException e1) {
- log.warn("Can NOT handle an 'EAAFException'. Forwarding to generic error ... ", e);
- IOExceptionHandler(resp, e);
-
- }
-
- }
-
- @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.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Internal Server Error!" +
- "(Errorcode=9199"
- +" | Description="
- + StringEscapeUtils.escapeHtml4(StringEscapeUtils.escapeEcmaScript(exception.getMessage()))
- + ")");
- return;
-
- }
-
- @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.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
-
- }
-
- protected void handleError(final String errorMessage, final Throwable exceptionThrown,
- final HttpServletRequest req, final HttpServletResponse resp, IRequest pendingReq) throws IOException, EAAFException {
-
- Throwable loggedException = null;
- final Throwable extractedException = extractOriginalExceptionFromProcessException(exceptionThrown);
-
- //extract pendingRequestID and originalException if it was a TaskExecutionException
- if (extractedException instanceof TaskExecutionException) {
- //set original exception
- loggedException = ((TaskExecutionException) extractedException).getOriginalException();
-
- } else if (exceptionThrown instanceof PendingReqIdValidationException) {
- log.trace("Find pendingRequestId validation exception. Looking for invalid pending-request ... ");
- if (((PendingReqIdValidationException) exceptionThrown).getInvalidPendingReq() != null)
- pendingReq = ((PendingReqIdValidationException) exceptionThrown).getInvalidPendingReq();
-
- }
-
- //use TaskExecutionException directly, if no Original Exeception is included
- if (loggedException == null)
- loggedException = exceptionThrown;
-
- try {
- //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) {
- revisionsLogger.logEvent(pendingReq, EventConstants.TRANSACTION_ERROR);
- transactionStorage.put(key,
- new ExceptionContainer(pendingReq, loggedException), -1);
-
- } else {
- transactionStorage.put(key,
- new ExceptionContainer(null, loggedException), -1);
-
- }
-
- //build up redirect URL
- String redirectURL = null;
- redirectURL = ServletUtils.getBaseUrl(req);
- redirectURL += "/"+ProtocolFinalizationController.ENDPOINT_ERRORHANDLING
- + "?" + EAAFConstants.PARAM_HTTP_ERROR_CODE + "=" + key;
-
- resp.setContentType("text/html");
- resp.setStatus(302);
-
- resp.addHeader("Location", redirectURL);
- log.debug("REDIRECT TO: " + redirectURL);
-
- return;
-
- } catch (final Exception e) {
- log.warn("Default error-handling FAILED. Exception can not be stored ....", e);
- log.info("Switch to generic generic backup error-handling ... ");
- protAuthService.handleErrorNoRedirect(loggedException, req, resp, true);
-
- }
-
- }
-
-
-
-
-
- /**
- * Extracts a TaskExecutionException of a ProcessExecutionExeception Stacktrace.
- *
- * @param exception
- * @return Return the latest TaskExecutionExecption if exists, otherwise the latest ProcessExecutionException
- */
- private Throwable extractOriginalExceptionFromProcessException(final Throwable exception) {
- Throwable exholder = exception;
- TaskExecutionException taskExc = null;
-
- while(exholder != null
- && exholder instanceof ProcessExecutionException) {
- final ProcessExecutionException procExc = (ProcessExecutionException) exholder;
- if (procExc.getCause() != null &&
- procExc.getCause() instanceof TaskExecutionException) {
- taskExc = (TaskExecutionException) procExc.getCause();
- exholder = taskExc.getOriginalException();
-
- } else
- break;
-
- }
-
- if (taskExc == null)
- return exholder;
-
- else
- return taskExc;
- }
-
-
-
+ private static final Logger log = LoggerFactory.getLogger(AbstractController.class);
+
+ @Autowired(required = true)
+ protected IProtocolAuthenticationService protAuthService;
+ @Autowired(required = true)
+ protected ApplicationContext applicationContext;
+ @Autowired(required = true)
+ protected IConfigurationWithSP authConfig;
+ @Autowired(required = true)
+ protected ITransactionStorage transactionStorage;
+ @Autowired(required = true)
+ protected IStatusMessenger statusMessager;
+
+ @Autowired
+ protected IRevisionLogger revisionsLogger;
+
+ /**
+ * EAAF framework exception handler.
+ *
+ *
+ *This handler start a protocol-specific error handling.
+ *
+ *
+ * @param req http request
+ * @param resp http response
+ * @param e exception
+ * @throws IOException in case of an exception handling error
+ */
+ @ExceptionHandler({EaafException.class})
+ public void eaafExceptionHandler(final HttpServletRequest req, final HttpServletResponse resp,
+ final Exception e) throws IOException {
+ try {
+ protAuthService.handleErrorNoRedirect(e, req, resp, true);
+
+ } catch (final EaafException e1) {
+ log.warn("Can NOT handle an 'EAAFException'. Forwarding to generic error ... ", e);
+ ioExceptionHandler(resp, e);
+
+ }
+
+ }
+
+ /**
+ * Generic exception handler.
+ *
+ *
+ * This handler wrote an internal server error into http response
+ *
+ * This handler wrote an internal server error into http response
+ *
+ *
+ * @param resp http response
+ * @param exception exception
+ */
+ @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.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ return;
+
+ }
+
+ protected void handleError(final String errorMessage, final Throwable exceptionThrown,
+ final HttpServletRequest req, final HttpServletResponse resp, IRequest pendingReq)
+ throws IOException, EaafException {
+
+ Throwable loggedException = null;
+ final Throwable extractedException =
+ extractOriginalExceptionFromProcessException(exceptionThrown);
+
+ // extract pendingRequestID and originalException if it was a TaskExecutionException
+ if (extractedException instanceof TaskExecutionException) {
+ // set original exception
+ loggedException = ((TaskExecutionException) extractedException).getOriginalException();
+
+ } else if (exceptionThrown instanceof PendingReqIdValidationException) {
+ log.trace(
+ "Find pendingRequestId validation exception. Looking for invalid pending-request ... ");
+ if (((PendingReqIdValidationException) exceptionThrown).getInvalidPendingReq() != null) {
+ pendingReq = ((PendingReqIdValidationException) exceptionThrown).getInvalidPendingReq();
+ }
+
+ }
+
+ // use TaskExecutionException directly, if no Original Exeception is included
+ if (loggedException == null) {
+ loggedException = exceptionThrown;
+ }
+
+ try {
+ // 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) {
+ revisionsLogger.logEvent(pendingReq, EventConstants.TRANSACTION_ERROR);
+ transactionStorage.put(key, new ExceptionContainer(pendingReq, loggedException), -1);
+
+ } else {
+ transactionStorage.put(key, new ExceptionContainer(null, loggedException), -1);
+
+ }
+
+ // build up redirect URL
+ String redirectUrl = null;
+ redirectUrl = ServletUtils.getBaseUrl(req);
+ redirectUrl += "/" + ProtocolFinalizationController.ENDPOINT_ERRORHANDLING + "?"
+ + EAAFConstants.PARAM_HTTP_ERROR_CODE + "=" + key;
+
+ resp.setContentType("text/html");
+ resp.setStatus(302);
+
+ resp.addHeader("Location", redirectUrl);
+ log.debug("REDIRECT TO: " + redirectUrl);
+
+ return;
+
+ } catch (final Exception e) {
+ log.warn("Default error-handling FAILED. Exception can not be stored ....", e);
+ log.info("Switch to generic generic backup error-handling ... ");
+ protAuthService.handleErrorNoRedirect(loggedException, req, resp, true);
+
+ }
+
+ }
+
+
+
+ /**
+ * Extracts a TaskExecutionException of a ProcessExecutionExeception Stacktrace.
+ *
+ * @param exception error
+ * @return Return the latest TaskExecutionExecption if exists, otherwise the latest
+ * ProcessExecutionException
+ */
+ private Throwable extractOriginalExceptionFromProcessException(final Throwable exception) {
+ Throwable exholder = exception;
+ TaskExecutionException taskExc = null;
+
+ while (exholder != null && exholder instanceof ProcessExecutionException) {
+ final ProcessExecutionException procExc = (ProcessExecutionException) exholder;
+ if (procExc.getCause() != null && procExc.getCause() instanceof TaskExecutionException) {
+ taskExc = (TaskExecutionException) procExc.getCause();
+ exholder = taskExc.getOriginalException();
+
+ } else {
+ break;
+ }
+
+ }
+
+ if (taskExc == null) {
+ return exholder;
+ } else {
+ return taskExc;
+ }
+ }
+
+
+
}
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 b87c9b78..9ff468d3 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
@@ -1,119 +1,113 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
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.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 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).
- *
+ *
* @author tknall
- *
+ *
*/
public abstract class AbstractProcessEngineSignalController extends AbstractController {
- private static final Logger log = LoggerFactory.getLogger(AbstractProcessEngineSignalController.class);
-
- @Autowired(required=true) protected ProcessEngine processEngine;
- @Autowired(required=true) protected IRequestStorage requestStorage;
-
- protected void signalProcessManagement(HttpServletRequest req, HttpServletResponse resp) throws IOException, EAAFException {
- String pendingRequestID = StringEscapeUtils.escapeHtml4(getPendingRequestId(req));
- IRequest pendingReq = null;
- try {
- if (pendingRequestID == null) {
- new EAAFException(
- IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID,
- null);
-
- }
-
- pendingReq = requestStorage.getPendingRequest(pendingRequestID);
- if (pendingReq == null) {
- log.info("No PendingRequest with Id: " + pendingRequestID + " Maybe, a transaction timeout occure.");
- throw new EAAFException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_TIMEOUT, new Object[]{pendingRequestID});
-
- }
-
- //change pending-request ID
- requestStorage.changePendingRequestID(pendingReq);
- pendingRequestID = pendingReq.getPendingRequestId();
-
- // process instance is mandatory
- if (pendingReq.getProcessInstanceId() == null) {
- throw new EAAFIllegalStateException(new Object[]{"MOA session does not provide process instance id."});
-
- }
-
- // wake up next task
- processEngine.signal(pendingReq);
-
- } catch (Exception ex) {
- handleError(null, ex, req, resp, pendingReq);
-
- } finally {
- //MOASessionDBUtils.closeSession();
- TransactionIDUtils.removeAllLoggingVariables();
-
- }
-
-
- }
-
- /**
- * Retrieves the current pending-request id from the HttpServletRequest parameter
- *
- *
- * Note that this class/method can be overwritten by modules providing their own strategy of retrieving the
- * respective pending-request id.
- *
- * @param request
- * The unterlying HttpServletRequest.
- * @return The current pending-request id.
- */
- public String getPendingRequestId(HttpServletRequest request) {
- return StringEscapeUtils.escapeHtml4(request.getParameter(EAAFConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID));
-
- }
+ private static final Logger log =
+ LoggerFactory.getLogger(AbstractProcessEngineSignalController.class);
+
+ @Autowired(required = true)
+ protected ProcessEngine processEngine;
+ @Autowired(required = true)
+ protected IRequestStorage requestStorage;
+
+ protected void signalProcessManagement(final HttpServletRequest req,
+ final HttpServletResponse resp) throws IOException, EaafException {
+ final String pendingRequestID = StringEscapeUtils.escapeHtml4(getPendingRequestId(req));
+ IRequest pendingReq = null;
+ try {
+ if (pendingRequestID == null) {
+ throw new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID, null);
+
+ }
+
+ pendingReq = requestStorage.getPendingRequest(pendingRequestID);
+ if (pendingReq == null) {
+ log.info("No PendingRequest with Id: " + pendingRequestID
+ + " Maybe, a transaction timeout occure.");
+ throw new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_TIMEOUT,
+ new Object[] {pendingRequestID});
+
+ }
+
+ // change pending-request ID
+ requestStorage.changePendingRequestID(pendingReq);
+
+ // process instance is mandatory
+ if (pendingReq.getProcessInstanceId() == null) {
+ throw new EaafIllegalStateException(
+ new Object[] {"MOA session does not provide process instance id."});
+
+ }
+
+ // wake up next task
+ processEngine.signal(pendingReq);
+
+ } catch (final Exception ex) {
+ handleError(null, ex, req, resp, pendingReq);
+
+ } finally {
+ // MOASessionDBUtils.closeSession();
+ TransactionIdUtils.removeAllLoggingVariables();
+
+ }
+
+
+ }
+
+ /**
+ * Retrieves the current pending-request id from the HttpServletRequest parameter
+ *
+ *
+ * Note that this class/method can be overwritten by modules providing their own strategy of
+ * retrieving the respective pending-request id.
+ *
+ * @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));
+
+ }
}
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 b830e240..7b350c3b 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
@@ -1,32 +1,34 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
+ * 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.
+*/
+
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;
@@ -35,114 +37,121 @@ 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.api.idp.auth.services.IProtocolAuthenticationService;
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
-
/**
+ * Protocol finialization end-point.
+ *
* @author tlenz
*
*/
@Controller
public class ProtocolFinalizationController extends AbstractController {
- private static final Logger log = LoggerFactory.getLogger(ProtocolFinalizationController.class);
- public static final String ENDPOINT_FINALIZEPROTOCOL = "finalizeAuthProtocol";
- public static final String ENDPOINT_ERRORHANDLING = "errorHandling";
-
- @Autowired(required=true) IRequestStorage requestStorage;
-
- @RequestMapping(value = ENDPOINT_ERRORHANDLING, method = {RequestMethod.GET})
- public void errorHandling(HttpServletRequest req, HttpServletResponse resp) throws EAAFException, IOException {
- //receive an authentication error
- String errorid = StringEscapeUtils.escapeHtml4(req.getParameter(EAAFConstants.PARAM_HTTP_ERROR_CODE));
- if (errorid != null) {
- IRequest pendingReq = null;
- try {
- //load stored exception from database
- ExceptionContainer container = transactionStorage.get(errorid, ExceptionContainer.class);
- if (container != null) {
- //remove exception if it was found
- transactionStorage.remove(errorid);
-
- Throwable throwable = container.getExceptionThrown();
- pendingReq = container.getPendingRequest();
-
- if (pendingReq != null) {
- //build protocol-specific error message if possible
- protAuthService.buildProtocolSpecificErrorResponse(throwable, req, resp, pendingReq);
-
- //remove active user-session
- transactionStorage.remove(pendingReq.getPendingRequestId());
-
- return;
-
- } else {
- protAuthService.handleErrorNoRedirect(throwable, req, resp, true);
-
- }
- } else {
- protAuthService.handleErrorNoRedirect(
- new EAAFException(
- IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID,
- null), req, resp, false);
-
- }
-
- } catch (Throwable e) {
- log.error(e.getMessage(), e);
- protAuthService.handleErrorNoRedirect(e, req, resp, false);
-
- } finally {
- //remove pending-request
- if (pendingReq != null) {
- requestStorage.removePendingRequest(pendingReq.getPendingRequestId());
- revisionsLogger.logEvent(EventConstants.TRANSACTION_DESTROYED, pendingReq.getUniqueTransactionIdentifier());
-
- }
-
- }
-
- } else {
- log.debug("Request contains NO ErrorId");
- protAuthService.handleErrorNoRedirect(
- new EAAFException(
- IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID,
- null), req, resp, false);
-
- }
-
- }
-
-
- @RequestMapping(value = ENDPOINT_FINALIZEPROTOCOL, method = {RequestMethod.GET})
- public void finalizeAuthProtocol(HttpServletRequest req, HttpServletResponse resp) throws EAAFException, IOException {
-
- //read pendingRequest from http request
- Object idObject = StringEscapeUtils.escapeHtml4(req.getParameter(EAAFConstants.PARAM_HTTP_TARGET_PENDINGREQUESTID));
- IRequest pendingReq = null;
- String pendingRequestID = null;
- if (idObject != null && (idObject instanceof String)) {
- pendingRequestID = (String) idObject;
- 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,
- }), req, resp, false);
-
- } else
- protAuthService.finalizeAuthentication(req, resp, pendingReq);
-
- }
-
+ private static final Logger log = LoggerFactory.getLogger(ProtocolFinalizationController.class);
+ public static final String ENDPOINT_FINALIZEPROTOCOL = "finalizeAuthProtocol";
+ public static final String ENDPOINT_ERRORHANDLING = "errorHandling";
+
+ @Autowired(required = true)
+ IRequestStorage requestStorage;
+
+ /**
+ * End-Point to handle errors.
+ *
+ * @param req http request
+ * @param resp http response
+ * @throws EaafException In case of an internal error
+ * @throws IOException In case of a servlet error
+ */
+ @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));
+ if (errorid != null) {
+ IRequest pendingReq = null;
+ try {
+ // load stored exception from database
+ final ExceptionContainer container =
+ transactionStorage.get(errorid, ExceptionContainer.class);
+ if (container != null) {
+ // remove exception if it was found
+ transactionStorage.remove(errorid);
+
+ final Throwable throwable = container.getExceptionThrown();
+ pendingReq = container.getPendingRequest();
+
+ if (pendingReq != null) {
+ // build protocol-specific error message if possible
+ protAuthService.buildProtocolSpecificErrorResponse(throwable, req, resp, pendingReq);
+
+ // remove active user-session
+ transactionStorage.remove(pendingReq.getPendingRequestId());
+
+ return;
+
+ } else {
+ protAuthService.handleErrorNoRedirect(throwable, req, resp, true);
+
+ }
+ } else {
+ protAuthService.handleErrorNoRedirect(
+ new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID, null),
+ req, resp, false);
+
+ }
+
+ } catch (final Throwable e) {
+ log.error(e.getMessage(), e);
+ protAuthService.handleErrorNoRedirect(e, req, resp, false);
+
+ } finally {
+ // remove pending-request
+ if (pendingReq != null) {
+ requestStorage.removePendingRequest(pendingReq.getPendingRequestId());
+ revisionsLogger.logEvent(EventConstants.TRANSACTION_DESTROYED,
+ pendingReq.getUniqueTransactionIdentifier());
+
+ }
+
+ }
+
+ } else {
+ log.debug("Request contains NO ErrorId");
+ protAuthService.handleErrorNoRedirect(
+ new EaafException(IStatusMessenger.CODES_INTERNAL_ERROR_AUTH_NOPENDIGREQID, null), req,
+ resp, false);
+
+ }
+
+ }
+
+ /**
+ * End-Point to finalize authentication protocol.
+ *
+ * @param req http request
+ * @param resp http response
+ * @throws EaafException In case of an internal error
+ * @throws IOException In case of a servlet error
+ */
+ @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));
+ 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,}),
+ req, resp, false);
+
+ } else {
+ protAuthService.finalizeAuthentication(req, resp, pendingReq);
+ }
+
+ }
+
}
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 722a9304..ac0876c4 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
@@ -1,29 +1,22 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.controller.protocols;
import java.io.Serializable;
@@ -35,444 +28,459 @@ 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 at.gv.egiz.eaaf.core.api.IRequest;
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.exceptions.EAAFAuthenticationException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
-import at.gv.egiz.eaaf.core.exceptions.EAAFStorageException;
+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;
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.HttpUtils;
import at.gv.egiz.eaaf.core.impl.utils.Random;
-import at.gv.egiz.eaaf.core.impl.utils.TransactionIDUtils;
-
-public abstract class RequestImpl implements IRequest, Serializable{
-
- private static final Logger log = LoggerFactory.getLogger(RequestImpl.class);
-
- public static final String DATAID_REQUESTER_IP_ADDRESS = "reqestImpl_requesterIPAddr";
-
- private static final long serialVersionUID = 1L;
-
- private String module = null;
- private String action = null;
-
- private String pendingRequestId = null;
- private String processInstanceId;
- private String internalSSOSessionId;
-
- private String uniqueTransactionIdentifer;
- private String uniqueSessionIdentifer;
-
- private String requestedServiceProviderIdentifer;
- private String idpAuthURL = null;
-
- private ISPConfiguration spConfiguration = null;
-
- private boolean passiv = false;
- private boolean force = false;
- private boolean isAbortedByUser = false;
-
- //every request needs authentication by default
- private boolean needAuthentication = true;
-
- //every request is not authenticated by default
- private boolean isAuthenticated = false;
-
- //every request needs no SSO by default
- private boolean needSSO = false;
-
- private boolean needUserConsent = false;
-
- private final Map genericDataStorage = new HashMap();
-
-
- /**
- * Initialize this pendingRequest object
- *
- * @param req {@link HttpServletRequest}
- * @param authConfig {@link IConfiguration}
- * @throws EAAFException
- *
- */
- public final void initialize(HttpServletRequest req, IConfigurationWithSP authConfig) throws EAAFException {
- initialize(req, authConfig, null);
-
- }
-
- /**
- * 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
- *
- * @throws EAAFException
- *
- */
- public final void initialize(@NonNull HttpServletRequest req, @NonNull IConfigurationWithSP authConfig, @Nullable String transactionId) throws EAAFException {
- //use external transactionId or create new one if empty or null
- if (StringUtils.isNotEmpty(transactionId))
- uniqueTransactionIdentifer = transactionId;
- else
- uniqueTransactionIdentifer = Random.nextLongRandom();
-
- //set unique transaction identifier for logging
- TransactionIDUtils.setTransactionId(uniqueTransactionIdentifer);
-
- //initialize session object
- 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);
- URL authReqURL;
- try {
- authReqURL = new URL(authURLString);
-
- } catch (final MalformedURLException e) {
- log.error("IDP AuthenticationServiceURL Prefix is not a valid URL." + 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});
-
- }
-
- //set unique session identifier
- final String uniqueID = (String) req.getAttribute(EAAFConstants.UNIQUESESSIONIDENTIFIER);
- if (StringUtils.isNotEmpty(uniqueID))
- this.uniqueSessionIdentifer = uniqueID;
-
- else {
- log.debug("Create new sessionIdentifier for this pendingRequest ... ");
- this.uniqueSessionIdentifer = UUID.randomUUID().toString();
-
- }
-
- //set requester's IP address
- try {
- setRawDataToTransaction(DATAID_REQUESTER_IP_ADDRESS, req.getRemoteAddr());
-
- } catch (final EAAFStorageException e) {
- log.info("Can NOT store remote IP address into 'pendingRequest'." , e);
-
- }
-
- }
-
- public final void setSPEntityId(String spIdentifier) {
- this.requestedServiceProviderIdentifer = spIdentifier;
- }
-
- @Override
- public final String getSPEntityId() {
- return this.requestedServiceProviderIdentifer;
- }
-
- @Override
- public final boolean isPassiv() {
- return passiv;
- }
-
- @Override
- public final boolean forceAuth() {
- return force;
- }
-
- public final void setPassiv(boolean passiv) {
- this.passiv = passiv;
- }
-
- public final void setForce(boolean force) {
- this.force = force;
- }
-
- @Override
- public final String requestedAction() {
- return action;
- }
-
- public final void setAction(String action) {
- this.action = action;
- }
-
- @Override
- public final String requestedModule() {
- return module;
- }
-
- public final void setModule(String module) {
- this.module = module;
- }
-
- public final void setPendingRequestId(String pendingReqId) {
- this.pendingRequestId = pendingReqId;
-
- }
-
- @Override
- @NonNull
- public final String getPendingRequestId() {
- if (pendingRequestId == null)
- throw new IllegalStateException("No PendingRequestId set!!!");
-
- return pendingRequestId;
- }
-
- @Override
- public final String getInternalSSOSessionIdentifier() {
- return this.internalSSOSessionId;
- }
-
- @Override
- public final void setInternalSSOSessionIdentifier(String internalSSOSessionId) {
- this.internalSSOSessionId = internalSSOSessionId;
-
- }
-
- @Override
- public final T getSessionData(final Class wrapper) {
- if (wrapper != null) {
- if (AuthProcessDataWrapper.class.isAssignableFrom(wrapper)) {
- try {
- return wrapper.getConstructor(Map.class).newInstance(this.genericDataStorage);
-
- } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException
- | IllegalArgumentException | InvocationTargetException e) {
- log.error("Can NOT instance wrapper: " + wrapper.getName(), e);
-
- }
-
- }
-
- log.error("Can NOT wrap generic data into session data. "
- + "Reason: Wrapper " + wrapper.getName() + " is NOT a valid wrapper");
- throw new RuntimeException("Can NOT wrap generic data into session data. "
- + "Reason: Wrapper " + wrapper.getName() + " is NOT a valid wrapper");
-
- }
-
- return null;
-
- }
-
- @Override
- public final ISPConfiguration getServiceProviderConfiguration() {
- return this.spConfiguration;
-
-
- }
-
- @Override
- public T getServiceProviderConfiguration(final Class decorator) {
- if (this.spConfiguration != null) {
- if (decorator.isAssignableFrom(this.spConfiguration.getClass())) {
- return (T) this.spConfiguration;
-
- } else
- log.error("Can not decorate SP configuration by '" + decorator.getName() + "'.");
- throw new RuntimeException("Can not decorate SP configuration by '" + decorator.getName() + "'.");
-
- }
-
- return null;
-
- }
-
- public void setOnlineApplicationConfiguration(ISPConfiguration spConfig) {
- this.spConfiguration = spConfig;
-
- }
-
- @Override
- public final String getUniqueTransactionIdentifier() {
- return this.uniqueTransactionIdentifer;
-
- }
-
- @Override
- public final String getUniqueSessionIdentifier() {
- return this.uniqueSessionIdentifer;
-
- }
-
- @Override
- public final String getProcessInstanceId() {
- return this.processInstanceId;
-
- }
-
- public final void setUniqueTransactionIdentifier(String id) {
- this.uniqueTransactionIdentifer = id;
-
- }
-
- public final void setUniqueSessionIdentifier(String id) {
- this.uniqueSessionIdentifer = id;
-
- }
-
- public void setProcessInstanceId(String id) {
- this.processInstanceId = id;
-
- }
-
- @Override
- public final String getAuthURL() {
- return this.idpAuthURL;
- }
-
- @Override
- public final String getAuthURLWithOutSlash() {
- if (this.idpAuthURL.endsWith("/"))
- return this.idpAuthURL.substring(0, this.idpAuthURL.length()-1);
- else
- return this.idpAuthURL;
-
- }
-
- @Override
- public final boolean isNeedAuthentication() {
- return needAuthentication;
- }
-
- public final void setNeedAuthentication(boolean needAuthentication) {
- this.needAuthentication = needAuthentication;
- }
-
- @Override
- public final boolean isAuthenticated() {
- return isAuthenticated;
- }
-
- @Override
- public final void setAuthenticated(boolean isAuthenticated) {
- this.isAuthenticated = isAuthenticated;
- }
-
- @Override
- public final boolean needSingleSignOnFunctionality() {
- return needSSO;
- }
- @Override
- public final void setNeedSingleSignOnFunctionality(boolean needSSO) {
- this.needSSO = needSSO;
-
- }
-
- @Override
- public final boolean isNeedUserConsent() {
- return this.needUserConsent;
-
- }
-
- @Override
- public final void setNeedUserConsent(boolean needConsent) {
- this.needUserConsent = needConsent;
-
- }
-
- @Override
- public final boolean isAbortedByUser() {
- return this.isAbortedByUser;
- }
-
- @Override
- public final void setAbortedByUser(boolean isAborted) {
- this.isAbortedByUser = isAborted;
-
- }
-
- @Override
- public final Object getRawData(String key) {
- if (StringUtils.isNotEmpty(key)) {
- return genericDataStorage.get(key);
-
- }
-
- log.info("Can not load generic request-data with key='null'");
- return null;
- }
-
- @Override
- public final T getRawData(String key, final Class clazz) {
- if (StringUtils.isNotEmpty(key)) {
- final Object data = genericDataStorage.get(key);
-
- if (data == null)
- return null;
-
- try {
- @SuppressWarnings("unchecked")
- final
- T test = (T) data;
- return test;
-
- } catch (final Exception e) {
- log.warn("Generic request-data object can not be casted to requested type", e);
- return null;
-
- }
-
- }
-
- log.info("Can not load generic request-data with key='null'");
- return null;
-
- }
-
- @Override
- public final void setRawDataToTransaction(String key, Object object) throws EAAFStorageException {
- if (StringUtils.isEmpty(key)) {
- log.info("Generic request-data can not be stored with a 'null' key");
- throw new EAAFStorageException("Generic request-data can not be stored with a 'null' key", null);
-
- }
-
- if (object != null) {
- if (!Serializable.class.isInstance(object)) {
- log.warn("Generic request-data can only store objects which implements the 'Seralizable' interface");
- throw new EAAFStorageException("Generic request-data can only store objects which implements the 'Seralizable' interface", null);
-
- }
- }
-
- if (genericDataStorage.containsKey(key))
- log.trace("Overwrite generic request-data with key:" + key);
- else
- log.trace("Add generic request-data with key:" + key + " to session.");
-
- genericDataStorage.put(key, object);
-
- }
-
- @Override
- public final void setRawDataToTransaction(Map map) throws EAAFStorageException {
- if (map == null) {
- log.info("Generic request-data can not be stored with a 'null' map");
- throw new EAAFStorageException("Generic request-data can not be stored with a 'null' map", null);
-
- }
-
- //validate and store values
- for (final Entry el : map.entrySet())
- setRawDataToTransaction(el.getKey(), el.getValue());
-
- }
-
+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 {
+
+ private static final Logger log = LoggerFactory.getLogger(RequestImpl.class);
+
+ public static final String DATAID_REQUESTER_IP_ADDRESS = "reqestImpl_requesterIPAddr";
+
+ private static final long serialVersionUID = 1L;
+
+ private String module = null;
+ private String action = null;
+
+ private String pendingRequestId = null;
+ private String processInstanceId;
+ private String internalSsoSessionId;
+
+ private String uniqueTransactionIdentifer;
+ private String uniqueSessionIdentifer;
+
+ private String requestedServiceProviderIdentifer;
+ private String idpAuthUrl = null;
+
+ private IspConfiguration spConfiguration = null;
+
+ private boolean passiv = false;
+ private boolean force = false;
+ private boolean isAbortedByUser = false;
+
+ // every request needs authentication by default
+ private boolean needAuthentication = true;
+
+ // every request is not authenticated by default
+ private boolean isAuthenticated = false;
+
+ // every request needs no SSO by default
+ private boolean needSso = false;
+
+ private boolean needUserConsent = false;
+
+ private final Map genericDataStorage = new HashMap<>();
+
+
+ /**
+ * Initialize this pendingRequest object.
+ *
+ * @param req {@link HttpServletRequest}
+ * @param authConfig {@link IConfiguration}
+ * @throws EaafException
+ *
+ */
+ public final void initialize(final HttpServletRequest req, final IConfigurationWithSP authConfig)
+ throws EaafException {
+ initialize(req, authConfig, null);
+
+ }
+
+ /**
+ * 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
+ *
+ * @throws EaafException
+ *
+ */
+ public final void initialize(@NonNull final HttpServletRequest req,
+ @NonNull final IConfigurationWithSP authConfig, @Nullable final String transactionId)
+ throws EaafException {
+ // use external transactionId or create new one if empty or null
+ if (StringUtils.isNotEmpty(transactionId)) {
+ uniqueTransactionIdentifer = transactionId;
+ } else {
+ uniqueTransactionIdentifer = Random.nextLongRandom();
+ }
+
+ // set unique transaction identifier for logging
+ TransactionIdUtils.setTransactionId(uniqueTransactionIdentifer);
+
+ // initialize session object
+ 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);
+ URL authReqUrl;
+ try {
+ authReqUrl = new URL(authUrlString);
+
+ } catch (final MalformedURLException e) {
+ log.error("IDP AuthenticationServiceURL Prefix is not a valid URL." + 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});
+
+ }
+
+ // set unique session identifier
+ final String uniqueID = (String) req.getAttribute(EAAFConstants.UNIQUESESSIONIDENTIFIER);
+ if (StringUtils.isNotEmpty(uniqueID)) {
+ this.uniqueSessionIdentifer = uniqueID;
+ } else {
+ log.debug("Create new sessionIdentifier for this pendingRequest ... ");
+ this.uniqueSessionIdentifer = UUID.randomUUID().toString();
+
+ }
+
+ // set requester's IP address
+ try {
+ setRawDataToTransaction(DATAID_REQUESTER_IP_ADDRESS, req.getRemoteAddr());
+
+ } catch (final EaafStorageException e) {
+ log.info("Can NOT store remote IP address into 'pendingRequest'.", e);
+
+ }
+
+ }
+
+ public final void setSpEntityId(final String spIdentifier) {
+ this.requestedServiceProviderIdentifer = spIdentifier;
+ }
+
+ @Override
+ public final String getSpEntityId() {
+ return this.requestedServiceProviderIdentifer;
+ }
+
+ @Override
+ public final boolean isPassiv() {
+ return passiv;
+ }
+
+ @Override
+ public final boolean forceAuth() {
+ return force;
+ }
+
+ public final void setPassiv(final boolean passiv) {
+ this.passiv = passiv;
+ }
+
+ public final void setForce(final boolean force) {
+ this.force = force;
+ }
+
+ @Override
+ public final String requestedAction() {
+ return action;
+ }
+
+ public final void setAction(final String action) {
+ this.action = action;
+ }
+
+ @Override
+ public final String requestedModule() {
+ return module;
+ }
+
+ public final void setModule(final String module) {
+ this.module = module;
+ }
+
+ public final void setPendingRequestId(final String pendingReqId) {
+ this.pendingRequestId = pendingReqId;
+
+ }
+
+ @Override
+ @NonNull
+ public final String getPendingRequestId() {
+ if (pendingRequestId == null) {
+ throw new IllegalStateException("No PendingRequestId set!!!");
+ }
+
+ return pendingRequestId;
+ }
+
+ @Override
+ public final String getInternalSsoSessionIdentifier() {
+ return this.internalSsoSessionId;
+ }
+
+ @Override
+ public final void setInternalSsoSessionIdentifier(final String internalSsoSessionId) {
+ this.internalSsoSessionId = internalSsoSessionId;
+
+ }
+
+ @Override
+ @Nonnull
+ public final T getSessionData(@Nonnull final Class wrapper) {
+ Assert.notNull(wrapper, "Wrapper must NOT null");
+ if (AuthProcessDataWrapper.class.isAssignableFrom(wrapper)) {
+ try {
+ return wrapper.getConstructor(Map.class).newInstance(this.genericDataStorage);
+
+ } catch (NoSuchMethodException | SecurityException | InstantiationException
+ | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ log.error("Can NOT instance wrapper: " + wrapper.getName(), e);
+
+ }
+
+ }
+
+ log.error("Can NOT wrap generic data into session data. " + "Reason: Wrapper "
+ + wrapper.getName() + " is NOT a valid wrapper");
+ throw new RuntimeException("Can NOT wrap generic data into session data. " + "Reason: Wrapper "
+ + wrapper.getName() + " is NOT a valid wrapper");
+
+ }
+
+ @Override
+ public final IspConfiguration getServiceProviderConfiguration() {
+ return this.spConfiguration;
+
+
+ }
+
+ @Override
+ public T getServiceProviderConfiguration(final Class decorator) {
+ if (this.spConfiguration != null) {
+ if (decorator.isAssignableFrom(this.spConfiguration.getClass())) {
+ return (T) this.spConfiguration;
+
+ } else {
+ log.error("Can not decorate SP configuration by '" + decorator.getName() + "'.");
+ }
+ throw new RuntimeException(
+ "Can not decorate SP configuration by '" + decorator.getName() + "'.");
+
+ }
+
+ return null;
+
+ }
+
+ public void setOnlineApplicationConfiguration(final IspConfiguration spConfig) {
+ this.spConfiguration = spConfig;
+
+ }
+
+ @Override
+ public final String getUniqueTransactionIdentifier() {
+ return this.uniqueTransactionIdentifer;
+
+ }
+
+ @Override
+ public final String getUniqueSessionIdentifier() {
+ return this.uniqueSessionIdentifer;
+
+ }
+
+ @Override
+ public final String getProcessInstanceId() {
+ return this.processInstanceId;
+
+ }
+
+ public final void setUniqueTransactionIdentifier(final String id) {
+ this.uniqueTransactionIdentifer = id;
+
+ }
+
+ public final void setUniqueSessionIdentifier(final String id) {
+ this.uniqueSessionIdentifer = id;
+
+ }
+
+ public void setProcessInstanceId(final String id) {
+ this.processInstanceId = id;
+
+ }
+
+ @Override
+ public final String getAuthUrl() {
+ return this.idpAuthUrl;
+ }
+
+ @Override
+ public final String getAuthUrlWithOutSlash() {
+ if (this.idpAuthUrl.endsWith("/")) {
+ return this.idpAuthUrl.substring(0, this.idpAuthUrl.length() - 1);
+ } else {
+ return this.idpAuthUrl;
+ }
+
+ }
+
+ @Override
+ public final boolean isNeedAuthentication() {
+ return needAuthentication;
+ }
+
+ public final void setNeedAuthentication(final boolean needAuthentication) {
+ this.needAuthentication = needAuthentication;
+ }
+
+ @Override
+ public final boolean isAuthenticated() {
+ return isAuthenticated;
+ }
+
+ @Override
+ public final void setAuthenticated(final boolean isAuthenticated) {
+ this.isAuthenticated = isAuthenticated;
+ }
+
+ @Override
+ public final boolean needSingleSignOnFunctionality() {
+ return needSso;
+ }
+
+ @Override
+ public final void setNeedSingleSignOnFunctionality(final boolean needSso) {
+ this.needSso = needSso;
+
+ }
+
+ @Override
+ public final boolean isNeedUserConsent() {
+ return this.needUserConsent;
+
+ }
+
+ @Override
+ public final void setNeedUserConsent(final boolean needConsent) {
+ this.needUserConsent = needConsent;
+
+ }
+
+ @Override
+ public final boolean isAbortedByUser() {
+ return this.isAbortedByUser;
+ }
+
+ @Override
+ public final void setAbortedByUser(final boolean isAborted) {
+ this.isAbortedByUser = isAborted;
+
+ }
+
+ @Override
+ public final Object getRawData(final String key) {
+ if (StringUtils.isNotEmpty(key)) {
+ return genericDataStorage.get(key);
+
+ }
+
+ log.info("Can not load generic request-data with key='null'");
+ return null;
+ }
+
+ @Override
+ public final T getRawData(final String key, final Class clazz) {
+ if (StringUtils.isNotEmpty(key)) {
+ final Object data = genericDataStorage.get(key);
+
+ if (data == null) {
+ return null;
+ }
+
+ try {
+ @SuppressWarnings("unchecked")
+ final T test = (T) data;
+ return test;
+
+ } catch (final Exception e) {
+ log.warn("Generic request-data object can not be casted to requested type", e);
+ return null;
+
+ }
+
+ }
+
+ log.info("Can not load generic request-data with key='null'");
+ return null;
+
+ }
+
+ @Override
+ public final void setRawDataToTransaction(final String key, final Object object)
+ throws EaafStorageException {
+ if (StringUtils.isEmpty(key)) {
+ log.info("Generic request-data can not be stored with a 'null' key");
+ throw new EaafStorageException("Generic request-data can not be stored with a 'null' key",
+ null);
+
+ }
+
+ if (object != null) {
+ if (!Serializable.class.isInstance(object)) {
+ log.warn(
+ "Generic request-data can only store objects which implements the 'Seralizable' interface");
+ throw new EaafStorageException(
+ "Generic request-data can only store objects which implements the 'Seralizable' interface",
+ null);
+
+ }
+ }
+
+ if (genericDataStorage.containsKey(key)) {
+ log.trace("Overwrite generic request-data with key:" + key);
+ } else {
+ log.trace("Add generic request-data with key:" + key + " to session.");
+ }
+
+ genericDataStorage.put(key, object);
+
+ }
+
+ @Override
+ public final void setRawDataToTransaction(final Map map)
+ throws EaafStorageException {
+ if (map == null) {
+ log.info("Generic request-data can not be stored with a 'null' map");
+ throw new EaafStorageException("Generic request-data can not be stored with a 'null' map",
+ null);
+
+ }
+
+ // validate and store values
+ for (final Entry el : map.entrySet()) {
+ setRawDataToTransaction(el.getKey(), el.getValue());
+ }
+
+ }
+
}
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 6b5f1a4c..3c8fd604 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
@@ -13,77 +13,85 @@ 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.idp.process.ExecutionContext;
-import at.gv.egiz.eaaf.core.exceptions.EAAFException;
+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;
public abstract class AbstractLocaleAuthServletTask extends AbstractAuthServletTask {
- private static final Logger log = LoggerFactory.getLogger(AbstractLocaleAuthServletTask.class);
-
- public static final String PROP_REQ_PARAM_LOCALE = "lang";
-
- @Override
- public final void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response)
- throws TaskExecutionException {
-
- final Serializable changeLangFlag = 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);
-
-
-
- } else {
- log.trace("Find {} parameter. Processing this task ... ",PROP_REQ_PARAM_LOCALE);
- executionContext.put(EAAFConstants.PROCESSCONTEXT_SWITCH_LANGUAGE, 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);
-
- } else
- executeWithLocale(executionContext, request, response);
-
- }
-
- }
-
- protected void stopProcessFromUserDecision(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException {
- try {
- revisionsLogger.logEvent(pendingReq, EAAFEventCodes.PROCESS_STOPPED_BY_USER);
- pendingReq.setAbortedByUser(true);
- pendingReq.setAuthenticated(false);
- performRedirectToProtocolFinialization(executionContext, pendingReq, request, response);
-
- log.trace("Set process-cancelation flag");
- executionContext.setCanceleProcessFlag();
-
- } catch (final EAAFException e) {
- throw new TaskExecutionException(pendingReq, e.getMessage(), e);
-
- } catch (final Exception e) {
- log.warn("Stopping auth.process FAILED", e);
- throw new TaskExecutionException(pendingReq, e.getMessage(), e);
-
- }
-
- }
-
- protected boolean parseFlagFromHttpRequest(HttpServletRequest httpReq, String httpParamName, boolean defaultValue) {
- final String flag = httpReq.getParameter(httpParamName);
- log.trace("Get httpParam: {} with value: {}", httpParamName, flag);
- if (StringUtils.isNotEmpty(httpParamName)) {
- return Boolean.parseBoolean(flag);
-
- } else {
- return defaultValue;
- }
-
- }
-
- protected abstract void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request,
- HttpServletResponse response) throws TaskExecutionException;
+ private static final Logger log = LoggerFactory.getLogger(AbstractLocaleAuthServletTask.class);
+
+ public static final String PROP_REQ_PARAM_LOCALE = "lang";
+
+ @Override
+ public final void execute(final ExecutionContext executionContext,
+ final HttpServletRequest request, final HttpServletResponse response)
+ throws TaskExecutionException {
+
+ final Serializable changeLangFlag =
+ 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);
+
+
+
+ } else {
+ log.trace("Find {} parameter. Processing this task ... ", PROP_REQ_PARAM_LOCALE);
+ executionContext.put(EAAFConstants.PROCESSCONTEXT_SWITCH_LANGUAGE, 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);
+
+ } else {
+ executeWithLocale(executionContext, request, response);
+ }
+
+ }
+
+ }
+
+ protected void stopProcessFromUserDecision(final ExecutionContext executionContext,
+ final HttpServletRequest request, final HttpServletResponse response)
+ throws TaskExecutionException {
+ try {
+ revisionsLogger.logEvent(pendingReq, EAAFEventCodes.PROCESS_STOPPED_BY_USER);
+ pendingReq.setAbortedByUser(true);
+ pendingReq.setAuthenticated(false);
+ performRedirectToProtocolFinialization(executionContext, pendingReq, request, response);
+
+ log.trace("Set process-cancelation flag");
+ executionContext.setCanceleProcessFlag();
+
+ } catch (final EaafException e) {
+ throw new TaskExecutionException(pendingReq, e.getMessage(), e);
+
+ } catch (final Exception e) {
+ log.warn("Stopping auth.process FAILED", e);
+ throw new TaskExecutionException(pendingReq, e.getMessage(), e);
+
+ }
+
+ }
+
+ protected boolean parseFlagFromHttpRequest(final HttpServletRequest httpReq,
+ final String httpParamName, final boolean defaultValue) {
+ final String flag = httpReq.getParameter(httpParamName);
+ log.trace("Get httpParam: {} with value: {}", httpParamName, flag);
+ if (StringUtils.isNotEmpty(httpParamName)) {
+ return Boolean.parseBoolean(flag);
+
+ } else {
+ return defaultValue;
+ }
+
+ }
+
+ protected abstract void executeWithLocale(ExecutionContext executionContext,
+ HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException;
}
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 b12a69b2..7991c093 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
@@ -1,81 +1,79 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
package at.gv.egiz.eaaf.core.impl.idp.controller.tasks;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
-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.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.
+ *
* @author tlenz
*
*/
@Component("FinalizeAuthenticationTask")
public class FinalizeAuthenticationTask extends AbstractAuthServletTask {
- private static final Logger log = LoggerFactory.getLogger(FinalizeAuthenticationTask.class);
-
- /* (non-Javadoc)
- * @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
- public void execute(ExecutionContext executionContext,
- HttpServletRequest request, HttpServletResponse response)
- throws TaskExecutionException {
-
- try {
- //set pending request to authenticated
- pendingReq.setAuthenticated(true);
- revisionsLogger.logEvent(pendingReq, IAuthenticationManager.EVENT_AUTHENTICATION_PROCESS_FINISHED);
- performRedirectToProtocolFinialization(executionContext, pendingReq, request, response);
-
-
- } catch (final EAAFException e) {
- throw new TaskExecutionException(pendingReq, e.getMessage(), e);
-
- } catch (final Exception e) {
- log.warn("FinalizeAuthenticationTask has an internal error", e);
- throw new TaskExecutionException(pendingReq, e.getMessage(), e);
-
- } finally {
- executionContext.remove(EAAFConstants.PROCESS_ENGINE_PENDINGREQUESTID);
-
- }
-
- }
+ private static final Logger log = LoggerFactory.getLogger(FinalizeAuthenticationTask.class);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @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
+ public void execute(final ExecutionContext executionContext, final HttpServletRequest request,
+ final HttpServletResponse response) throws TaskExecutionException {
+
+ try {
+ // set pending request to authenticated
+ pendingReq.setAuthenticated(true);
+ revisionsLogger.logEvent(pendingReq,
+ IAuthenticationManager.EVENT_AUTHENTICATION_PROCESS_FINISHED);
+ performRedirectToProtocolFinialization(executionContext, pendingReq, request, response);
+
+
+ } catch (final EaafException e) {
+ throw new TaskExecutionException(pendingReq, e.getMessage(), e);
+
+ } catch (final Exception e) {
+ log.warn("FinalizeAuthenticationTask has an internal error", e);
+ throw new TaskExecutionException(pendingReq, e.getMessage(), e);
+
+ } finally {
+ 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 5ea5baa1..7a2c5f08 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
@@ -1,121 +1,122 @@
-/*******************************************************************************
- * 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.
+/*
+ * 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.
*
- * Licensed under the EUPL, Version 1.2 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:
+ * Licensed under the EUPL, Version 1.2 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:
* https://joinup.ec.europa.eu/news/understanding-eupl-v12
*
- * 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.
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
-/*******************************************************************************
- *******************************************************************************/
+ * 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.
+*/
+
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;
+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 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.
+ *
* @author tlenz
*
*/
@Component("RestartAuthProzessManagement")
-public class RestartAuthProzessManagement extends AbstractAuthServletTask {
- private static final Logger log = LoggerFactory.getLogger(RestartAuthProzessManagement.class);
-
- @Autowired ProcessEngine processEngine;
-
- /* (non-Javadoc)
- * @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
- public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response)
- throws TaskExecutionException {
- try {
-
- if (this.pendingReq.isAbortedByUser()) {
- log.debug("AuthProcess was stopped. Forward to finalization ... ");
- performRedirectToProtocolFinialization(executionContext, pendingReq, request, response);
-
- } else {
- //create a new execution context and copy all elements to new context
- final ExecutionContext newec = new ExecutionContextImpl();
- final Set entries = executionContext.keySet();
- for (final String key : entries) {
- newec.put(key, executionContext.get(key));
-
- }
-
- log.debug("Select new auth.-process and restart restart process-engine ... ");
-
- // select and create new process instance
- final String processDefinitionId = ModuleRegistration.getInstance().selectProcess(newec, pendingReq);
- if (processDefinitionId == null) {
- log.warn("No suitable authentication process found for SessionID " + pendingReq.getPendingRequestId());
- throw new EAAFException("process.02", new Object[] { pendingReq.getPendingRequestId()});
- }
-
- final String processInstanceId = processEngine.createProcessInstance(processDefinitionId, newec);
-
- // keep process instance id in moa session
- ((RequestImpl)pendingReq).setProcessInstanceId(processInstanceId);
-
- // make sure pending request has been persisted before running the process
- try {
- requestStoreage.storePendingRequest(pendingReq);
-
- } catch (final EAAFException e) {
- log.error("Database Error! MOASession is not stored!");
- throw new EAAFException("internal.02", null);
-
- }
-
- log.info("Restart process-engine with auth.process:" + processDefinitionId);
-
- // start process
- processEngine.start(pendingReq);
-
- }
-
- } catch (final EAAFException e) {
- throw new TaskExecutionException(pendingReq, e.getMessage(), e);
-
- } catch (final Exception e) {
- log.warn("RestartAuthProzessManagement has an internal error", e);
- throw new TaskExecutionException(pendingReq, e.getMessage(), e);
-
- }
-
- }
+public class RestartAuthProzessManagement extends AbstractAuthServletTask {
+ private static final Logger log = LoggerFactory.getLogger(RestartAuthProzessManagement.class);
+
+ @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,
+ * javax.servlet.http.HttpServletResponse)
+ */
+ @Override
+ public void execute(final ExecutionContext executionContext, final HttpServletRequest request,
+ final HttpServletResponse response) throws TaskExecutionException {
+ try {
+
+ if (this.pendingReq.isAbortedByUser()) {
+ log.debug("AuthProcess was stopped. Forward to finalization ... ");
+ performRedirectToProtocolFinialization(executionContext, pendingReq, request, response);
+
+ } else {
+ // create a new execution context and copy all elements to new context
+ final ExecutionContext newec = new ExecutionContextImpl();
+ final Set