@Test public void requestFromXMLfile() throws IOException, CertificateException, XMLParserException, UnmarshallingException, ErrorCodeException, InitializationException, ComponentInitializationException { String issuer = "https: String destination = "test destination"; String providerName = "test providername"; Map<EidasPersonAttributes, Boolean> requestedAttributes = new HashMap<>(); requestedAttributes.put(EidasNaturalPersonAttributes.BIRTH_NAME, true); requestedAttributes.put(EidasNaturalPersonAttributes.CURRENT_ADDRESS, false); requestedAttributes.put(EidasNaturalPersonAttributes.DATE_OF_BIRTH, true); requestedAttributes.put(EidasNaturalPersonAttributes.FAMILY_NAME, false); requestedAttributes.put(EidasNaturalPersonAttributes.FIRST_NAME, true); requestedAttributes.put(EidasNaturalPersonAttributes.GENDER, true); requestedAttributes.put(EidasNaturalPersonAttributes.PERSON_IDENTIFIER, true); requestedAttributes.put(EidasNaturalPersonAttributes.PLACE_OF_BIRTH, false); requestedAttributes.put(EidasLegalPersonAttributes.LEGAL_PERSON_IDENTIFIER, true); requestedAttributes.put(EidasLegalPersonAttributes.LEGAL_NAME, true); requestedAttributes.put(EidasLegalPersonAttributes.LEGAL_ADDRESS, true); requestedAttributes.put(EidasLegalPersonAttributes.VAT_REGISTRATION, true); requestedAttributes.put(EidasLegalPersonAttributes.TAX_REFERENCE, true); requestedAttributes.put(EidasLegalPersonAttributes.D2012_17_EU_IDENTIFIER, true); requestedAttributes.put(EidasLegalPersonAttributes.LEI, true); requestedAttributes.put(EidasLegalPersonAttributes.EORI, true); requestedAttributes.put(EidasLegalPersonAttributes.SEED, true); requestedAttributes.put(EidasLegalPersonAttributes.SIC, true); X509Certificate cert = Utils.readCert(TestEidasSaml.class.getResourceAsStream("/EidasSignerTest_x509.cer")); List<X509Certificate> authors = new ArrayList<>(); authors.add(cert); byte[] request = Files.readAllBytes(Paths.get("src/test/resources/EidasSamlRequest_13062017.xml")); EidasRequest result = EidasSaml.parseRequest(new ByteArrayInputStream(request), authors); assertEquals(issuer, result.getIssuer()); assertEquals(destination, result.getDestination()); assertEquals(providerName, result.getProviderName()); assertEquals(destination, result.getDestination()); assertEquals(requestedAttributes.size(), result.getRequestedAttributes().size()); for ( Map.Entry<EidasPersonAttributes, Boolean> entry : result.getRequestedAttributes() ) { assertEquals(requestedAttributes.get(entry.getKey()), entry.getValue()); } }
public static EidasRequest parseRequest(InputStream is) throws InitializationException, XMLParserException, UnmarshallingException, ErrorCodeException, ComponentInitializationException { init(); return EidasRequest.parse(is); }
EidasSaml { public static EidasRequest parseRequest(InputStream is) throws InitializationException, XMLParserException, UnmarshallingException, ErrorCodeException, ComponentInitializationException { init(); return EidasRequest.parse(is); } }
EidasSaml { public static EidasRequest parseRequest(InputStream is) throws InitializationException, XMLParserException, UnmarshallingException, ErrorCodeException, ComponentInitializationException { init(); return EidasRequest.parse(is); } private  EidasSaml(); }
EidasSaml { public static EidasRequest parseRequest(InputStream is) throws InitializationException, XMLParserException, UnmarshallingException, ErrorCodeException, ComponentInitializationException { init(); return EidasRequest.parse(is); } private  EidasSaml(); static synchronized void init(); static byte[] createRequest(String issuer,
                                     String destination,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes); static byte[] createRequest(String issuer,
                                     String destination,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes,
                                     String id); static byte[] createRequest(String issuer,
                                     String destination,
                                     String providerName,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes,
                                     EidasRequestSectorType sectorType,
                                     EidasNameIdType nameIdPolicy,
                                     EidasLoA loa); static byte[] createRequest(String id,
                                     String issuer,
                                     String destination,
                                     String providerName,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes,
                                     EidasRequestSectorType sectorType,
                                     EidasNameIdType nameIdPolicy,
                                     EidasLoA loa); static byte[] createRequest(String issuer,
                                     String destination,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes,
                                     EidasRequestSectorType sectorType,
                                     EidasNameIdType nameIdPolicy,
                                     EidasLoA loa); static EidasRequest parseRequest(InputStream is); static EidasRequest parseRequest(InputStream is, List<X509Certificate> authors); static void verifyRequest(EidasRequest request, List<X509Certificate> authors); static byte[] createResponse(List<EidasAttribute> att,
                                      String destination,
                                      String recipient,
                                      EidasNameId nameid,
                                      String issuer,
                                      EidasLoA loa,
                                      String inResponseTo,
                                      EidasEncrypter encrypter,
                                      EidasSigner signer); static EidasResponse parseResponse(InputStream is,
                                            X509KeyPair[] decryptionKeyPairs,
                                            X509Certificate[] signatureAuthors); static byte[] createMetaDataService(String id,
                                             String entityId,
                                             Date validUntil,
                                             X509Certificate sigCert,
                                             X509Certificate encCert,
                                             EidasOrganisation organisation,
                                             EidasContactPerson technicalcontact,
                                             EidasContactPerson supportContact,
                                             String postEndpoint,
                                             String redirectEndpoint,
                                             List<EidasNameIdType> supportedNameIdTypes,
                                             List<EidasPersonAttributes> attributes,
                                             EidasSigner signer,
                                             String middlewareVersion,
                                             boolean doSign,
                                             boolean requesterIdFlag); static byte[] createMetaDataNode(String id,
                                          String entityId,
                                          Date validUntil,
                                          X509Certificate sigCert,
                                          X509Certificate encCert,
                                          EidasOrganisation organisation,
                                          EidasContactPerson techcontact,
                                          EidasContactPerson supportcontact,
                                          String postEndpoint,
                                          EidasRequestSectorType spType,
                                          List<EidasNameIdType> supportedNameIdTypes,
                                          EidasSigner signer); static EidasMetadataNode parseMetaDataNode(InputStream is, X509Certificate signer); static void validateXMLRequest(InputStream is, boolean resetStreamAfterValidation); }
EidasSaml { public static EidasRequest parseRequest(InputStream is) throws InitializationException, XMLParserException, UnmarshallingException, ErrorCodeException, ComponentInitializationException { init(); return EidasRequest.parse(is); } private  EidasSaml(); static synchronized void init(); static byte[] createRequest(String issuer,
                                     String destination,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes); static byte[] createRequest(String issuer,
                                     String destination,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes,
                                     String id); static byte[] createRequest(String issuer,
                                     String destination,
                                     String providerName,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes,
                                     EidasRequestSectorType sectorType,
                                     EidasNameIdType nameIdPolicy,
                                     EidasLoA loa); static byte[] createRequest(String id,
                                     String issuer,
                                     String destination,
                                     String providerName,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes,
                                     EidasRequestSectorType sectorType,
                                     EidasNameIdType nameIdPolicy,
                                     EidasLoA loa); static byte[] createRequest(String issuer,
                                     String destination,
                                     EidasSigner signer,
                                     Map<EidasPersonAttributes, Boolean> requestedAttributes,
                                     EidasRequestSectorType sectorType,
                                     EidasNameIdType nameIdPolicy,
                                     EidasLoA loa); static EidasRequest parseRequest(InputStream is); static EidasRequest parseRequest(InputStream is, List<X509Certificate> authors); static void verifyRequest(EidasRequest request, List<X509Certificate> authors); static byte[] createResponse(List<EidasAttribute> att,
                                      String destination,
                                      String recipient,
                                      EidasNameId nameid,
                                      String issuer,
                                      EidasLoA loa,
                                      String inResponseTo,
                                      EidasEncrypter encrypter,
                                      EidasSigner signer); static EidasResponse parseResponse(InputStream is,
                                            X509KeyPair[] decryptionKeyPairs,
                                            X509Certificate[] signatureAuthors); static byte[] createMetaDataService(String id,
                                             String entityId,
                                             Date validUntil,
                                             X509Certificate sigCert,
                                             X509Certificate encCert,
                                             EidasOrganisation organisation,
                                             EidasContactPerson technicalcontact,
                                             EidasContactPerson supportContact,
                                             String postEndpoint,
                                             String redirectEndpoint,
                                             List<EidasNameIdType> supportedNameIdTypes,
                                             List<EidasPersonAttributes> attributes,
                                             EidasSigner signer,
                                             String middlewareVersion,
                                             boolean doSign,
                                             boolean requesterIdFlag); static byte[] createMetaDataNode(String id,
                                          String entityId,
                                          Date validUntil,
                                          X509Certificate sigCert,
                                          X509Certificate encCert,
                                          EidasOrganisation organisation,
                                          EidasContactPerson techcontact,
                                          EidasContactPerson supportcontact,
                                          String postEndpoint,
                                          EidasRequestSectorType spType,
                                          List<EidasNameIdType> supportedNameIdTypes,
                                          EidasSigner signer); static EidasMetadataNode parseMetaDataNode(InputStream is, X509Certificate signer); static void validateXMLRequest(InputStream is, boolean resetStreamAfterValidation);  }