/* * Copyright 2018 A-SIT Plus GmbH AT-specific eIDAS Connector has been developed * in a cooperation between EGIZ, A-SIT Plus GmbH, A-SIT, and Graz University of * Technology. * * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "License"); * You may not use this work except in compliance with the License. You may * obtain a copy of the License at: * https://joinup.ec.europa.eu/news/understanding-eupl-v12 * * 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. * * 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 at.asitplus.eidas.specific.modules.auth.eidas.v2.test; //import java.security.MessageDigest; // //import org.apache.commons.lang3.StringUtils; //import org.junit.Test; //import org.junit.runner.RunWith; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.test.context.ContextConfiguration; //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; //import org.springframework.util.Base64Utils; // //import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.SQLiteServiceException; //import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.eIDASAuthenticationException; //import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.eIDASResponseUtils; //import at.gv.egiz.eaaf.core.impl.data.Trible; // //@RunWith(SpringJUnit4ClassRunner.class) //@ContextConfiguration("/SpringTest-context_basic_test.xml") //public class EidasDataStoreTest { // // @Autowired // private EidasDataStore dataStore; // // private static final String P1_TRANSID = "123456789"; // private static final String P1_eIDASID = // "DE/AT/121asdf1as5f1as6f1asd2f1asdf1asdf1asd23f1asdf1asdf4sd7fsdf1asdf1asd2f1asd56f7asdf4asdfasdf1"; // // private static final String P2_TRANSID = "987654321"; // private static final String P2_eIDASID = // "EE/AT/asfasfasdfasdfasdfasdfasdfasvafasdfasdfasdfasdfasdfasvascasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd"; // // @Test // public void dummyTest() { // // } // // @Test // public void insertTestOne() throws SQLiteServiceException, eIDASAuthenticationException { // Trible eidasId = eIDASResponseUtils.parseEidasPersonalIdentifier(P1_eIDASID); // String ernbId = createHashFromUniqueId(eidasId.getThird()); // dataStore.storeNationalId( // P1_TRANSID, // eidasId, // ernbId); // // if (StringUtils.isEmpty(dataStore.getEidasRawNationalId(ernbId)) { // && dataStore.getEidasRawNationalId(ernbId).equals(eidasId.getThird())) // throw new SQLiteServiceException("No eIDAS RAW Id in SQLite DB", null); // // } // // if (StringUtils.isEmpty(dataStore.getErnbNationalId(eidasId)) { // && dataStore.getErnbNationalId(eidasId).equals(ernbId)) // throw new SQLiteServiceException("No ERnB Id in SQLite DB", null); // } // // } // // @Test // public void insertTestTwo() throws SQLiteServiceException, eIDASAuthenticationException { // Trible eidasId = eIDASResponseUtils.parseEidasPersonalIdentifier(P2_eIDASID); // String ernbId = createHashFromUniqueId(eidasId.getThird()); // dataStore.storeNationalId( // P2_TRANSID, // eidasId, // ernbId); // // if (StringUtils.isEmpty(dataStore.getEidasRawNationalId(ernbId)) { // && dataStore.getEidasRawNationalId(ernbId).equals(eidasId.getThird())) // throw new SQLiteServiceException("No eIDAS RAW Id in SQLite DB", null); // // } // // if (StringUtils.isEmpty(dataStore.getErnbNationalId(eidasId)) { // && dataStore.getErnbNationalId(eidasId).equals(ernbId)) // throw new SQLiteServiceException("No ERnB Id in SQLite DB", null); // // } // // } // // private String createHashFromUniqueId(String uniqueId) throws eIDASAuthenticationException { // try { // MessageDigest md = MessageDigest.getInstance("SHA-256"); // byte[] hash = md.digest(uniqueId.getBytes("UTF-8")); // String hashBase64 = new String(Base64Utils.encode(hash), "UTF-8").replaceAll("\r\n", ""); // return hashBase64; // // } catch (Exception ex) { // throw new eIDASAuthenticationException("internal.03", new Object[] {}, ex); // // } // } //}