diff options
Diffstat (limited to 'id/server/idserverlib/src/test/java/test/abnahme/A/Test400GetAuthenticationData.java')
-rw-r--r-- | id/server/idserverlib/src/test/java/test/abnahme/A/Test400GetAuthenticationData.java | 322 |
1 files changed, 161 insertions, 161 deletions
diff --git a/id/server/idserverlib/src/test/java/test/abnahme/A/Test400GetAuthenticationData.java b/id/server/idserverlib/src/test/java/test/abnahme/A/Test400GetAuthenticationData.java index 370949ac4..666f16f98 100644 --- a/id/server/idserverlib/src/test/java/test/abnahme/A/Test400GetAuthenticationData.java +++ b/id/server/idserverlib/src/test/java/test/abnahme/A/Test400GetAuthenticationData.java @@ -1,161 +1,161 @@ -/* - * 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.abnahme.A; - -import java.util.HashMap; - -import org.w3c.dom.Element; -import test.abnahme.AbnahmeTestCase; - -import at.gv.egovernment.moa.id.AuthenticationException; -import at.gv.egovernment.moa.id.auth.AuthenticationServer; -import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; -import at.gv.egovernment.moa.id.auth.builder.VerifyXMLSignatureRequestBuilder; -import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; -import at.gv.egovernment.moa.id.auth.data.IdentityLink; -import at.gv.egovernment.moa.id.auth.invoke.SignatureVerificationInvoker; -import at.gv.egovernment.moa.id.auth.parser.CreateXMLSignatureResponseParser; -import at.gv.egovernment.moa.id.auth.parser.InfoboxReadResponseParser; -import at.gv.egovernment.moa.id.auth.parser.VerifyXMLSignatureResponseParser; -import at.gv.egovernment.moa.id.auth.validator.CreateXMLSignatureResponseValidator; -import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; -import at.gv.egovernment.moa.id.data.AuthenticationData; - -/** - * @author Stefan Knirsch - * @version $Id$ - */ - -public class Test400GetAuthenticationData extends AbnahmeTestCase { - - private String samlArtifact; - - public Test400GetAuthenticationData(String name) { - super(name); - } - - protected void setUp() throws Exception { - super.setUp(); - String sessionID = startAuthentication(); - AuthenticationSession session = AuthenticationServer.getSession(sessionID); - String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); - HashMap parameters = new HashMap(1); - parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); - server.verifyIdentityLink(sessionID, parameters); - InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); - IdentityLink idl = irrp.parseIdentityLink(); - Element domVerifyXMLSignatureRequest = new VerifyXMLSignatureRequestBuilder().build(idl, AuthConfigurationProvider.getInstance().getMoaSpAuthBlockTrustProfileID()); - Element domVerifyXMLSignatureResponse = new SignatureVerificationInvoker().verifyXMLSignature(domVerifyXMLSignatureRequest); - new VerifyXMLSignatureResponseParser(domVerifyXMLSignatureResponse); - //VerifyXMLSignatureResponseValidator.getInstance().validate(respParser.parseData(), AuthConfigurationProvider.getInstance().getIdentityLinkX509SubjectNames()); - // System.out.println(createXMLSignatureRequest); - String createXMLSignatureResponse = readXmldata("CreateXMLSignatureResponse.xml"); - CreateXMLSignatureResponseValidator.getInstance().validate(new CreateXMLSignatureResponseParser(createXMLSignatureResponse).parseResponse(), session); - samlArtifact = server.verifyAuthenticationBlock(sessionID, createXMLSignatureResponse); - } - - public void testA401() throws Exception { - try { - - AuthenticationData authData = server.getAuthenticationData(samlArtifact); -// authDataWriter(authData,"NEWA401"); - assertXmlEquals(clearSamlAssertion(authData.getSamlAssertion()), readXmldata("AuthenticationData.xml")); - System.out.println("-----------------------\nTestfall " + this.getName() + " erfolgreich abgearbeitet! \n-----------------------"); - } - catch (Exception e) { - System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); - throw e; - } - } - - public void testA451() throws Exception { - try { - try { - AuthenticationData authData = server.getAuthenticationData("AAGu1JFbyGKqJ+3NAonwMu5bNyUc7kooeMK6bxeXBbnK6NL0DfuVJsGi"); - authDataWriter(authData, "A45"); - if (authData != null) - fail(); - } - catch (AuthenticationException e) { - System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); - } - } - catch (Exception e) { - System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); - throw e; - } - } - - public void testA452() throws Exception { - try { - server.getAuthenticationData(samlArtifact); - try { - server.getAuthenticationData(samlArtifact); - fail(); - } - catch (AuthenticationException e) { - System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); - } - } - catch (Exception e) { - System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); - throw e; - } - } - public void testA453() throws Exception { - try { - server.setSecondsAuthDataTimeOut(-1000); - server.cleanup(); - try { - server.getAuthenticationData(samlArtifact); - fail(); - } - catch (AuthenticationException e) { - System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); - } - } - catch (Exception e) { - System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); - throw e; - } - } - - public void testA454() throws Exception { - try { - try { - server.getAuthenticationData("blabla123"); - fail(); - } - catch (AuthenticationException e) { - System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); - } - } - catch (Exception e) { - System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); - throw e; - } - } - -} +///* +// * 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.abnahme.A; +// +//import java.util.HashMap; +// +//import org.w3c.dom.Element; +//import test.abnahme.AbnahmeTestCase; +// +//import at.gv.egovernment.moa.id.AuthenticationException; +//import at.gv.egovernment.moa.id.auth.AuthenticationServer; +//import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants; +//import at.gv.egovernment.moa.id.auth.builder.VerifyXMLSignatureRequestBuilder; +//import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; +//import at.gv.egovernment.moa.id.auth.data.IdentityLink; +//import at.gv.egovernment.moa.id.auth.invoke.SignatureVerificationInvoker; +//import at.gv.egovernment.moa.id.auth.parser.CreateXMLSignatureResponseParser; +//import at.gv.egovernment.moa.id.auth.parser.InfoboxReadResponseParser; +//import at.gv.egovernment.moa.id.auth.parser.VerifyXMLSignatureResponseParser; +//import at.gv.egovernment.moa.id.auth.validator.CreateXMLSignatureResponseValidator; +//import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; +//import at.gv.egovernment.moa.id.data.AuthenticationData; +// +///** +// * @author Stefan Knirsch +// * @version $Id$ +// */ +// +//public class Test400GetAuthenticationData extends AbnahmeTestCase { +// +// private String samlArtifact; +// +// public Test400GetAuthenticationData(String name) { +// super(name); +// } +// +// protected void setUp() throws Exception { +// super.setUp(); +// String sessionID = startAuthentication(); +// AuthenticationSession session = AuthenticationServer.getSession(sessionID); +// String infoboxReadResponse = readXmldata("InfoBoxReadResponse.xml"); +// HashMap parameters = new HashMap(1); +// parameters.put(MOAIDAuthConstants.PARAM_XMLRESPONSE, infoboxReadResponse); +// server.verifyIdentityLink(sessionID, parameters); +// InfoboxReadResponseParser irrp = new InfoboxReadResponseParser(infoboxReadResponse); +// IdentityLink idl = irrp.parseIdentityLink(); +// Element domVerifyXMLSignatureRequest = new VerifyXMLSignatureRequestBuilder().build(idl, AuthConfigurationProvider.getInstance().getMoaSpAuthBlockTrustProfileID()); +// Element domVerifyXMLSignatureResponse = new SignatureVerificationInvoker().verifyXMLSignature(domVerifyXMLSignatureRequest); +// new VerifyXMLSignatureResponseParser(domVerifyXMLSignatureResponse); +// //VerifyXMLSignatureResponseValidator.getInstance().validate(respParser.parseData(), AuthConfigurationProvider.getInstance().getIdentityLinkX509SubjectNames()); +// // System.out.println(createXMLSignatureRequest); +// String createXMLSignatureResponse = readXmldata("CreateXMLSignatureResponse.xml"); +// CreateXMLSignatureResponseValidator.getInstance().validate(new CreateXMLSignatureResponseParser(createXMLSignatureResponse).parseResponse(), session); +// samlArtifact = server.verifyAuthenticationBlock(sessionID, createXMLSignatureResponse); +// } +// +// public void testA401() throws Exception { +// try { +// +// AuthenticationData authData = server.getAuthenticationData(samlArtifact); +//// authDataWriter(authData,"NEWA401"); +// assertXmlEquals(clearSamlAssertion(authData.getSamlAssertion()), readXmldata("AuthenticationData.xml")); +// System.out.println("-----------------------\nTestfall " + this.getName() + " erfolgreich abgearbeitet! \n-----------------------"); +// } +// catch (Exception e) { +// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); +// throw e; +// } +// } +// +// public void testA451() throws Exception { +// try { +// try { +// AuthenticationData authData = server.getAuthenticationData("AAGu1JFbyGKqJ+3NAonwMu5bNyUc7kooeMK6bxeXBbnK6NL0DfuVJsGi"); +// authDataWriter(authData, "A45"); +// if (authData != null) +// fail(); +// } +// catch (AuthenticationException e) { +// System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); +// } +// } +// catch (Exception e) { +// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); +// throw e; +// } +// } +// +// public void testA452() throws Exception { +// try { +// server.getAuthenticationData(samlArtifact); +// try { +// server.getAuthenticationData(samlArtifact); +// fail(); +// } +// catch (AuthenticationException e) { +// System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); +// } +// } +// catch (Exception e) { +// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); +// throw e; +// } +// } +// public void testA453() throws Exception { +// try { +// server.setSecondsAuthDataTimeOut(-1000); +// server.cleanup(); +// try { +// server.getAuthenticationData(samlArtifact); +// fail(); +// } +// catch (AuthenticationException e) { +// System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); +// } +// } +// catch (Exception e) { +// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); +// throw e; +// } +// } +// +// public void testA454() throws Exception { +// try { +// try { +// server.getAuthenticationData("blabla123"); +// fail(); +// } +// catch (AuthenticationException e) { +// System.out.println("-----------------------\nFehler in " + this.getName() + " erfolgreich abgefangen: " + e.getLocalizedMessage() + "\n-----------------------"); +// } +// } +// catch (Exception e) { +// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); +// throw e; +// } +// } +// +//} |