From bee5dd259a4438d45ecd1bcc26dfba12875236d6 Mon Sep 17 00:00:00 2001
From: Thomas Lenz
Date: Tue, 26 Jun 2018 11:03:48 +0200
Subject: initial commit
---
.../spring/test/task/SignAuthBlockTask.java | 62 ++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java
(limited to 'eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java')
diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java
new file mode 100644
index 00000000..5b3158e3
--- /dev/null
+++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/process/spring/test/task/SignAuthBlockTask.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ *******************************************************************************/
+package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Objects;
+
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
+import at.gv.egiz.eaaf.core.api.idp.process.Task;
+import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+
+/**
+ * A dummy task simulating the signature of an auth block.
+ *
+ * Asynchonous
+ *
+ * Requires context data:
+ *
+ * - {@code IdentityLink}
+ * - {@code isIdentityLinkValidated}
+ * - {@code bkuURL}
+ *
+ *
+ *
+ * Enriches context data with:
+ *
+ * - {@code SignedAuthBlock}
+ *
+ *
+ *
+ * @author tknall
+ *
+ */
+@Service("SignAuthBlockTask")
+public class SignAuthBlockTask implements Task {
+
+ private Logger log = LoggerFactory.getLogger(getClass());
+
+ @Override
+ public IRequest execute(IRequest penReq, ExecutionContext executionContext) throws TaskExecutionException {
+ Objects.requireNonNull(executionContext.get("IdentityLink"));
+ assert (Boolean.TRUE.equals(Objects.requireNonNull(executionContext.get("isIdentityLinkValidated"))));
+ Objects.requireNonNull(executionContext.get("bkuURL"));
+
+ log.debug("Using validated IdentityLink and bkuURL in order to sign auth block.");
+ try (InputStream in = getClass().getResourceAsStream("/process/spring/test/task/SignedAuthBlock.xml")) {
+ executionContext.put("SignedAuthBlock", IOUtils.toString(in, "UTF-8"));
+ } catch (IOException e) {
+ throw new TaskExecutionException(null, "", e);
+
+ }
+ return null;
+ }
+
+}
--
cgit v1.2.3