diff options
Diffstat (limited to 'id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java')
-rw-r--r-- | id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java | 150 |
1 files changed, 150 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java b/id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java new file mode 100644 index 000000000..248e5cc33 --- /dev/null +++ b/id/server/idserverlib/src/test/java/test/abnahme/P/Test100LoginParameterResolver.java @@ -0,0 +1,150 @@ +/* +* Copyright 2003 Federal Chancellery Austria +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package test.abnahme.P; +import test.abnahme.AbnahmeTestCase; + +/** + * @author Stefan Knirsch + * @version $Id$ + * + */ + +public class Test100LoginParameterResolver extends AbnahmeTestCase { + +// private static final String CLIENT_IP_ADDRESS = "56.246.75.11"; +// private OAConfiguration oaConf; +// private LoginParameterResolver lpr; +// + public Test100LoginParameterResolver(String name) { + super(name); + } +// +// private void setUp(String publicURLPrefix) +// throws Exception { +// +// // get configuration data +// ProxyConfigurationProvider proxyConf = ProxyConfigurationProvider.getInstance(); +// OAProxyParameter oaParam = proxyConf.getOnlineApplicationParameter(publicURLPrefix); +// oaConf = oaParam.getOaConfiguration(); +// System.out.println("Parameterübergabe: " + oaConf.getAuthType()); +// +// // get login parameter resolver +// LoginParameterResolverFactory.initialize(); +// lpr = LoginParameterResolverFactory.getLoginParameterResolver(publicURLPrefix); +// } +// public void testP101() throws Exception { +// try { +// // read configuration and set up LoginParameterResolver +// setUp("https://testP101:9443/"); +// if (! oaConf.getAuthType().equals(OAConfiguration.BASIC_AUTH)) +// fail(); +// +// // assemble authentication data +// AuthenticationData authData = new AuthenticationData(); +// authData.setFamilyName("Huber"); +// authData.setGivenName("Hugo"); +// +// // resolve login headers +// Map loginHeaders = lpr.getAuthenticationHeaders(oaConf, authData, CLIENT_IP_ADDRESS, false, ""); +// +// // validate login headers +// assertEquals(1, loginHeaders.keySet().size()); +// System.out.println("Header Authorization: " + loginHeaders.get("Authorization")); +// System.out.println("Decoded UserID:Password " + +// new String(new BASE64Decoder().decodeBuffer(((String)loginHeaders.get("Authorization")).substring(6)))); +// String userIDPassword = "Hugo:Huber"; +// String credentials = Base64Utils.encode(userIDPassword.getBytes()); +// assertEquals("Basic " + credentials, loginHeaders.get("Authorization")); +// System.out.println("-----------------------Testfall " + this.getName() + " erfolgreich abgearbeitet! -----------------------"); +// } +// catch (Exception e) { +// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); +// throw e; +// } +// +// } +// public void testP102() throws Exception { +// try { +// // read configuration and set up LoginParameterResolver +// setUp("https://testP102:9443/"); +// if (! oaConf.getAuthType().equals(OAConfiguration.PARAM_AUTH)) +// fail(); +// +// // assemble authentication data +// AuthenticationData authData = new AuthenticationData(); +// String DATE_OF_BIRTH = "1963-12-29"; +// String VPK = "kp6hOq6LRAkLtrqm6EvDm6bMwJw="; +// authData.setDateOfBirth(DATE_OF_BIRTH); +// authData.setBPK(VPK); +// +// // resolve login parameters +// Map loginParameters = lpr.getAuthenticationParameters(oaConf, authData, CLIENT_IP_ADDRESS, false, ""); +// +// // validate login headers +// assertEquals(2, loginParameters.keySet().size()); +// System.out.println("Param1: " + loginParameters.get("Param1")); +// System.out.println("Param2: " + loginParameters.get("Param2")); +// assertEquals(DATE_OF_BIRTH, loginParameters.get("Param1")); +// assertEquals(VPK, loginParameters.get("Param2")); +// System.out.println("-----------------------Testfall " + this.getName() + " erfolgreich abgearbeitet! -----------------------"); +// } +// catch (Exception e) { +// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); +// throw e; +// } +// } +// +// public void testP103() throws Exception { +// try { +// // read configuration and set up LoginParameterResolver +// setUp("https://localhost:9443/"); +// if (! oaConf.getAuthType().equals(OAConfiguration.HEADER_AUTH)) +// fail(); +// +// // assemble authentication data +// AuthenticationData authData = new AuthenticationData(); +// boolean PUBLIC_AUTH = true; +// String BKZ = "FinanzamtWien23Leitstelle"; +// boolean QUAL_CERT = false; +// String STAMMZAHL = "3456789012"; +// authData.setPublicAuthority(PUBLIC_AUTH); +// authData.setPublicAuthorityCode(BKZ); +// authData.setQualifiedCertificate(QUAL_CERT); +// authData.setIdentificationValue(STAMMZAHL); +// +// // resolve login headers +// Map loginHeaders = lpr.getAuthenticationHeaders(oaConf, authData, CLIENT_IP_ADDRESS, false, ""); +// +// // validate login headers +// assertEquals(5, loginHeaders.keySet().size()); +// System.out.println("Header Param1: " + loginHeaders.get("Param1")); +// System.out.println("Header Param2: " + loginHeaders.get("Param2")); +// System.out.println("Header Param3: " + loginHeaders.get("Param3")); +// System.out.println("Header Param4: " + loginHeaders.get("Param4")); +// System.out.println("Header Param5: " + loginHeaders.get("Param5")); +// assertEquals(String.valueOf(PUBLIC_AUTH), loginHeaders.get("Param1")); +// assertEquals(BKZ, loginHeaders.get("Param2")); +// assertEquals(String.valueOf(QUAL_CERT), loginHeaders.get("Param3")); +// assertEquals(STAMMZAHL, loginHeaders.get("Param4")); +// assertEquals(CLIENT_IP_ADDRESS, loginHeaders.get("Param5")); +// System.out.println("-----------------------Testfall " + this.getName() + " erfolgreich abgearbeitet! -----------------------"); +// } +// catch (Exception e) { +// System.err.println("------ FEHLER IN " + this.getName() + ":" + e.getLocalizedMessage()); +// throw e; +// } +// } +} |