diff options
Diffstat (limited to 'id.server/src')
6 files changed, 82 insertions, 27 deletions
diff --git a/id.server/src/test/abnahme/A/Test200VerifyIdentityLink.java b/id.server/src/test/abnahme/A/Test200VerifyIdentityLink.java index c3325349d..d0ba51923 100644 --- a/id.server/src/test/abnahme/A/Test200VerifyIdentityLink.java +++ b/id.server/src/test/abnahme/A/Test200VerifyIdentityLink.java @@ -1,10 +1,15 @@ package test.abnahme.A; +import java.util.HashMap; + import org.w3c.dom.Element; + + import test.abnahme.AbnahmeTestCase; import at.gv.egovernment.moa.id.AuthenticationException; import at.gv.egovernment.moa.id.ParseException; +import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; import at.gv.egovernment.moa.id.auth.builder.VerifyXMLSignatureRequestBuilder; import at.gv.egovernment.moa.id.auth.data.IdentityLink; import at.gv.egovernment.moa.id.auth.invoke.SignatureVerificationInvoker; @@ -30,8 +35,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { String sessionID = startAuthentication(); System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); - - String createXMLSignatureRequest = server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + String createXMLSignatureRequest = server.verifyIdentityLink(sessionID, parameters); InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); IdentityLink idl = irrp.parseIdentityLink(); @@ -61,8 +67,11 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { startAuthentication(); String sessionID = "0"; String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); + try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); } @@ -87,7 +96,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); } @@ -108,8 +119,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); } @@ -128,7 +140,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { String sessionID = startAuthentication(); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); } @@ -148,7 +162,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); } catch (ParseException e) { System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); @@ -165,7 +181,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); } catch (ValidateException e) { System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); @@ -183,7 +201,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); @@ -204,7 +224,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); } @@ -224,7 +246,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); } @@ -244,7 +268,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); } @@ -264,7 +290,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); } @@ -288,7 +316,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { // System.out.println(infoboxReadResponse); try { - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); System.err.println(this.getName() + " hat KEINE FEHLER geworfen"); fail(this.getName() + " hat KEINE FEHLER geworfen"); } @@ -307,7 +337,9 @@ public class Test200VerifyIdentityLink extends AbnahmeTestCase { String sessionID = startAuthentication(); System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); IdentityLink idl = irrp.parseIdentityLink(); Element domVerifyXMLSignatureRequest = new VerifyXMLSignatureRequestBuilder().build(idl, AuthConfigurationProvider.getInstance().getMoaSpAuthBlockTrustProfileID()); diff --git a/id.server/src/test/abnahme/A/Test300VerifyAuthBlock.java b/id.server/src/test/abnahme/A/Test300VerifyAuthBlock.java index 8bf7f32ab..9bf92e54b 100644 --- a/id.server/src/test/abnahme/A/Test300VerifyAuthBlock.java +++ b/id.server/src/test/abnahme/A/Test300VerifyAuthBlock.java @@ -1,6 +1,7 @@ package test.abnahme.A; import java.util.Calendar; +import java.util.HashMap; import org.w3c.dom.Element; import test.abnahme.AbnahmeTestCase; @@ -9,6 +10,7 @@ import at.gv.egovernment.moa.id.AuthenticationException; import at.gv.egovernment.moa.id.BuildException; import at.gv.egovernment.moa.id.ParseException; import at.gv.egovernment.moa.id.auth.AuthenticationServer; +import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; import at.gv.egovernment.moa.id.auth.builder.AuthenticationDataAssertionBuilder; import at.gv.egovernment.moa.id.auth.builder.PersonDataBuilder; import at.gv.egovernment.moa.id.auth.builder.BPKBuilder; @@ -187,7 +189,9 @@ public class Test300VerifyAuthBlock extends AbnahmeTestCase { String sessionID = startAuthentication(); System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); IdentityLink idl = irrp.parseIdentityLink(); Element domVerifyXMLSignatureRequest = new VerifyXMLSignatureRequestBuilder().build(idl, AuthConfigurationProvider.getInstance().getMoaSpAuthBlockTrustProfileID()); @@ -218,7 +222,9 @@ public class Test300VerifyAuthBlock extends AbnahmeTestCase { String sessionID = startAuthentication(); System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); server.setSecondsSessionTimeOut(-100); server.cleanup(); InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); @@ -277,7 +283,9 @@ public class Test300VerifyAuthBlock extends AbnahmeTestCase { String sessionID = startAuthentication(); System.out.println(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); IdentityLink idl = irrp.parseIdentityLink(); Element domVerifyXMLSignatureRequest = new VerifyXMLSignatureRequestBuilder().build(idl, AuthConfigurationProvider.getInstance().getMoaSpAuthBlockTrustProfileID()); @@ -500,7 +508,9 @@ public class Test300VerifyAuthBlock extends AbnahmeTestCase { private AuthenticationData initServer(String sessionID) throws Exception { String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); IdentityLink idl = irrp.parseIdentityLink(); Element domVerifyXMLSignatureRequest = new VerifyXMLSignatureRequestBuilder().build(idl, "TrustProfile1"); @@ -517,7 +527,9 @@ public class Test300VerifyAuthBlock extends AbnahmeTestCase { private AuthenticationData initServerWithoutValidateAuthBlock(String sessionID) throws Exception { String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); IdentityLink idl = irrp.parseIdentityLink(); Element domVerifyXMLSignatureRequest = new VerifyXMLSignatureRequestBuilder().build(idl, "TrustProfile1"); @@ -583,7 +595,7 @@ public class Test300VerifyAuthBlock extends AbnahmeTestCase { oaParam.getProvideIdentityLink() ? DOMUtils.serializeNode(identityLink.getSamlAssertion()) : ""; String authBlock = oaParam.getProvideAuthBlock() ? session.getAuthBlock() : ""; String samlAssertion = new AuthenticationDataAssertionBuilder().build( - authData, prPerson, authBlock, ilAssertion, session.getBkuURL(), "", false); + authData, prPerson, authBlock, ilAssertion, session.getBkuURL(), "", false, null); authData.setSamlAssertion(samlAssertion); return authData; } diff --git a/id.server/src/test/abnahme/A/Test400GetAuthenticationData.java b/id.server/src/test/abnahme/A/Test400GetAuthenticationData.java index e265905b8..3db0a6d69 100644 --- a/id.server/src/test/abnahme/A/Test400GetAuthenticationData.java +++ b/id.server/src/test/abnahme/A/Test400GetAuthenticationData.java @@ -1,10 +1,13 @@ package test.abnahme.A; +import java.util.HashMap; + import org.w3c.dom.Element; import test.abnahme.AbnahmeTestCase; import at.gv.egovernment.moa.id.AuthenticationException; import at.gv.egovernment.moa.id.auth.AuthenticationServer; +import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; import at.gv.egovernment.moa.id.auth.builder.VerifyXMLSignatureRequestBuilder; import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; import at.gv.egovernment.moa.id.auth.data.IdentityLink; @@ -34,7 +37,9 @@ public class Test400GetAuthenticationData extends AbnahmeTestCase { String sessionID = startAuthentication(); AuthenticationSession session = AuthenticationServer.getSession(sessionID); String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); - server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + server.verifyIdentityLink(sessionID, parameters); InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); IdentityLink idl = irrp.parseIdentityLink(); Element domVerifyXMLSignatureRequest = new VerifyXMLSignatureRequestBuilder().build(idl, AuthConfigurationProvider.getInstance().getMoaSpAuthBlockTrustProfileID()); diff --git a/id.server/src/test/at/gv/egovernment/moa/id/auth/AuthenticationServerTest.java b/id.server/src/test/at/gv/egovernment/moa/id/auth/AuthenticationServerTest.java index 753b2ef12..5acb23dc2 100644 --- a/id.server/src/test/at/gv/egovernment/moa/id/auth/AuthenticationServerTest.java +++ b/id.server/src/test/at/gv/egovernment/moa/id/auth/AuthenticationServerTest.java @@ -1,6 +1,9 @@ package test.at.gv.egovernment.moa.id.auth; +import java.util.HashMap; + import at.gv.egovernment.moa.id.auth.AuthenticationServer; +import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; import at.gv.egovernment.moa.id.data.AuthenticationData; import test.at.gv.egovernment.moa.id.UnitTestCase; @@ -30,7 +33,10 @@ public class AuthenticationServerTest extends UnitTestCase { String htmlForm = server.startAuthentication(authURL, target, oaURL, templateURL, bkuURL, null); String sessionID = parseSessionIDFromForm(htmlForm); String infoboxReadResponse = readFile(TESTDATA_ROOT + "xmldata/testperson1/" + "InfoboxReadResponse.xml"); - String createXMLSignatureRequest = server.verifyIdentityLink(sessionID, infoboxReadResponse); + HashMap parameters = new HashMap(1); + parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); + + String createXMLSignatureRequest = server.verifyIdentityLink(sessionID, parameters); String createXMLSignatureRequestShould = readFile(testdataRoot + "CreateXMLSignatureRequest.xml"); assertXmlEquals(createXMLSignatureRequestShould, createXMLSignatureRequest); String createXMLSignatureResponse = readFile(testdataRoot + "CreateXMLSignatureResponse.xml"); diff --git a/id.server/src/test/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilderTest.java b/id.server/src/test/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilderTest.java index fa67fa44f..68f7ba973 100644 --- a/id.server/src/test/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilderTest.java +++ b/id.server/src/test/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilderTest.java @@ -39,7 +39,7 @@ public class AuthenticationBlockAssertionBuilderTest extends UnitTestCase { public void testBuild() throws Exception { AuthenticationBlockAssertionBuilder builder = new AuthenticationBlockAssertionBuilder(); - String assertionBuilt = builder.buildAuthBlock(ISSUER, ISSUE_INSTANT, AUTH_URL, TARGET, "", "", OA_URL, GEB_DAT); + String assertionBuilt = builder.buildAuthBlock(ISSUER, ISSUE_INSTANT, AUTH_URL, TARGET, "", "", OA_URL, GEB_DAT, null); assertionBuilt = XML_DECL + assertionBuilt; String assertionShould = XML_DECL + ASSERTION_SHOULD; assertXmlEquals(assertionShould, assertionBuilt); diff --git a/id.server/src/test/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilderTest.java b/id.server/src/test/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilderTest.java index af452dc78..c146984d0 100644 --- a/id.server/src/test/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilderTest.java +++ b/id.server/src/test/at/gv/egovernment/moa/id/auth/builder/GetIdentityLinkFormBuilderTest.java @@ -53,7 +53,7 @@ public class GetIdentityLinkFormBuilderTest extends TestCase { String dataURL = "https://1.2.3.4/auth/VerifyIdentityLink?MOASessionID=1234567"; String infoRequest = new CertInfoVerifyXMLSignatureRequestBuilder().build(false); String infoDataURL = "https://1.2.3.4/auth/StartAuthentication?Target=gb&OA=https://oa.gv.at/"; - String form = new GetIdentityLinkFormBuilder().build(null, null, xmlRequest, dataURL, infoRequest, infoDataURL); + String form = new GetIdentityLinkFormBuilder().build(null, null, xmlRequest, dataURL, infoRequest, infoDataURL, null); String formShould = MessageFormat.format( FORM, new Object[] { BKU, xmlRequest, dataURL, infoRequest, infoDataURL }); assertEquals(formShould, form); @@ -64,7 +64,7 @@ public class GetIdentityLinkFormBuilderTest extends TestCase { String infoRequest = new CertInfoVerifyXMLSignatureRequestBuilder().build(false); String infoDataURL = "https://1.2.3.4/auth/StartAuthentication?Target=gb&OA=https://oa.gv.at/"; String bkuURL = "http://bku.at/"; - String form = new GetIdentityLinkFormBuilder().build(null, bkuURL, xmlRequest, dataURL, infoRequest, infoDataURL); + String form = new GetIdentityLinkFormBuilder().build(null, bkuURL, xmlRequest, dataURL, infoRequest, infoDataURL, null); String formShould = MessageFormat.format( FORM, new Object[] { bkuURL, xmlRequest, dataURL, infoRequest, infoDataURL }); assertEquals(formShould, form); |