aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/test')
-rw-r--r--id/server/idserverlib/src/test/java/test/abnahme/A/Test100StartAuthentication.java16
-rw-r--r--id/server/idserverlib/src/test/java/test/abnahme/AbnahmeTestCase.java1
-rw-r--r--id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java251
-rw-r--r--id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/AuthenticationServerTest.java2
4 files changed, 130 insertions, 140 deletions
diff --git a/id/server/idserverlib/src/test/java/test/abnahme/A/Test100StartAuthentication.java b/id/server/idserverlib/src/test/java/test/abnahme/A/Test100StartAuthentication.java
index 6ab9c9679..4293fc477 100644
--- a/id/server/idserverlib/src/test/java/test/abnahme/A/Test100StartAuthentication.java
+++ b/id/server/idserverlib/src/test/java/test/abnahme/A/Test100StartAuthentication.java
@@ -37,7 +37,7 @@ public class Test100StartAuthentication extends AbnahmeTestCase {
"http://localhost:9080/", //oaURL
"file:" + findXmldata("AuthTemplate.html"),
"http://localhost:3495/http-security-layer-request",
- null, null);
+ null, null, null);
htmlForm = killExclusive(htmlForm, "MOASessionID=","\"","DELETED");
//writeXmldata("htmlForm_out.html",htmlForm.getBytes("UTF-8"));
assertEquals(readXmldata("htmlForm.html"),htmlForm);
@@ -55,7 +55,7 @@ public class Test100StartAuthentication extends AbnahmeTestCase {
"gb", //target
"http://localhost:9080/", //oaURL
null,
- "http://localhost:3495/http-security-layer-request", null, null);
+ "http://localhost:3495/http-security-layer-request", null, null, null);
htmlForm = killExclusive(htmlForm, "MOASessionID=","\"","DELETED");
//writeXmldata("htmlForm_out.html",htmlForm.getBytes("UTF-8"));
assertEquals(readXmldata("htmlForm.html"),htmlForm);
@@ -75,7 +75,7 @@ public class Test100StartAuthentication extends AbnahmeTestCase {
"file:" + findXmldata("AuthTemplate.html"),
null,
null,
- null);
+ null, null);
htmlForm = killExclusive(htmlForm, "MOASessionID=","\"","DELETED");
//writeXmldata("htmlForm_out.html",htmlForm.getBytes("UTF-8"));
assertEquals(readXmldata("htmlForm.html"),htmlForm);
@@ -93,7 +93,7 @@ public class Test100StartAuthentication extends AbnahmeTestCase {
server.startAuthentication(null, //authURL
"gb", //target
"http://localhost:9080/", //oaURL
- null, null, null, null);
+ null, null, null, null, null);
//assertEquals("",htmlForm);
System.err.println(this.getName() + " hat KEINE FEHLER geworfen");
fail(this.getName() + " hat KEINE FEHLER geworfen");
@@ -113,7 +113,7 @@ public class Test100StartAuthentication extends AbnahmeTestCase {
try {
server.startAuthentication("http://localhost:8080/auth", //authURL
"gb", "http://localhost:9080/", //oaURL
- null, null, null, null);
+ null, null, null, null, null);
System.err.println(this.getName() + " hat KEINE FEHLER geworfen");
fail(this.getName() + " hat KEINE FEHLER geworfen");
}
@@ -131,7 +131,7 @@ public class Test100StartAuthentication extends AbnahmeTestCase {
try {
server.startAuthentication("https://localhost:8443/auth", //authURL
"gb", "http://host_not_in_config/", //oaURL
- null, null, null, null);
+ null, null, null, null, null);
System.err.println(this.getName() + " hat KEINE FEHLER geworfen");
fail(this.getName() + " hat KEINE FEHLER geworfen");
}
@@ -150,7 +150,7 @@ public class Test100StartAuthentication extends AbnahmeTestCase {
try {
server.startAuthentication("https://localhost:8443/auth", //authURL
"gb", null, //oaURL
- null, null, null, null);
+ null, null, null, null, null);
System.err.println(this.getName() + " hat KEINE FEHLER geworfen");
fail(this.getName() + " hat KEINE FEHLER geworfen");
}
@@ -169,7 +169,7 @@ public class Test100StartAuthentication extends AbnahmeTestCase {
try {
server.startAuthentication("https://localhost:8443/auth", //authURL
null, "http://localhost:9080/", //oaURL
- null, null, null, null);
+ null, null, null, null, null);
System.err.println(this.getName() + " hat KEINE FEHLER geworfen");
fail(this.getName() + " hat KEINE FEHLER geworfen");
}
diff --git a/id/server/idserverlib/src/test/java/test/abnahme/AbnahmeTestCase.java b/id/server/idserverlib/src/test/java/test/abnahme/AbnahmeTestCase.java
index 23130f4c8..4ef3ad92f 100644
--- a/id/server/idserverlib/src/test/java/test/abnahme/AbnahmeTestCase.java
+++ b/id/server/idserverlib/src/test/java/test/abnahme/AbnahmeTestCase.java
@@ -131,6 +131,7 @@ public class AbnahmeTestCase extends MOAIDTestCase {
null,
null,
null,
+ null,
null);
String sessionID = parseSessionIDFromForm(htmlForm);
return sessionID;
diff --git a/id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java b/id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java
index ab2781590..248e5cc33 100644
--- a/id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java
+++ b/id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java
@@ -14,19 +14,8 @@
* limitations under the License.
*/
package test.abnahme.P;
-import java.util.Map;
-
-import sun.misc.BASE64Decoder;
import test.abnahme.AbnahmeTestCase;
-import at.gv.egovernment.moa.id.config.proxy.OAConfiguration;
-import at.gv.egovernment.moa.id.config.proxy.OAProxyParameter;
-import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider;
-import at.gv.egovernment.moa.id.data.AuthenticationData;
-import at.gv.egovernment.moa.id.proxy.LoginParameterResolver;
-import at.gv.egovernment.moa.id.proxy.LoginParameterResolverFactory;
-import at.gv.egovernment.moa.util.Base64Utils;
-
/**
* @author Stefan Knirsch
* @version $Id$
@@ -35,127 +24,127 @@ import at.gv.egovernment.moa.util.Base64Utils;
public class Test100LoginParameterResolver extends AbnahmeTestCase {
- private static final String CLIENT_IP_ADDRESS = "56.246.75.11";
- private OAConfiguration oaConf;
- private LoginParameterResolver lpr;
-
+// private static final String CLIENT_IP_ADDRESS = "56.246.75.11";
+// private OAConfiguration oaConf;
+// private LoginParameterResolver lpr;
+//
public Test100LoginParameterResolver(String name) {
super(name);
}
-
- private void setUp(String publicURLPrefix)
- throws Exception {
-
- // get configuration data
- ProxyConfigurationProvider proxyConf = ProxyConfigurationProvider.getInstance();
- OAProxyParameter oaParam = proxyConf.getOnlineApplicationParameter(publicURLPrefix);
- oaConf = oaParam.getOaConfiguration();
- System.out.println("Parameterübergabe: " + oaConf.getAuthType());
-
- // get login parameter resolver
- LoginParameterResolverFactory.initialize();
- lpr = LoginParameterResolverFactory.getLoginParameterResolver(publicURLPrefix);
- }
- public void testP101() throws Exception {
- try {
- // read configuration and set up LoginParameterResolver
- setUp("https://testP101:9443/");
- if (! oaConf.getAuthType().equals(OAConfiguration.BASIC_AUTH))
- fail();
-
- // assemble authentication data
- AuthenticationData authData = new AuthenticationData();
- authData.setFamilyName("Huber");
- authData.setGivenName("Hugo");
-
- // resolve login headers
- Map loginHeaders = lpr.getAuthenticationHeaders(oaConf, authData, CLIENT_IP_ADDRESS, false, "");
-
- // validate login headers
- assertEquals(1, loginHeaders.keySet().size());
- System.out.println("Header Authorization: " + loginHeaders.get("Authorization"));
- System.out.println("Decoded UserID:Password " +
- new String(new BASE64Decoder().decodeBuffer(((String)loginHeaders.get("Authorization")).substring(6))));
- String userIDPassword = "Hugo:Huber";
- String credentials = Base64Utils.encode(userIDPassword.getBytes());
- assertEquals("Basic " + credentials, loginHeaders.get("Authorization"));
- System.out.println("-----------------------Testfall " + this.getName() + " erfolgreich abgearbeitet! -----------------------");
- }
- catch (Exception e) {
- System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage());
- throw e;
- }
-
- }
- public void testP102() throws Exception {
- try {
- // read configuration and set up LoginParameterResolver
- setUp("https://testP102:9443/");
- if (! oaConf.getAuthType().equals(OAConfiguration.PARAM_AUTH))
- fail();
-
- // assemble authentication data
- AuthenticationData authData = new AuthenticationData();
- String DATE_OF_BIRTH = "1963-12-29";
- String VPK = "kp6hOq6LRAkLtrqm6EvDm6bMwJw=";
- authData.setDateOfBirth(DATE_OF_BIRTH);
- authData.setBPK(VPK);
-
- // resolve login parameters
- Map loginParameters = lpr.getAuthenticationParameters(oaConf, authData, CLIENT_IP_ADDRESS, false, "");
-
- // validate login headers
- assertEquals(2, loginParameters.keySet().size());
- System.out.println("Param1: " + loginParameters.get("Param1"));
- System.out.println("Param2: " + loginParameters.get("Param2"));
- assertEquals(DATE_OF_BIRTH, loginParameters.get("Param1"));
- assertEquals(VPK, loginParameters.get("Param2"));
- System.out.println("-----------------------Testfall " + this.getName() + " erfolgreich abgearbeitet! -----------------------");
- }
- catch (Exception e) {
- System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage());
- throw e;
- }
- }
-
- public void testP103() throws Exception {
- try {
- // read configuration and set up LoginParameterResolver
- setUp("https://localhost:9443/");
- if (! oaConf.getAuthType().equals(OAConfiguration.HEADER_AUTH))
- fail();
-
- // assemble authentication data
- AuthenticationData authData = new AuthenticationData();
- boolean PUBLIC_AUTH = true;
- String BKZ = "FinanzamtWien23Leitstelle";
- boolean QUAL_CERT = false;
- String STAMMZAHL = "3456789012";
- authData.setPublicAuthority(PUBLIC_AUTH);
- authData.setPublicAuthorityCode(BKZ);
- authData.setQualifiedCertificate(QUAL_CERT);
- authData.setIdentificationValue(STAMMZAHL);
-
- // resolve login headers
- Map loginHeaders = lpr.getAuthenticationHeaders(oaConf, authData, CLIENT_IP_ADDRESS, false, "");
-
- // validate login headers
- assertEquals(5, loginHeaders.keySet().size());
- System.out.println("Header Param1: " + loginHeaders.get("Param1"));
- System.out.println("Header Param2: " + loginHeaders.get("Param2"));
- System.out.println("Header Param3: " + loginHeaders.get("Param3"));
- System.out.println("Header Param4: " + loginHeaders.get("Param4"));
- System.out.println("Header Param5: " + loginHeaders.get("Param5"));
- assertEquals(String.valueOf(PUBLIC_AUTH), loginHeaders.get("Param1"));
- assertEquals(BKZ, loginHeaders.get("Param2"));
- assertEquals(String.valueOf(QUAL_CERT), loginHeaders.get("Param3"));
- assertEquals(STAMMZAHL, loginHeaders.get("Param4"));
- assertEquals(CLIENT_IP_ADDRESS, loginHeaders.get("Param5"));
- System.out.println("-----------------------Testfall " + this.getName() + " erfolgreich abgearbeitet! -----------------------");
- }
- catch (Exception e) {
- System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage());
- throw e;
- }
- }
+//
+// private void setUp(String publicURLPrefix)
+// throws Exception {
+//
+// // get configuration data
+// ProxyConfigurationProvider proxyConf = ProxyConfigurationProvider.getInstance();
+// OAProxyParameter oaParam = proxyConf.getOnlineApplicationParameter(publicURLPrefix);
+// oaConf = oaParam.getOaConfiguration();
+// System.out.println("Parameterübergabe: " + oaConf.getAuthType());
+//
+// // get login parameter resolver
+// LoginParameterResolverFactory.initialize();
+// lpr = LoginParameterResolverFactory.getLoginParameterResolver(publicURLPrefix);
+// }
+// public void testP101() throws Exception {
+// try {
+// // read configuration and set up LoginParameterResolver
+// setUp("https://testP101:9443/");
+// if (! oaConf.getAuthType().equals(OAConfiguration.BASIC_AUTH))
+// fail();
+//
+// // assemble authentication data
+// AuthenticationData authData = new AuthenticationData();
+// authData.setFamilyName("Huber");
+// authData.setGivenName("Hugo");
+//
+// // resolve login headers
+// Map loginHeaders = lpr.getAuthenticationHeaders(oaConf, authData, CLIENT_IP_ADDRESS, false, "");
+//
+// // validate login headers
+// assertEquals(1, loginHeaders.keySet().size());
+// System.out.println("Header Authorization: " + loginHeaders.get("Authorization"));
+// System.out.println("Decoded UserID:Password " +
+// new String(new BASE64Decoder().decodeBuffer(((String)loginHeaders.get("Authorization")).substring(6))));
+// String userIDPassword = "Hugo:Huber";
+// String credentials = Base64Utils.encode(userIDPassword.getBytes());
+// assertEquals("Basic " + credentials, loginHeaders.get("Authorization"));
+// System.out.println("-----------------------Testfall " + this.getName() + " erfolgreich abgearbeitet! -----------------------");
+// }
+// catch (Exception e) {
+// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage());
+// throw e;
+// }
+//
+// }
+// public void testP102() throws Exception {
+// try {
+// // read configuration and set up LoginParameterResolver
+// setUp("https://testP102:9443/");
+// if (! oaConf.getAuthType().equals(OAConfiguration.PARAM_AUTH))
+// fail();
+//
+// // assemble authentication data
+// AuthenticationData authData = new AuthenticationData();
+// String DATE_OF_BIRTH = "1963-12-29";
+// String VPK = "kp6hOq6LRAkLtrqm6EvDm6bMwJw=";
+// authData.setDateOfBirth(DATE_OF_BIRTH);
+// authData.setBPK(VPK);
+//
+// // resolve login parameters
+// Map loginParameters = lpr.getAuthenticationParameters(oaConf, authData, CLIENT_IP_ADDRESS, false, "");
+//
+// // validate login headers
+// assertEquals(2, loginParameters.keySet().size());
+// System.out.println("Param1: " + loginParameters.get("Param1"));
+// System.out.println("Param2: " + loginParameters.get("Param2"));
+// assertEquals(DATE_OF_BIRTH, loginParameters.get("Param1"));
+// assertEquals(VPK, loginParameters.get("Param2"));
+// System.out.println("-----------------------Testfall " + this.getName() + " erfolgreich abgearbeitet! -----------------------");
+// }
+// catch (Exception e) {
+// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage());
+// throw e;
+// }
+// }
+//
+// public void testP103() throws Exception {
+// try {
+// // read configuration and set up LoginParameterResolver
+// setUp("https://localhost:9443/");
+// if (! oaConf.getAuthType().equals(OAConfiguration.HEADER_AUTH))
+// fail();
+//
+// // assemble authentication data
+// AuthenticationData authData = new AuthenticationData();
+// boolean PUBLIC_AUTH = true;
+// String BKZ = "FinanzamtWien23Leitstelle";
+// boolean QUAL_CERT = false;
+// String STAMMZAHL = "3456789012";
+// authData.setPublicAuthority(PUBLIC_AUTH);
+// authData.setPublicAuthorityCode(BKZ);
+// authData.setQualifiedCertificate(QUAL_CERT);
+// authData.setIdentificationValue(STAMMZAHL);
+//
+// // resolve login headers
+// Map loginHeaders = lpr.getAuthenticationHeaders(oaConf, authData, CLIENT_IP_ADDRESS, false, "");
+//
+// // validate login headers
+// assertEquals(5, loginHeaders.keySet().size());
+// System.out.println("Header Param1: " + loginHeaders.get("Param1"));
+// System.out.println("Header Param2: " + loginHeaders.get("Param2"));
+// System.out.println("Header Param3: " + loginHeaders.get("Param3"));
+// System.out.println("Header Param4: " + loginHeaders.get("Param4"));
+// System.out.println("Header Param5: " + loginHeaders.get("Param5"));
+// assertEquals(String.valueOf(PUBLIC_AUTH), loginHeaders.get("Param1"));
+// assertEquals(BKZ, loginHeaders.get("Param2"));
+// assertEquals(String.valueOf(QUAL_CERT), loginHeaders.get("Param3"));
+// assertEquals(STAMMZAHL, loginHeaders.get("Param4"));
+// assertEquals(CLIENT_IP_ADDRESS, loginHeaders.get("Param5"));
+// System.out.println("-----------------------Testfall " + this.getName() + " erfolgreich abgearbeitet! -----------------------");
+// }
+// catch (Exception e) {
+// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage());
+// throw e;
+// }
+// }
}
diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/AuthenticationServerTest.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/AuthenticationServerTest.java
index f873f2c3f..db7aa9719 100644
--- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/AuthenticationServerTest.java
+++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/AuthenticationServerTest.java
@@ -45,7 +45,7 @@ public class AuthenticationServerTest extends UnitTestCase {
public void doTest(String testdataDirectory, String authURL, String target, String oaURL, String bkuURL, String templateURL) throws Exception {
String testdataRoot = TESTDATA_ROOT + "xmldata/" + testdataDirectory + "/";
AuthenticationServer server = AuthenticationServer.getInstance();
- String htmlForm = server.startAuthentication(authURL, target, oaURL, templateURL, bkuURL, null, null);
+ String htmlForm = server.startAuthentication(authURL, target, oaURL, templateURL, bkuURL, null, null, null);
String sessionID = parseSessionIDFromForm(htmlForm);
String infoboxReadResponse = readFile(TESTDATA_ROOT + "xmldata/testperson1/" + "InfoboxReadResponse.xml");
HashMap parameters = new HashMap(1);