aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib')
-rw-r--r--id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/AuthenticationDataBuilderTest.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/AuthenticationDataBuilderTest.java b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/AuthenticationDataBuilderTest.java
index 645cb601f..a3a717072 100644
--- a/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/AuthenticationDataBuilderTest.java
+++ b/id/server/idserverlib/src/test/java/at/gv/egovernment/moa/id/config/auth/data/AuthenticationDataBuilderTest.java
@@ -1,9 +1,12 @@
package at.gv.egovernment.moa.id.config.auth.data;
+import static org.junit.Assert.assertEquals;
+
import java.io.ByteArrayInputStream;
import java.util.Arrays;
import java.util.List;
+import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +16,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import at.gv.egiz.eaaf.core.impl.data.Pair;
import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
import at.gv.egovernment.moa.id.auth.builder.AuthenticationDataBuilder;
+import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionWrapper;
+
import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser;
import at.gv.egovernment.moa.id.commons.api.data.IAuthenticationSession;
import at.gv.egovernment.moa.id.data.IMOAAuthData;
@@ -153,6 +158,33 @@ public class AuthenticationDataBuilderTest {
}
+ @Test
+ public void genericDataTransfer() throws Exception {
+ TestRequestImpl pendingReq = new TestRequestImpl();
+ DummyOAConfig oaParam = new DummyOAConfig();
+ oaParam.setHasBaseIdTransferRestriction(false);
+ oaParam.setTarget("urn:publicid:gv.at:cdid+ZP-MH");
+ oaParam.setForeignbPKSectors(Arrays.asList("wbpk+FN+195738a"));
+ pendingReq.setSpConfig(oaParam);
+
+ final AuthenticationSessionWrapper session = pendingReq.getSessionData(
+ AuthenticationSessionWrapper.class);
+ session.setIdentityLink(new IdentityLinkAssertionParser(new ByteArrayInputStream(Base64Utils.decode(DUMMY_IDL_1, false))).parseIdentityLink());
+
+ // set random data to transfer
+ String key = RandomStringUtils.randomAlphabetic(5);
+ String value = RandomStringUtils.randomAlphabetic(5);
+ session.setGenericDataToSession(key, value);
+
+
+ // execute test
+ IMOAAuthData authData = (IMOAAuthData) authBuilder.buildAuthenticationData(pendingReq);
+
+
+ assertEquals("generic data-transfer failed", value, authData.getGenericData(key, String.class));
+
+ }
+
@Test
public void buildAuthDataWithIDLOnly_1() throws Exception {
@@ -166,7 +198,7 @@ public class AuthenticationDataBuilderTest {
IAuthenticationSession session = new DummyAuthSession();
session.setIdentityLink(new IdentityLinkAssertionParser(new ByteArrayInputStream(Base64Utils.decode(DUMMY_IDL_1, false))).parseIdentityLink());
pendingReq.setRawDataToTransaction(session.getKeyValueRepresentationFromAuthSession());
-
+
IMOAAuthData authData = (IMOAAuthData) authBuilder.buildAuthenticationData(pendingReq);