diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2013-09-04 11:33:35 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2013-09-04 11:33:35 +0200 |
commit | 0d8dfd1b3b0892164fbd9d3d13eb231adad4062b (patch) | |
tree | 7b336240678bf008c3cdc1063eb8cfee7492178e /id/server/idserverlib/src/test/java/test/at | |
parent | eadd6dd97f1b30608b31ffcd90382874fbcdaddc (diff) | |
download | moa-id-spss-0d8dfd1b3b0892164fbd9d3d13eb231adad4062b.tar.gz moa-id-spss-0d8dfd1b3b0892164fbd9d3d13eb231adad4062b.tar.bz2 moa-id-spss-0d8dfd1b3b0892164fbd9d3d13eb231adad4062b.zip |
MOA-ID-LIB tests deactivated
Diffstat (limited to 'id/server/idserverlib/src/test/java/test/at')
11 files changed, 1028 insertions, 1028 deletions
diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/AllTests.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/AllTests.java index fc12ca5e7..98337de6b 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/AllTests.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/AllTests.java @@ -1,65 +1,65 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id; - -import test.at.gv.egovernment.moa.id.auth.AuthenticationServerTest; -import test.at.gv.egovernment.moa.id.auth.servlet.GetAuthenticationDataServiceTest; -import test.at.gv.egovernment.moa.id.auth.invoke.SignatureVerificationTest; -import test.at.gv.egovernment.moa.id.config.auth.MOAIDAuthConfigurationProviderTest; -import test.at.gv.egovernment.moa.id.config.proxy.MOAIDProxyConfigurationProviderTest; - -import junit.awtui.TestRunner; -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(AuthenticationServerTest.class); - suite.addTest(test.at.gv.egovernment.moa.id.auth.builder.AllTests.suite()); - suite.addTest(test.at.gv.egovernment.moa.id.auth.parser.AllTests.suite()); - suite.addTestSuite(GetAuthenticationDataServiceTest.class); - suite.addTestSuite(SignatureVerificationTest.class); - suite.addTestSuite(MOAIDAuthConfigurationProviderTest.class); - suite.addTestSuite(MOAIDProxyConfigurationProviderTest.class); - suite.addTest(test.at.gv.egovernment.moa.id.proxy.AllTests.suite()); - - return suite; - } - - public static void main(String[] args) { - try { - TestRunner.run(AllTests.class); - } catch (Exception e) { - e.printStackTrace(); - } - } -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id; +// +//import test.at.gv.egovernment.moa.id.auth.AuthenticationServerTest; +//import test.at.gv.egovernment.moa.id.auth.servlet.GetAuthenticationDataServiceTest; +//import test.at.gv.egovernment.moa.id.auth.invoke.SignatureVerificationTest; +//import test.at.gv.egovernment.moa.id.config.auth.MOAIDAuthConfigurationProviderTest; +//import test.at.gv.egovernment.moa.id.config.proxy.MOAIDProxyConfigurationProviderTest; +// +//import junit.awtui.TestRunner; +//import junit.framework.Test; +//import junit.framework.TestSuite; +// +///** +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class AllTests { +// +// public static Test suite() { +// TestSuite suite = new TestSuite(); +// +// suite.addTestSuite(AuthenticationServerTest.class); +// suite.addTest(test.at.gv.egovernment.moa.id.auth.builder.AllTests.suite()); +// suite.addTest(test.at.gv.egovernment.moa.id.auth.parser.AllTests.suite()); +// suite.addTestSuite(GetAuthenticationDataServiceTest.class); +// suite.addTestSuite(SignatureVerificationTest.class); +// suite.addTestSuite(MOAIDAuthConfigurationProviderTest.class); +// suite.addTestSuite(MOAIDProxyConfigurationProviderTest.class); +// suite.addTest(test.at.gv.egovernment.moa.id.proxy.AllTests.suite()); +// +// return suite; +// } +// +// public static void main(String[] args) { +// try { +// TestRunner.run(AllTests.class); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +//} 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 187f577a3..c54c31edb 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 @@ -1,80 +1,80 @@ -/* - * Copyright 2003 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/ - * - * 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 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; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class AuthenticationServerTest extends UnitTestCase { - - public AuthenticationServerTest(String name) { - super(name); - } - - public void testStandard() throws Exception { - doTest( - "standard", - "https://localhost:8443/auth", - "gb", - "https://localhost:9443/", - null, - null); - } - 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, null, oaURL, templateURL, bkuURL, null, null, null, null); - String sessionID = parseSessionIDFromForm(htmlForm); - String infoboxReadResponse = readFile(TESTDATA_ROOT + "xmldata/testperson1/" + "InfoboxReadResponse.xml"); - 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"); - String samlArtifact = server.verifyAuthenticationBlock(sessionID, createXMLSignatureResponse); - AuthenticationData authData = server.getAuthenticationData(samlArtifact); - String authDataShould = readFile(testdataRoot + "AuthenticationDataAssertion.xml"); - assertXmlEquals(authDataShould, authData.getSamlAssertion()); - } - private String parseSessionIDFromForm(String htmlForm) { - String parName = "MOASessionID="; - assertTrue("HTML Form enthält keine SessionID", htmlForm.indexOf(parName) >= 0); - int i1 = htmlForm.indexOf(parName) + parName.length(); - int i2 = htmlForm.indexOf("\"", i1); - assertTrue("HTML Form enthält keine gültige SessionID", i2 > i1); - return htmlForm.substring(i1, i2); - } -} +///* +// * Copyright 2003 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/ +// * +// * 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 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; +// +///** +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class AuthenticationServerTest extends UnitTestCase { +// +// public AuthenticationServerTest(String name) { +// super(name); +// } +// +// public void testStandard() throws Exception { +// doTest( +// "standard", +// "https://localhost:8443/auth", +// "gb", +// "https://localhost:9443/", +// null, +// null); +// } +// 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, null, oaURL, templateURL, bkuURL, null, null, null, null); +// String sessionID = parseSessionIDFromForm(htmlForm); +// String infoboxReadResponse = readFile(TESTDATA_ROOT + "xmldata/testperson1/" + "InfoboxReadResponse.xml"); +// 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"); +// String samlArtifact = server.verifyAuthenticationBlock(sessionID, createXMLSignatureResponse); +// AuthenticationData authData = server.getAuthenticationData(samlArtifact); +// String authDataShould = readFile(testdataRoot + "AuthenticationDataAssertion.xml"); +// assertXmlEquals(authDataShould, authData.getSamlAssertion()); +// } +// private String parseSessionIDFromForm(String htmlForm) { +// String parName = "MOASessionID="; +// assertTrue("HTML Form enth�lt keine SessionID", htmlForm.indexOf(parName) >= 0); +// int i1 = htmlForm.indexOf(parName) + parName.length(); +// int i2 = htmlForm.indexOf("\"", i1); +// assertTrue("HTML Form enth�lt keine g�ltige SessionID", i2 > i1); +// return htmlForm.substring(i1, i2); +// } +//} diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/AllTests.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/AllTests.java index 7852dc9cd..166ea1544 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/AllTests.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/AllTests.java @@ -1,57 +1,57 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id.auth.builder; - -import junit.awtui.TestRunner; -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author patrick - * @version $Id$ - */ -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite(); - -// suite.addTestSuite(AuthenticationBlockAssertionBuilderTest.class); - suite.addTestSuite(CreateXMLSignatureBuilderTest.class); -// suite.addTestSuite(GetIdentityLinkFormBuilderTest.class); -// suite.addTestSuite(InfoboxReadRequestBuilderTest.class); -// suite.addTestSuite(PersonDataBuilderTest.class); -// suite.addTestSuite(SAMLArtifactBuilderTest.class); - - return suite; - } - - public static void main(String[] args) { - try { - TestRunner.run(AllTests.class); - } catch (Exception e) { - e.printStackTrace(); - } - } -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id.auth.builder; +// +//import junit.awtui.TestRunner; +//import junit.framework.Test; +//import junit.framework.TestSuite; +// +///** +// * @author patrick +// * @version $Id$ +// */ +//public class AllTests { +// +// public static Test suite() { +// TestSuite suite = new TestSuite(); +// +//// suite.addTestSuite(AuthenticationBlockAssertionBuilderTest.class); +// suite.addTestSuite(CreateXMLSignatureBuilderTest.class); +//// suite.addTestSuite(GetIdentityLinkFormBuilderTest.class); +//// suite.addTestSuite(InfoboxReadRequestBuilderTest.class); +//// suite.addTestSuite(PersonDataBuilderTest.class); +//// suite.addTestSuite(SAMLArtifactBuilderTest.class); +// +// return suite; +// } +// +// public static void main(String[] args) { +// try { +// TestRunner.run(AllTests.class); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +//} diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilderTest.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilderTest.java index d369c39bd..b5623bb00 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilderTest.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/AuthenticationBlockAssertionBuilderTest.java @@ -1,71 +1,71 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id.auth.builder; - -import test.at.gv.egovernment.moa.id.UnitTestCase; - -import at.gv.egovernment.moa.id.auth.builder.AuthenticationBlockAssertionBuilder; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class AuthenticationBlockAssertionBuilderTest extends UnitTestCase { - private static final String nl = "\n"; - private static final String ISSUER = "Hugo Mustermann"; - private static final String ISSUE_INSTANT = "2003-03-15T22:50:21+01:00"; - private static final String AUTH_URL = "https://auth.moa.gv.at/"; - private static final String TARGET = "Grundbuch"; - private static final String OA_URL = "https://grundbuch.gv.at/"; - private static final String GEB_DAT = "2004-01-02"; - - // wird auch von CreateXMLSignatureBuilderTest verwendet ! - public static final String ASSERTION_SHOULD = -"<saml:Assertion xmlns:saml='urn:oasis:names:tc:SAML:1.0:assertion' MajorVersion='1' MinorVersion='0' AssertionID='any' Issuer='" + ISSUER + "' IssueInstant='" + ISSUE_INSTANT + "'>" + nl + -" <saml:AttributeStatement>" + nl + -" <saml:Subject>" + nl + -" <saml:NameIdentifier>" + AUTH_URL + "</saml:NameIdentifier>" + nl + -" </saml:Subject>" + nl + -" <saml:Attribute AttributeName='Geschäftsbereich' AttributeNamespace='http://reference.e-government.gv.at/namespace/moa/20020822#'>" + nl + -" <saml:AttributeValue>" + TARGET + "</saml:AttributeValue>" + nl + -" </saml:Attribute>" + nl + -" <saml:Attribute AttributeName='OA' AttributeNamespace='http://reference.e-government.gv.at/namespace/moa/20020822#'>" + nl + -" <saml:AttributeValue>" + OA_URL + "</saml:AttributeValue>" + nl + -" </saml:Attribute>" + nl + -" </saml:AttributeStatement>" + nl + -"</saml:Assertion>"; - - public AuthenticationBlockAssertionBuilderTest(String name) { - super(name); - } - - public void testBuild() throws Exception { - AuthenticationBlockAssertionBuilder builder = new AuthenticationBlockAssertionBuilder(); - String assertionBuilt = builder.buildAuthBlock(ISSUER, ISSUE_INSTANT, AUTH_URL, TARGET, null, "", "", OA_URL, GEB_DAT, null, null); - assertionBuilt = XML_DECL + assertionBuilt; - String assertionShould = XML_DECL + ASSERTION_SHOULD; - assertXmlEquals(assertionShould, assertionBuilt); - } -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id.auth.builder; +// +//import test.at.gv.egovernment.moa.id.UnitTestCase; +// +//import at.gv.egovernment.moa.id.auth.builder.AuthenticationBlockAssertionBuilder; +// +///** +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class AuthenticationBlockAssertionBuilderTest extends UnitTestCase { +// private static final String nl = "\n"; +// private static final String ISSUER = "Hugo Mustermann"; +// private static final String ISSUE_INSTANT = "2003-03-15T22:50:21+01:00"; +// private static final String AUTH_URL = "https://auth.moa.gv.at/"; +// private static final String TARGET = "Grundbuch"; +// private static final String OA_URL = "https://grundbuch.gv.at/"; +// private static final String GEB_DAT = "2004-01-02"; +// +// // wird auch von CreateXMLSignatureBuilderTest verwendet ! +// public static final String ASSERTION_SHOULD = +//"<saml:Assertion xmlns:saml='urn:oasis:names:tc:SAML:1.0:assertion' MajorVersion='1' MinorVersion='0' AssertionID='any' Issuer='" + ISSUER + "' IssueInstant='" + ISSUE_INSTANT + "'>" + nl + +//" <saml:AttributeStatement>" + nl + +//" <saml:Subject>" + nl + +//" <saml:NameIdentifier>" + AUTH_URL + "</saml:NameIdentifier>" + nl + +//" </saml:Subject>" + nl + +//" <saml:Attribute AttributeName='Gesch�ftsbereich' AttributeNamespace='http://reference.e-government.gv.at/namespace/moa/20020822#'>" + nl + +//" <saml:AttributeValue>" + TARGET + "</saml:AttributeValue>" + nl + +//" </saml:Attribute>" + nl + +//" <saml:Attribute AttributeName='OA' AttributeNamespace='http://reference.e-government.gv.at/namespace/moa/20020822#'>" + nl + +//" <saml:AttributeValue>" + OA_URL + "</saml:AttributeValue>" + nl + +//" </saml:Attribute>" + nl + +//" </saml:AttributeStatement>" + nl + +//"</saml:Assertion>"; +// +// public AuthenticationBlockAssertionBuilderTest(String name) { +// super(name); +// } +// +// public void testBuild() throws Exception { +// AuthenticationBlockAssertionBuilder builder = new AuthenticationBlockAssertionBuilder(); +// String assertionBuilt = builder.buildAuthBlock(ISSUER, ISSUE_INSTANT, AUTH_URL, TARGET, null, "", "", OA_URL, GEB_DAT, null, null); +// assertionBuilt = XML_DECL + assertionBuilt; +// String assertionShould = XML_DECL + ASSERTION_SHOULD; +// assertXmlEquals(assertionShould, assertionBuilt); +// } +//} diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureBuilderTest.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureBuilderTest.java index 87ddaef0c..5b3769c4b 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureBuilderTest.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureBuilderTest.java @@ -1,129 +1,129 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id.auth.builder; - -import at.gv.egovernment.moa.id.auth.builder.CreateXMLSignatureRequestBuilder; - -import test.at.gv.egovernment.moa.id.UnitTestCase; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class CreateXMLSignatureBuilderTest extends UnitTestCase { - private static final String nl = "\n"; - public static final String TRANSFORMS_INFO = - " <sl10:TransformsInfo>" + nl + - " <dsig:Transforms>" + nl + - " <dsig:Transform Algorithm='http://www.w3.org/2000/09/xmldsig#enveloped-signature'/>" + nl + - " <dsig:Transform Algorithm='http://www.w3.org/TR/1999/REC-xslt-19991116'>" + nl + -"<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:saml='urn:oasis:names:tc:SAML:1.0:assertion' >" + nl + -"<xsl:template match='/'>" + nl + -"<html>" + nl + -"<body>" + nl + -"</body>" + nl + -"</html>" + nl + -"</xsl:template>" + nl + -"</xsl:stylesheet>" + nl + - " </dsig:Transform>" + nl + - " </dsig:Transforms>" + nl + - " <sl10:FinalDataMetaInfo>" + nl + - " <sl10:MimeType>text/html</sl10:MimeType>" + nl + - " </sl10:FinalDataMetaInfo>" + nl + - " </sl10:TransformsInfo>" + nl; - public static final String REQUEST_SHOULD = -"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + nl + -"<sl11:CreateXMLSignatureRequest xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:sl10=\"http://www.buergerkarte.at/namespaces/securitylayer/20020225#\" xmlns:sl11=\"http://www.buergerkarte.at/namespaces/securitylayer/20020831#\">" + nl + -" <sl11:KeyboxIdentifier>SecureSignatureKeypair</sl11:KeyboxIdentifier>" + nl + -" <sl11:DataObjectInfo Structure=\"detached\">" + nl + -" <sl10:DataObject Reference=\"\"/>" + nl + -TRANSFORMS_INFO + -" </sl11:DataObjectInfo>" + nl + -" <sl11:SignatureInfo>" + nl + -" <sl11:SignatureEnvironment>" + nl + -" <sl10:XMLContent>" + AuthenticationBlockAssertionBuilderTest.ASSERTION_SHOULD + "</sl10:XMLContent>" + nl + -" </sl11:SignatureEnvironment>" + nl + -" <sl11:SignatureLocation Index=\"2\">/saml:Assertion</sl11:SignatureLocation>" + nl + -" </sl11:SignatureInfo>" + nl + -"</sl11:CreateXMLSignatureRequest>"; - - - public static final String TRANSFORMS_INFO_SL12 = - " <sl:TransformsInfo>" + nl + - " <dsig:Transforms>" + nl + - " <dsig:Transform Algorithm='http://www.w3.org/2000/09/xmldsig#enveloped-signature'/>" + nl + - " <dsig:Transform Algorithm='http://www.w3.org/TR/1999/REC-xslt-19991116'>" + nl + -"<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:saml='urn:oasis:names:tc:SAML:1.0:assertion' >" + nl + -"<xsl:template match='/'>" + nl + -"<html>" + nl + -"<body>" + nl + -"</body>" + nl + -"</html>" + nl + -"</xsl:template>" + nl + -"</xsl:stylesheet>" + nl + - " </dsig:Transform>" + nl + - " </dsig:Transforms>" + nl + - " <sl:FinalDataMetaInfo>" + nl + - " <sl:MimeType>text/html</sl:MimeType>" + nl + - " </sl:FinalDataMetaInfo>" + nl + - " </sl:TransformsInfo>" + nl; - public static final String REQUEST_SHOULD_SL12 = -"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + nl + -"<sl:CreateXMLSignatureRequest xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:sl=\"http://www.buergerkarte.at/namespaces/securitylayer/1.2#\">" + nl + -" <sl:KeyboxIdentifier>SecureSignatureKeypair</sl:KeyboxIdentifier>" + nl + -" <sl:DataObjectInfo Structure=\"detached\">" + nl + -" <sl:DataObject Reference=\"\"/>" + nl + -TRANSFORMS_INFO_SL12 + -" </sl:DataObjectInfo>" + nl + -" <sl:SignatureInfo>" + nl + -" <sl:SignatureEnvironment>" + nl + -" <sl:XMLContent>" + AuthenticationBlockAssertionBuilderTest.ASSERTION_SHOULD + "</sl:XMLContent>" + nl + -" </sl:SignatureEnvironment>" + nl + -" <sl:SignatureLocation Index=\"2\">/saml:Assertion</sl:SignatureLocation>" + nl + -" </sl:SignatureInfo>" + nl + -"</sl:CreateXMLSignatureRequest>"; - - - - - public CreateXMLSignatureBuilderTest(String name) { - super(name); - } - - public void testBuild() throws Exception { - // test build for Security Layer version 1.1 and 1.0 - String request = new CreateXMLSignatureRequestBuilder().build( - AuthenticationBlockAssertionBuilderTest.ASSERTION_SHOULD, "SecureSignatureKeypair", - new String[] {TRANSFORMS_INFO}, - false); - assertXmlEquals(REQUEST_SHOULD, request); - // test build for Security Layer version 1.2 - String requestSL12 = new CreateXMLSignatureRequestBuilder().build( - AuthenticationBlockAssertionBuilderTest.ASSERTION_SHOULD, "SecureSignatureKeypair", - new String[] {TRANSFORMS_INFO}, - true); - assertXmlEquals(REQUEST_SHOULD_SL12, requestSL12); - } -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id.auth.builder; +// +//import at.gv.egovernment.moa.id.auth.builder.CreateXMLSignatureRequestBuilder; +// +//import test.at.gv.egovernment.moa.id.UnitTestCase; +// +///** +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class CreateXMLSignatureBuilderTest extends UnitTestCase { +// private static final String nl = "\n"; +// public static final String TRANSFORMS_INFO = +// " <sl10:TransformsInfo>" + nl + +// " <dsig:Transforms>" + nl + +// " <dsig:Transform Algorithm='http://www.w3.org/2000/09/xmldsig#enveloped-signature'/>" + nl + +// " <dsig:Transform Algorithm='http://www.w3.org/TR/1999/REC-xslt-19991116'>" + nl + +//"<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:saml='urn:oasis:names:tc:SAML:1.0:assertion' >" + nl + +//"<xsl:template match='/'>" + nl + +//"<html>" + nl + +//"<body>" + nl + +//"</body>" + nl + +//"</html>" + nl + +//"</xsl:template>" + nl + +//"</xsl:stylesheet>" + nl + +// " </dsig:Transform>" + nl + +// " </dsig:Transforms>" + nl + +// " <sl10:FinalDataMetaInfo>" + nl + +// " <sl10:MimeType>text/html</sl10:MimeType>" + nl + +// " </sl10:FinalDataMetaInfo>" + nl + +// " </sl10:TransformsInfo>" + nl; +// public static final String REQUEST_SHOULD = +//"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + nl + +//"<sl11:CreateXMLSignatureRequest xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:sl10=\"http://www.buergerkarte.at/namespaces/securitylayer/20020225#\" xmlns:sl11=\"http://www.buergerkarte.at/namespaces/securitylayer/20020831#\">" + nl + +//" <sl11:KeyboxIdentifier>SecureSignatureKeypair</sl11:KeyboxIdentifier>" + nl + +//" <sl11:DataObjectInfo Structure=\"detached\">" + nl + +//" <sl10:DataObject Reference=\"\"/>" + nl + +//TRANSFORMS_INFO + +//" </sl11:DataObjectInfo>" + nl + +//" <sl11:SignatureInfo>" + nl + +//" <sl11:SignatureEnvironment>" + nl + +//" <sl10:XMLContent>" + AuthenticationBlockAssertionBuilderTest.ASSERTION_SHOULD + "</sl10:XMLContent>" + nl + +//" </sl11:SignatureEnvironment>" + nl + +//" <sl11:SignatureLocation Index=\"2\">/saml:Assertion</sl11:SignatureLocation>" + nl + +//" </sl11:SignatureInfo>" + nl + +//"</sl11:CreateXMLSignatureRequest>"; +// +// +// public static final String TRANSFORMS_INFO_SL12 = +// " <sl:TransformsInfo>" + nl + +// " <dsig:Transforms>" + nl + +// " <dsig:Transform Algorithm='http://www.w3.org/2000/09/xmldsig#enveloped-signature'/>" + nl + +// " <dsig:Transform Algorithm='http://www.w3.org/TR/1999/REC-xslt-19991116'>" + nl + +//"<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:saml='urn:oasis:names:tc:SAML:1.0:assertion' >" + nl + +//"<xsl:template match='/'>" + nl + +//"<html>" + nl + +//"<body>" + nl + +//"</body>" + nl + +//"</html>" + nl + +//"</xsl:template>" + nl + +//"</xsl:stylesheet>" + nl + +// " </dsig:Transform>" + nl + +// " </dsig:Transforms>" + nl + +// " <sl:FinalDataMetaInfo>" + nl + +// " <sl:MimeType>text/html</sl:MimeType>" + nl + +// " </sl:FinalDataMetaInfo>" + nl + +// " </sl:TransformsInfo>" + nl; +// public static final String REQUEST_SHOULD_SL12 = +//"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + nl + +//"<sl:CreateXMLSignatureRequest xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:sl=\"http://www.buergerkarte.at/namespaces/securitylayer/1.2#\">" + nl + +//" <sl:KeyboxIdentifier>SecureSignatureKeypair</sl:KeyboxIdentifier>" + nl + +//" <sl:DataObjectInfo Structure=\"detached\">" + nl + +//" <sl:DataObject Reference=\"\"/>" + nl + +//TRANSFORMS_INFO_SL12 + +//" </sl:DataObjectInfo>" + nl + +//" <sl:SignatureInfo>" + nl + +//" <sl:SignatureEnvironment>" + nl + +//" <sl:XMLContent>" + AuthenticationBlockAssertionBuilderTest.ASSERTION_SHOULD + "</sl:XMLContent>" + nl + +//" </sl:SignatureEnvironment>" + nl + +//" <sl:SignatureLocation Index=\"2\">/saml:Assertion</sl:SignatureLocation>" + nl + +//" </sl:SignatureInfo>" + nl + +//"</sl:CreateXMLSignatureRequest>"; +// +// +// +// +// public CreateXMLSignatureBuilderTest(String name) { +// super(name); +// } +// +// public void testBuild() throws Exception { +// // test build for Security Layer version 1.1 and 1.0 +// String request = new CreateXMLSignatureRequestBuilder().build( +// AuthenticationBlockAssertionBuilderTest.ASSERTION_SHOULD, "SecureSignatureKeypair", +// new String[] {TRANSFORMS_INFO}, +// false); +// assertXmlEquals(REQUEST_SHOULD, request); +// // test build for Security Layer version 1.2 +// String requestSL12 = new CreateXMLSignatureRequestBuilder().build( +// AuthenticationBlockAssertionBuilderTest.ASSERTION_SHOULD, "SecureSignatureKeypair", +// new String[] {TRANSFORMS_INFO}, +// true); +// assertXmlEquals(REQUEST_SHOULD_SL12, requestSL12); +// } +//} diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/parser/AllTests.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/parser/AllTests.java index a6b4335db..5d82e00a9 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/parser/AllTests.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/parser/AllTests.java @@ -1,53 +1,53 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id.auth.parser; - -import junit.awtui.TestRunner; -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(IdentityLinkAssertionParserTest.class); - suite.addTestSuite(SAMLArtifactParserTest.class); - - return suite; - } - - public static void main(String[] args) { - try { - TestRunner.run(AllTests.class); - } catch (Exception e) { - e.printStackTrace(); - } - } -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id.auth.parser; +// +//import junit.awtui.TestRunner; +//import junit.framework.Test; +//import junit.framework.TestSuite; +// +///** +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class AllTests { +// +// public static Test suite() { +// TestSuite suite = new TestSuite(); +// +// suite.addTestSuite(IdentityLinkAssertionParserTest.class); +// suite.addTestSuite(SAMLArtifactParserTest.class); +// +// return suite; +// } +// +// public static void main(String[] args) { +// try { +// TestRunner.run(AllTests.class); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +//} diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/servlet/GetAuthenticationDataServiceTest.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/servlet/GetAuthenticationDataServiceTest.java index ccb8fac7a..f08f5d20f 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/servlet/GetAuthenticationDataServiceTest.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/auth/servlet/GetAuthenticationDataServiceTest.java @@ -1,115 +1,115 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id.auth.servlet; - -import org.w3c.dom.Element; - -import test.at.gv.egovernment.moa.id.UnitTestCase; - -import at.gv.egovernment.moa.id.auth.servlet.GetAuthenticationDataService; -import at.gv.egovernment.moa.util.Constants; -import at.gv.egovernment.moa.util.DOMUtils; -import at.gv.egovernment.moa.util.XPathUtils; - -/** - * Test case instantiates GetAuthenticationDataService and calls the Request() method. - * It DOES NOT call the web service via Axis. - * - * @author Paul Ivancsics - * @version $Id$ - */ -public class GetAuthenticationDataServiceTest extends UnitTestCase implements Constants { - - private GetAuthenticationDataService service; - - public GetAuthenticationDataServiceTest(String arg0) { - super(arg0); - } - protected void setUp() throws Exception { - service = new GetAuthenticationDataService(); - } - - public void testService2Requests() throws Exception { - String requestString = - "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + - "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + - "<saml:AssertionIDReference>123</saml:AssertionIDReference>" + - "</samlp:Request>"; - Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); - Element response = service.Request(new Element[] {request, request})[0]; - assertStatus(response, "samlp:Requester", "samlp:TooManyResponses"); - } - public void testServiceNoSAMLArtifact() throws Exception { - String requestString = - "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + - "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + - "<saml:AssertionIDReference>123</saml:AssertionIDReference>" + - "</samlp:Request>"; - Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); - Element response = service.Request(new Element[] {request})[0]; - assertStatus(response, "samlp:Requester", null); - } - public void testService2SAMLArtifacts() throws Exception { - String requestString = - "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + - "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + - "<samlp:AssertionArtifact>123</samlp:AssertionArtifact>" + - "<samlp:AssertionArtifact>456</samlp:AssertionArtifact>" + - "</samlp:Request>"; - Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); - Element response = service.Request(new Element[] {request})[0]; - assertStatus(response, "samlp:Requester", "samlp:TooManyResponses"); - } - public void testServiceWrongFormat() throws Exception { - String requestString = - "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + - "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + - "</samlp:Request>"; - Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); - Element response = service.Request(new Element[] {request})[0]; - assertStatus(response, "samlp:Requester", null); - } - public void testServiceWrongSAMLArtifact() throws Exception { - String requestString = - "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + - "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + - "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" + - "</samlp:Request>"; - Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); - Element response = service.Request(new Element[] {request})[0]; - assertStatus(response, "samlp:Requester", "samlp:ResourceNotRecognized"); - } - private void assertStatus(Element response, String statusCodeShould, String subStatusCodeShould) throws Exception { - Element statusCodeNode = (Element)XPathUtils.selectSingleNode(response, "//samlp:StatusCode"); - String statusCode = statusCodeNode.getAttribute("Value"); - Element subStatusCodeNode = (Element)XPathUtils.selectSingleNode(statusCodeNode, "//samlp:StatusCode/samlp:StatusCode"); - String subStatusCode = subStatusCodeNode == null ? null : subStatusCodeNode.getAttribute("Value"); - System.out.println(statusCode + subStatusCode); - assertEquals(statusCodeShould, statusCode); - assertEquals(subStatusCodeShould, subStatusCode); - } - - -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id.auth.servlet; +// +//import org.w3c.dom.Element; +// +//import test.at.gv.egovernment.moa.id.UnitTestCase; +// +//import at.gv.egovernment.moa.id.auth.servlet.GetAuthenticationDataService; +//import at.gv.egovernment.moa.util.Constants; +//import at.gv.egovernment.moa.util.DOMUtils; +//import at.gv.egovernment.moa.util.XPathUtils; +// +///** +// * Test case instantiates GetAuthenticationDataService and calls the Request() method. +// * It DOES NOT call the web service via Axis. +// * +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class GetAuthenticationDataServiceTest extends UnitTestCase implements Constants { +// +// private GetAuthenticationDataService service; +// +// public GetAuthenticationDataServiceTest(String arg0) { +// super(arg0); +// } +// protected void setUp() throws Exception { +// service = new GetAuthenticationDataService(); +// } +// +// public void testService2Requests() throws Exception { +// String requestString = +// "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + +// "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + +// "<saml:AssertionIDReference>123</saml:AssertionIDReference>" + +// "</samlp:Request>"; +// Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); +// Element response = service.Request(new Element[] {request, request})[0]; +// assertStatus(response, "samlp:Requester", "samlp:TooManyResponses"); +// } +// public void testServiceNoSAMLArtifact() throws Exception { +// String requestString = +// "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + +// "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + +// "<saml:AssertionIDReference>123</saml:AssertionIDReference>" + +// "</samlp:Request>"; +// Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); +// Element response = service.Request(new Element[] {request})[0]; +// assertStatus(response, "samlp:Requester", null); +// } +// public void testService2SAMLArtifacts() throws Exception { +// String requestString = +// "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + +// "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + +// "<samlp:AssertionArtifact>123</samlp:AssertionArtifact>" + +// "<samlp:AssertionArtifact>456</samlp:AssertionArtifact>" + +// "</samlp:Request>"; +// Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); +// Element response = service.Request(new Element[] {request})[0]; +// assertStatus(response, "samlp:Requester", "samlp:TooManyResponses"); +// } +// public void testServiceWrongFormat() throws Exception { +// String requestString = +// "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + +// "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + +// "</samlp:Request>"; +// Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); +// Element response = service.Request(new Element[] {request})[0]; +// assertStatus(response, "samlp:Requester", null); +// } +// public void testServiceWrongSAMLArtifact() throws Exception { +// String requestString = +// "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + +// "<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" RequestID=\"123456\" MajorVersion=\"1\" MinorVersion=\"0\" IssueInstant=\"2003-02-13T13:59:00\">" + +// "<samlp:AssertionArtifact>WRONGARTIFACT</samlp:AssertionArtifact>" + +// "</samlp:Request>"; +// Element request = DOMUtils.parseDocument(requestString, false, ALL_SCHEMA_LOCATIONS, null).getDocumentElement(); +// Element response = service.Request(new Element[] {request})[0]; +// assertStatus(response, "samlp:Requester", "samlp:ResourceNotRecognized"); +// } +// private void assertStatus(Element response, String statusCodeShould, String subStatusCodeShould) throws Exception { +// Element statusCodeNode = (Element)XPathUtils.selectSingleNode(response, "//samlp:StatusCode"); +// String statusCode = statusCodeNode.getAttribute("Value"); +// Element subStatusCodeNode = (Element)XPathUtils.selectSingleNode(statusCodeNode, "//samlp:StatusCode/samlp:StatusCode"); +// String subStatusCode = subStatusCodeNode == null ? null : subStatusCodeNode.getAttribute("Value"); +// System.out.println(statusCode + subStatusCode); +// assertEquals(statusCodeShould, statusCode); +// assertEquals(subStatusCodeShould, subStatusCode); +// } +// +// +//} diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/auth/MOAIDAuthConfigurationProviderTest.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/auth/MOAIDAuthConfigurationProviderTest.java index b2b973b4a..780cf55f2 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/auth/MOAIDAuthConfigurationProviderTest.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/auth/MOAIDAuthConfigurationProviderTest.java @@ -1,136 +1,136 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id.config.auth; - -import java.util.Map; - -import test.at.gv.egovernment.moa.id.UnitTestCase; - -import at.gv.egovernment.moa.id.config.ConnectionParameter; -import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; -import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; - -/** - * @author Stefan Knirsch - * @version $Id$ - */ -public class MOAIDAuthConfigurationProviderTest extends UnitTestCase { - private AuthConfigurationProvider provider; - - /** - * Constructor for MOAAuthConfigTest. - * @param name - */ - public MOAIDAuthConfigurationProviderTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - - provider = - new AuthConfigurationProvider(TESTDATA_ROOT + "conf/ConfigurationTest.xml"); - - } - public void testGetTransformsInfoFileNames() { - String[] transformsInfoFileNames; - transformsInfoFileNames = provider.getTransformsInfoFileNames(); -// for (int i = 0; i < transformsInfoFileNames.length; i++) { -// System.out.println( -// "getTransformsInfoFileNames: " + transformsInfoFileNames[i]); - assertEquals(transformsInfoFileNames[0],"http://StringsecLayerTranformsInfo1"); - assertEquals(transformsInfoFileNames[1],"http://StringsecLayerTranformsInfo2"); -// } - - } - - public void testGetMOASPConnectionParameters() { - ConnectionParameter cp; - cp = provider.getMoaSpConnectionParameter(); - assertEquals(cp.getUrl(),"MOA-SP-URL"); - assertEquals(cp.getAcceptedServerCertificates(),"http://AcceptedServerCertificates"); - assertEquals(cp.getClientKeyStorePassword(),"Keystore Pass"); - assertEquals(cp.getClientKeyStore(),"URLtoClientKeystoreAUTH"); -/* System.out.println(); - System.out.println("getMoaSpConnectionParameter :" + cp.getUrl()); - System.out.println( - "getMoaSpConnectionParameter :" + cp.getAcceptedServerCertificates()); - System.out.println( - "getMoaSpConnectionParameter :" + cp.getClientKeyStorePassword()); - System.out.println( - "getMoaSpConnectionParameter :" + cp.getClientKeyStore());*/ - } - public void testGetMoaSpIdentityLinkTrustProfileID() { - - assertEquals(provider.getMoaSpIdentityLinkTrustProfileID(),"StringVerifyIdentiyLinkTrustID"); - - } - public void testGetMoaSpAuthBlockTrustProfileID() { - assertEquals(provider.getMoaSpAuthBlockTrustProfileID(),"StringVerifyAuthBlockTransformID"); - } - - public void testGetMoaSpAuthBlockVerifyTransformsInfoIDs() { - String[] result = provider.getMoaSpAuthBlockVerifyTransformsInfoIDs(); - assertEquals(result[0],"StringVerifyTransformsInfoID1"); - assertEquals(result[1],"StringVerifyTransformsInfoID2"); - - } - - public void testGetOnlineApplicationAuthParameter() { - OAAuthParameter[] result = provider.getOnlineApplicationParameters(); - - assertEquals(result[0].getPublicURLPrefix(),"StringOALoginURL"); - assertEquals(result[0].getProvideStammzahl(),false); - assertEquals(result[0].getProvideAuthBlock(),false); - assertEquals(result[0].getProvideIdentityLink(),false); - - assertEquals(result[1].getPublicURLPrefix(),"StringOALoginURL2"); - assertEquals(result[1].getProvideStammzahl(),true); - assertEquals(result[1].getProvideAuthBlock(),true); - assertEquals(result[1].getProvideIdentityLink(),true); - - -/* for (int i = 0; i < result.length; i++) { - System.out.println(); - System.out.println("getOnlineApplicationParameters Url: " + result[i].getUrl()); - System.out.println("getOnlineApplicationParameters ProvideStammzahl: " + result[i].getProvideStammzahl()); - System.out.println("getOnlineApplicationParameters ProvideAuthBlock: " + result[i].getProvideAuthBlock()); - System.out.println("getOnlineApplicationParameters ProvideIdentityLink: " + result[i].getProvideIdentityLink()); - }*/ - } - - public void testGetGenericConfiguration() { - Map result = provider.getGenericConfiguration(); - assertEquals(result.containsKey("Generic Name 1"),true); - assertEquals(result.containsKey("Generic Name 2"),true); - assertEquals(result.get("Generic Name 1"),"Value1"); - assertEquals(result.get("Generic Name 2"),"Value2"); - /* for (Iterator iter = result.keySet().iterator(); iter.hasNext();) { - String element = (String) iter.next(); - System.out.println("getGenericConfiguration Key:" + element); - System.out.println("getGenericConfiguration Value:" + result.get(element)); - }*/ - } - -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id.config.auth; +// +//import java.util.Map; +// +//import test.at.gv.egovernment.moa.id.UnitTestCase; +// +//import at.gv.egovernment.moa.id.config.ConnectionParameter; +//import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; +//import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; +// +///** +// * @author Stefan Knirsch +// * @version $Id$ +// */ +//public class MOAIDAuthConfigurationProviderTest extends UnitTestCase { +// private AuthConfigurationProvider provider; +// +// /** +// * Constructor for MOAAuthConfigTest. +// * @param name +// */ +// public MOAIDAuthConfigurationProviderTest(String name) { +// super(name); +// } +// +// protected void setUp() throws Exception { +// +// provider = +// new AuthConfigurationProvider(TESTDATA_ROOT + "conf/ConfigurationTest.xml"); +// +// } +// public void testGetTransformsInfoFileNames() { +// String[] transformsInfoFileNames; +// transformsInfoFileNames = provider.getTransformsInfoFileNames(); +//// for (int i = 0; i < transformsInfoFileNames.length; i++) { +//// System.out.println( +//// "getTransformsInfoFileNames: " + transformsInfoFileNames[i]); +// assertEquals(transformsInfoFileNames[0],"http://StringsecLayerTranformsInfo1"); +// assertEquals(transformsInfoFileNames[1],"http://StringsecLayerTranformsInfo2"); +//// } +// +// } +// +// public void testGetMOASPConnectionParameters() { +// ConnectionParameter cp; +// cp = provider.getMoaSpConnectionParameter(); +// assertEquals(cp.getUrl(),"MOA-SP-URL"); +// assertEquals(cp.getAcceptedServerCertificates(),"http://AcceptedServerCertificates"); +// assertEquals(cp.getClientKeyStorePassword(),"Keystore Pass"); +// assertEquals(cp.getClientKeyStore(),"URLtoClientKeystoreAUTH"); +///* System.out.println(); +// System.out.println("getMoaSpConnectionParameter :" + cp.getUrl()); +// System.out.println( +// "getMoaSpConnectionParameter :" + cp.getAcceptedServerCertificates()); +// System.out.println( +// "getMoaSpConnectionParameter :" + cp.getClientKeyStorePassword()); +// System.out.println( +// "getMoaSpConnectionParameter :" + cp.getClientKeyStore());*/ +// } +// public void testGetMoaSpIdentityLinkTrustProfileID() { +// +// assertEquals(provider.getMoaSpIdentityLinkTrustProfileID(),"StringVerifyIdentiyLinkTrustID"); +// +// } +// public void testGetMoaSpAuthBlockTrustProfileID() { +// assertEquals(provider.getMoaSpAuthBlockTrustProfileID(),"StringVerifyAuthBlockTransformID"); +// } +// +// public void testGetMoaSpAuthBlockVerifyTransformsInfoIDs() { +// String[] result = provider.getMoaSpAuthBlockVerifyTransformsInfoIDs(); +// assertEquals(result[0],"StringVerifyTransformsInfoID1"); +// assertEquals(result[1],"StringVerifyTransformsInfoID2"); +// +// } +// +// public void testGetOnlineApplicationAuthParameter() { +// OAAuthParameter[] result = provider.getOnlineApplicationParameters(); +// +// assertEquals(result[0].getPublicURLPrefix(),"StringOALoginURL"); +// assertEquals(result[0].getProvideStammzahl(),false); +// assertEquals(result[0].getProvideAuthBlock(),false); +// assertEquals(result[0].getProvideIdentityLink(),false); +// +// assertEquals(result[1].getPublicURLPrefix(),"StringOALoginURL2"); +// assertEquals(result[1].getProvideStammzahl(),true); +// assertEquals(result[1].getProvideAuthBlock(),true); +// assertEquals(result[1].getProvideIdentityLink(),true); +// +// +///* for (int i = 0; i < result.length; i++) { +// System.out.println(); +// System.out.println("getOnlineApplicationParameters Url: " + result[i].getUrl()); +// System.out.println("getOnlineApplicationParameters ProvideStammzahl: " + result[i].getProvideStammzahl()); +// System.out.println("getOnlineApplicationParameters ProvideAuthBlock: " + result[i].getProvideAuthBlock()); +// System.out.println("getOnlineApplicationParameters ProvideIdentityLink: " + result[i].getProvideIdentityLink()); +// }*/ +// } +// +// public void testGetGenericConfiguration() { +// Map result = provider.getGenericConfiguration(); +// assertEquals(result.containsKey("Generic Name 1"),true); +// assertEquals(result.containsKey("Generic Name 2"),true); +// assertEquals(result.get("Generic Name 1"),"Value1"); +// assertEquals(result.get("Generic Name 2"),"Value2"); +// /* for (Iterator iter = result.keySet().iterator(); iter.hasNext();) { +// String element = (String) iter.next(); +// System.out.println("getGenericConfiguration Key:" + element); +// System.out.println("getGenericConfiguration Value:" + result.get(element)); +// }*/ +// } +// +//} diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java index 64e628e0c..412e35233 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/config/proxy/MOAIDProxyConfigurationProviderTest.java @@ -1,151 +1,151 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id.config.proxy; - -import java.util.Map; - -import at.gv.egovernment.moa.id.config.ConnectionParameter; -import at.gv.egovernment.moa.id.config.proxy.OAConfiguration; -import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider; -import at.gv.egovernment.moa.id.config.proxy.OAProxyParameter; - -import test.at.gv.egovernment.moa.id.UnitTestCase; - - - -/** - * @author Stefan Knirsch - * @version $Id$ - */ -public class MOAIDProxyConfigurationProviderTest extends UnitTestCase { - private ProxyConfigurationProvider provider; - - /** - * Constructor for MOAProxyConfigTest. - * @param name - */ - public MOAIDProxyConfigurationProviderTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - - provider = -// new ProxyConfigurationProvider(TESTDATA_ROOT + "conf/ConfigurationTest.xml"); - new ProxyConfigurationProvider("data/deploy/conf/moa-id/ConfigurationTest.xml"); - } - public void testGetAuthComponentConnectionParameter() - { - ConnectionParameter cp; - cp = provider.getAuthComponentConnectionParameter(); - assertEquals(cp.getUrl(),"AuthComponentURL"); - assertEquals( cp.getAcceptedServerCertificates(),"http://www.altova.com"); - assertEquals(cp.getClientKeyStorePassword(),"String"); - assertEquals(cp.getClientKeyStore(),"http://www.altova.com"); - /* System.out.println(); - System.out.println("getProxyComponentConnectionParameter :" + cp.getUrl()); - System.out.println( - "getProxyComponentConnectionParameter :" + cp.getAcceptedServerCertificates()); - System.out.println( - "getProxyComponentConnectionParameter :" + cp.getClientKeyStorePassword()); - System.out.println( - "getProxyComponentConnectionParameter :" + cp.getClientKeyStore());*/ -} - - public void testGetOAProxyParameter() { - OAProxyParameter[] result = provider.getOnlineApplicationParameters(); - - assertEquals("http://localhost:9080/", result[0].getPublicURLPrefix()); - assertEquals("file:data/test/conf/OAConfParamAuth.xml", result[0].getConfigFileURL()); - assertEquals(10, result[0].getSessionTimeOut()); - assertEquals("StringloginParameterResolverImpl1", result[0].getLoginParameterResolverImpl()); - assertEquals("StringconnectionBuilderImpl1", result[0].getConnectionBuilderImpl()); - - assertEquals("ProxyComponentURL", result[0].getConnectionParameter().getUrl()); - assertEquals("url:AcceptedServerCertificates", result[0].getConnectionParameter().getAcceptedServerCertificates()); - assertEquals("URL:toClientKeystoreOA", result[0].getConnectionParameter().getClientKeyStore()); - assertEquals("ClientKeystoreOAPAss", result[0].getConnectionParameter().getClientKeyStorePassword()); - - assertEquals("StringOALoginURL2", result[1].getPublicURLPrefix()); - assertEquals("file:data/test/conf/OAConfHeaderAuth.xml", result[1].getConfigFileURL()); - assertEquals(20, result[1].getSessionTimeOut()); - assertEquals("StringloginParameterResolverImpl2",result[1].getLoginParameterResolverImpl()); - assertEquals("StringconnectionBuilderImpl2", result[1].getConnectionBuilderImpl()); - - assertEquals("ProxyComponentURL2", result[1].getConnectionParameter().getUrl()); - assertEquals("url:AcceptedServerCertificates2", result[1].getConnectionParameter().getAcceptedServerCertificates()); - assertEquals("URL:toClientKeystoreOA2", result[1].getConnectionParameter().getClientKeyStore()); - assertEquals("ClientKeystoreOAPAss2", result[1].getConnectionParameter().getClientKeyStorePassword()); - - assertEquals("StringOALoginURL3", result[2].getPublicURLPrefix()); - assertEquals("file:data/test/conf/OAConfBasicAuth.xml", result[2].getConfigFileURL()); - assertEquals(20, result[2].getSessionTimeOut()); - assertEquals("StringloginParameterResolverImpl3",result[2].getLoginParameterResolverImpl()); - assertEquals("StringconnectionBuilderImpl3", result[2].getConnectionBuilderImpl()); - - assertEquals("ProxyComponentURL3", result[2].getConnectionParameter().getUrl()); - assertEquals("url:AcceptedServerCertificates3", result[2].getConnectionParameter().getAcceptedServerCertificates()); - assertEquals("URL:toClientKeystoreOA3", result[2].getConnectionParameter().getClientKeyStore()); - assertEquals("ClientKeystoreOAPAss3", result[2].getConnectionParameter().getClientKeyStorePassword()); - } - - public void testGetGenericConfiguration() { - Map result = provider.getGenericConfiguration(); - assertEquals(true, result.containsKey("authenticationSessionTimeOut")); - assertEquals(true, result.containsKey("authenticationDataTimeOut")); - assertEquals("600", result.get("authenticationSessionTimeOut")); - assertEquals("120", result.get("authenticationDataTimeOut")); - } - - public void testOAConfigurationProvider() throws Exception - { - OAProxyParameter[] result = provider.getOnlineApplicationParameters(); - // für jeden Parameter müsste theoretisch bereits ein Provider instanziiert worden sein, - // aus diesem Grund braucht man NICHT mehr die File-URL anzugeben, PublicURLPrefix reicht - - // sollte ParamAuth sein - OAConfiguration oac1 = result[0].getOaConfiguration(); - assertEquals(OAConfiguration.PARAM_AUTH, oac1.getAuthType()); - assertEquals("MOADateOfBirth", oac1.getParamAuthMapping().get("Param1")); - assertEquals("MOABPK", oac1.getParamAuthMapping().get("Param2")); - // sollte HeaderAuth sein - OAConfiguration oac2 = result[1].getOaConfiguration(); - assertEquals(OAConfiguration.HEADER_AUTH, oac2.getAuthType()); - assertEquals("MOAPublicAuthority", oac2.getHeaderAuthMapping().get("Param1")); - assertEquals("MOABKZ", oac2.getHeaderAuthMapping().get("Param2")); - assertEquals("MOAQualifiedCertificate", oac2.getHeaderAuthMapping().get("Param3")); - assertEquals("MOAStammzahl", oac2.getHeaderAuthMapping().get("Param4")); - assertEquals("MOAIPAddress", oac2.getHeaderAuthMapping().get("Param5")); - - // sollte BasicAuth sein - OAConfiguration oac3 = result[2].getOaConfiguration(); - assertEquals(OAConfiguration.BASIC_AUTH, oac3.getAuthType()); - assertEquals("MOAGivenName", oac3.getBasicAuthUserIDMapping()); - assertEquals("MOAFamilyName", oac3.getBasicAuthPasswordMapping()); - //Fehlerfall: - - - } -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id.config.proxy; +// +//import java.util.Map; +// +//import at.gv.egovernment.moa.id.config.ConnectionParameter; +//import at.gv.egovernment.moa.id.config.proxy.OAConfiguration; +//import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider; +//import at.gv.egovernment.moa.id.config.proxy.OAProxyParameter; +// +//import test.at.gv.egovernment.moa.id.UnitTestCase; +// +// +// +///** +// * @author Stefan Knirsch +// * @version $Id$ +// */ +//public class MOAIDProxyConfigurationProviderTest extends UnitTestCase { +// private ProxyConfigurationProvider provider; +// +// /** +// * Constructor for MOAProxyConfigTest. +// * @param name +// */ +// public MOAIDProxyConfigurationProviderTest(String name) { +// super(name); +// } +// +// protected void setUp() throws Exception { +// +// provider = +//// new ProxyConfigurationProvider(TESTDATA_ROOT + "conf/ConfigurationTest.xml"); +// new ProxyConfigurationProvider("data/deploy/conf/moa-id/ConfigurationTest.xml"); +// } +// public void testGetAuthComponentConnectionParameter() +// { +// ConnectionParameter cp; +// cp = provider.getAuthComponentConnectionParameter(); +// assertEquals(cp.getUrl(),"AuthComponentURL"); +// assertEquals( cp.getAcceptedServerCertificates(),"http://www.altova.com"); +// assertEquals(cp.getClientKeyStorePassword(),"String"); +// assertEquals(cp.getClientKeyStore(),"http://www.altova.com"); +// /* System.out.println(); +// System.out.println("getProxyComponentConnectionParameter :" + cp.getUrl()); +// System.out.println( +// "getProxyComponentConnectionParameter :" + cp.getAcceptedServerCertificates()); +// System.out.println( +// "getProxyComponentConnectionParameter :" + cp.getClientKeyStorePassword()); +// System.out.println( +// "getProxyComponentConnectionParameter :" + cp.getClientKeyStore());*/ +//} +// +// public void testGetOAProxyParameter() { +// OAProxyParameter[] result = provider.getOnlineApplicationParameters(); +// +// assertEquals("http://localhost:9080/", result[0].getPublicURLPrefix()); +// assertEquals("file:data/test/conf/OAConfParamAuth.xml", result[0].getConfigFileURL()); +// assertEquals(10, result[0].getSessionTimeOut()); +// assertEquals("StringloginParameterResolverImpl1", result[0].getLoginParameterResolverImpl()); +// assertEquals("StringconnectionBuilderImpl1", result[0].getConnectionBuilderImpl()); +// +// assertEquals("ProxyComponentURL", result[0].getConnectionParameter().getUrl()); +// assertEquals("url:AcceptedServerCertificates", result[0].getConnectionParameter().getAcceptedServerCertificates()); +// assertEquals("URL:toClientKeystoreOA", result[0].getConnectionParameter().getClientKeyStore()); +// assertEquals("ClientKeystoreOAPAss", result[0].getConnectionParameter().getClientKeyStorePassword()); +// +// assertEquals("StringOALoginURL2", result[1].getPublicURLPrefix()); +// assertEquals("file:data/test/conf/OAConfHeaderAuth.xml", result[1].getConfigFileURL()); +// assertEquals(20, result[1].getSessionTimeOut()); +// assertEquals("StringloginParameterResolverImpl2",result[1].getLoginParameterResolverImpl()); +// assertEquals("StringconnectionBuilderImpl2", result[1].getConnectionBuilderImpl()); +// +// assertEquals("ProxyComponentURL2", result[1].getConnectionParameter().getUrl()); +// assertEquals("url:AcceptedServerCertificates2", result[1].getConnectionParameter().getAcceptedServerCertificates()); +// assertEquals("URL:toClientKeystoreOA2", result[1].getConnectionParameter().getClientKeyStore()); +// assertEquals("ClientKeystoreOAPAss2", result[1].getConnectionParameter().getClientKeyStorePassword()); +// +// assertEquals("StringOALoginURL3", result[2].getPublicURLPrefix()); +// assertEquals("file:data/test/conf/OAConfBasicAuth.xml", result[2].getConfigFileURL()); +// assertEquals(20, result[2].getSessionTimeOut()); +// assertEquals("StringloginParameterResolverImpl3",result[2].getLoginParameterResolverImpl()); +// assertEquals("StringconnectionBuilderImpl3", result[2].getConnectionBuilderImpl()); +// +// assertEquals("ProxyComponentURL3", result[2].getConnectionParameter().getUrl()); +// assertEquals("url:AcceptedServerCertificates3", result[2].getConnectionParameter().getAcceptedServerCertificates()); +// assertEquals("URL:toClientKeystoreOA3", result[2].getConnectionParameter().getClientKeyStore()); +// assertEquals("ClientKeystoreOAPAss3", result[2].getConnectionParameter().getClientKeyStorePassword()); +// } +// +// public void testGetGenericConfiguration() { +// Map result = provider.getGenericConfiguration(); +// assertEquals(true, result.containsKey("authenticationSessionTimeOut")); +// assertEquals(true, result.containsKey("authenticationDataTimeOut")); +// assertEquals("600", result.get("authenticationSessionTimeOut")); +// assertEquals("120", result.get("authenticationDataTimeOut")); +// } +// +// public void testOAConfigurationProvider() throws Exception +// { +// OAProxyParameter[] result = provider.getOnlineApplicationParameters(); +// // f�r jeden Parameter m�sste theoretisch bereits ein Provider instanziiert worden sein, +// // aus diesem Grund braucht man NICHT mehr die File-URL anzugeben, PublicURLPrefix reicht +// +// // sollte ParamAuth sein +// OAConfiguration oac1 = result[0].getOaConfiguration(); +// assertEquals(OAConfiguration.PARAM_AUTH, oac1.getAuthType()); +// assertEquals("MOADateOfBirth", oac1.getParamAuthMapping().get("Param1")); +// assertEquals("MOABPK", oac1.getParamAuthMapping().get("Param2")); +// // sollte HeaderAuth sein +// OAConfiguration oac2 = result[1].getOaConfiguration(); +// assertEquals(OAConfiguration.HEADER_AUTH, oac2.getAuthType()); +// assertEquals("MOAPublicAuthority", oac2.getHeaderAuthMapping().get("Param1")); +// assertEquals("MOABKZ", oac2.getHeaderAuthMapping().get("Param2")); +// assertEquals("MOAQualifiedCertificate", oac2.getHeaderAuthMapping().get("Param3")); +// assertEquals("MOAStammzahl", oac2.getHeaderAuthMapping().get("Param4")); +// assertEquals("MOAIPAddress", oac2.getHeaderAuthMapping().get("Param5")); +// +// // sollte BasicAuth sein +// OAConfiguration oac3 = result[2].getOaConfiguration(); +// assertEquals(OAConfiguration.BASIC_AUTH, oac3.getAuthType()); +// assertEquals("MOAGivenName", oac3.getBasicAuthUserIDMapping()); +// assertEquals("MOAFamilyName", oac3.getBasicAuthPasswordMapping()); +// //Fehlerfall: +// +// +// } +//} diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/proxy/AllTests.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/proxy/AllTests.java index 84e41e12e..76b0c936a 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/proxy/AllTests.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/proxy/AllTests.java @@ -1,55 +1,55 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id.proxy; - -import test.at.gv.egovernment.moa.id.proxy.builder.SAMLRequestBuilderTest; -import test.at.gv.egovernment.moa.id.proxy.parser.SAMLResponseParserTest; -import junit.awtui.TestRunner; -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * @author Paul Ivancsics - * @version $Id$ - */ -public class AllTests { - - public static Test suite() { - TestSuite suite = new TestSuite(); - - suite.addTestSuite(SAMLRequestBuilderTest.class); - suite.addTestSuite(SAMLResponseParserTest.class); - - return suite; - } - - public static void main(String[] args) { - try { - TestRunner.run(AllTests.class); - } catch (Exception e) { - e.printStackTrace(); - } - } -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id.proxy; +// +//import test.at.gv.egovernment.moa.id.proxy.builder.SAMLRequestBuilderTest; +//import test.at.gv.egovernment.moa.id.proxy.parser.SAMLResponseParserTest; +//import junit.awtui.TestRunner; +//import junit.framework.Test; +//import junit.framework.TestSuite; +// +///** +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class AllTests { +// +// public static Test suite() { +// TestSuite suite = new TestSuite(); +// +// suite.addTestSuite(SAMLRequestBuilderTest.class); +// suite.addTestSuite(SAMLResponseParserTest.class); +// +// return suite; +// } +// +// public static void main(String[] args) { +// try { +// TestRunner.run(AllTests.class); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +//} diff --git a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/util/SSLUtilsTest.java b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/util/SSLUtilsTest.java index 19ad228a4..db6a0ac63 100644 --- a/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/util/SSLUtilsTest.java +++ b/id/server/idserverlib/src/test/java/test/at/gv/egovernment/moa/id/util/SSLUtilsTest.java @@ -1,116 +1,116 @@ -/* - * Copyright 2003 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/ - * - * 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 test.at.gv.egovernment.moa.id.util; - -import iaik.pki.jsse.IAIKX509TrustManager; - -import java.net.URL; -import java.security.Security; - -import javax.net.ssl.SSLException; -import javax.net.ssl.SSLSocketFactory; - -import com.sun.net.ssl.HttpsURLConnection; - -import at.gv.egovernment.moa.id.config.ConfigurationProvider; -import at.gv.egovernment.moa.id.config.ConnectionParameter; -import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; -import at.gv.egovernment.moa.id.config.proxy.OAProxyParameter; -import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider; -import at.gv.egovernment.moa.id.iaik.config.LoggerConfigImpl; -import at.gv.egovernment.moa.id.util.SSLUtils; -import test.at.gv.egovernment.moa.id.UnitTestCase; - -/* - * @author Paul Ivancsics - * @version $Id$ - */ -public class SSLUtilsTest extends UnitTestCase { - - public SSLUtilsTest(String name) { - super(name); - } - - protected void setUp() throws Exception { - //System.setProperty("javax.net.debug", "all"); - Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); - System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); - IAIKX509TrustManager.initLog(new LoggerConfigImpl("file:" + TESTDATA_ROOT + "conf/log4j.properties")); - System.setProperty("https.cipherSuites", "SSL_DHE_DSS_WITH_DES_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5"); - } - - public void testVerisignOK() throws Exception { - doTestOA("conf/ConfigurationTest.xml", "http://verisign.moa.gv.at/", true, null); - } - public void testATrustOK() throws Exception { - doTestOA("conf/ConfigurationTest.xml", "http://a-trust.moa.gv.at/", true, null); - } - public void testBaltimoreOK() throws Exception { - doTestOA("conf/ConfigurationTest.xml", "http://baltimore.moa.gv.at/", true, null); - } - public void testCIOOK() throws Exception { - doTestOA("conf/ConfigurationTest.xml", "http://cio.moa.gv.at/", true, null); - } - public void testMOASPOK() throws Exception { - System.setProperty(ConfigurationProvider.CONFIG_PROPERTY_NAME, - TESTDATA_ROOT + "conf/ConfigurationTest.xml"); - ConnectionParameter connParam = AuthConfigurationProvider.getInstance().getMoaSpConnectionParameter(); - doTest(connParam, true, null); - } - private void doTestOA(String configFile, String publicURLPrefix, boolean shouldOK, String exMessageFragment) throws Exception { - System.setProperty(ConfigurationProvider.CONFIG_PROPERTY_NAME, - TESTDATA_ROOT + configFile); - ProxyConfigurationProvider proxyConf = - ProxyConfigurationProvider.getInstance(); - OAProxyParameter oaParam = proxyConf.getOnlineApplicationParameter(publicURLPrefix); - ConnectionParameter connParam = oaParam.getConnectionParameter(); - doTest(connParam, shouldOK, exMessageFragment); - } - private void doTest(ConnectionParameter connParam, boolean shouldOK, String exMessageFragment) throws Exception { - SSLUtils.initialize(); - AuthConfigurationProvider authConf = AuthConfigurationProvider.getInstance(); - SSLSocketFactory ssf = SSLUtils.getSSLSocketFactory(authConf, connParam); - URL url = new URL(connParam.getUrl()); - HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(); - conn.setRequestMethod("GET"); - conn.setDoInput(true); - conn.setDoOutput(true); - conn.setUseCaches(false); - conn.setAllowUserInteraction(false); - conn.setSSLSocketFactory(ssf); - try { - conn.connect(); - assertTrue(shouldOK); - assertEquals(200, conn.getResponseCode()); - conn.disconnect(); - } - catch (SSLException ex) { - ex.printStackTrace(); - assertFalse(shouldOK); - assertTrue(ex.getMessage().indexOf(exMessageFragment) >= 0); - } - } - -} +///* +// * Copyright 2003 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/ +// * +// * 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 test.at.gv.egovernment.moa.id.util; +// +//import iaik.pki.jsse.IAIKX509TrustManager; +// +//import java.net.URL; +//import java.security.Security; +// +//import javax.net.ssl.SSLException; +//import javax.net.ssl.SSLSocketFactory; +// +//import com.sun.net.ssl.HttpsURLConnection; +// +//import at.gv.egovernment.moa.id.config.ConfigurationProvider; +//import at.gv.egovernment.moa.id.config.ConnectionParameter; +//import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; +//import at.gv.egovernment.moa.id.config.proxy.OAProxyParameter; +//import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider; +//import at.gv.egovernment.moa.id.iaik.config.LoggerConfigImpl; +//import at.gv.egovernment.moa.id.util.SSLUtils; +//import test.at.gv.egovernment.moa.id.UnitTestCase; +// +///* +// * @author Paul Ivancsics +// * @version $Id$ +// */ +//public class SSLUtilsTest extends UnitTestCase { +// +// public SSLUtilsTest(String name) { +// super(name); +// } +// +// protected void setUp() throws Exception { +// //System.setProperty("javax.net.debug", "all"); +// Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); +// System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); +// IAIKX509TrustManager.initLog(new LoggerConfigImpl("file:" + TESTDATA_ROOT + "conf/log4j.properties")); +// System.setProperty("https.cipherSuites", "SSL_DHE_DSS_WITH_DES_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA,SSL_RSA_WITH_DES_CBC_SHA,SSL_RSA_WITH_3DES_EDE_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5"); +// } +// +// public void testVerisignOK() throws Exception { +// doTestOA("conf/ConfigurationTest.xml", "http://verisign.moa.gv.at/", true, null); +// } +// public void testATrustOK() throws Exception { +// doTestOA("conf/ConfigurationTest.xml", "http://a-trust.moa.gv.at/", true, null); +// } +// public void testBaltimoreOK() throws Exception { +// doTestOA("conf/ConfigurationTest.xml", "http://baltimore.moa.gv.at/", true, null); +// } +// public void testCIOOK() throws Exception { +// doTestOA("conf/ConfigurationTest.xml", "http://cio.moa.gv.at/", true, null); +// } +// public void testMOASPOK() throws Exception { +// System.setProperty(ConfigurationProvider.CONFIG_PROPERTY_NAME, +// TESTDATA_ROOT + "conf/ConfigurationTest.xml"); +// ConnectionParameter connParam = AuthConfigurationProvider.getInstance().getMoaSpConnectionParameter(); +// doTest(connParam, true, null); +// } +// private void doTestOA(String configFile, String publicURLPrefix, boolean shouldOK, String exMessageFragment) throws Exception { +// System.setProperty(ConfigurationProvider.CONFIG_PROPERTY_NAME, +// TESTDATA_ROOT + configFile); +// ProxyConfigurationProvider proxyConf = +// ProxyConfigurationProvider.getInstance(); +// OAProxyParameter oaParam = proxyConf.getOnlineApplicationParameter(publicURLPrefix); +// ConnectionParameter connParam = oaParam.getConnectionParameter(); +// doTest(connParam, shouldOK, exMessageFragment); +// } +// private void doTest(ConnectionParameter connParam, boolean shouldOK, String exMessageFragment) throws Exception { +// SSLUtils.initialize(); +// AuthConfigurationProvider authConf = AuthConfigurationProvider.getInstance(); +// SSLSocketFactory ssf = SSLUtils.getSSLSocketFactory(authConf, connParam); +// URL url = new URL(connParam.getUrl()); +// HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(); +// conn.setRequestMethod("GET"); +// conn.setDoInput(true); +// conn.setDoOutput(true); +// conn.setUseCaches(false); +// conn.setAllowUserInteraction(false); +// conn.setSSLSocketFactory(ssf); +// try { +// conn.connect(); +// assertTrue(shouldOK); +// assertEquals(200, conn.getResponseCode()); +// conn.disconnect(); +// } +// catch (SSLException ex) { +// ex.printStackTrace(); +// assertFalse(shouldOK); +// assertTrue(ex.getMessage().indexOf(exMessageFragment) >= 0); +// } +// } +// +//} |