Skip to content

Commit

Permalink
Merge branch 'master' into snyk-fix-9449139bd650e025892e98432b92cede
Browse files Browse the repository at this point in the history
  • Loading branch information
johanlundberg authored Oct 16, 2024
2 parents 1c71933 + 15dd248 commit 972dbb6
Show file tree
Hide file tree
Showing 18 changed files with 1,147 additions and 1,002 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
java-version: [8]
java-version: [11]

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
FROM openjdk:8-jre
# Debian stable no longer has openjdk-8-jre available
# As there is no packages anymore it is probably better
# to use a Docker Hub image to get any security patches
FROM openjdk:11-jre

MAINTAINER eduid-dev <eduid-dev@SEGATE.SUNET.SE>

Expand Down
2 changes: 1 addition & 1 deletion docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ chmod 640 "${navet_properties}" || true
echo "$0: Starting JAR ${navet_jar_file} (properties file: ${navet_properties})"
exec start-stop-daemon --start --quiet -c eduid:eduid \
--pidfile "${state_dir}/${eduid_name}.pid" --make-pidfile \
--exec /usr/local/openjdk-8/bin/java -- -jar ${navet_jar_file} -c ${navet_properties}
--exec /usr/local/openjdk-11/bin/java -- -jar ${navet_jar_file} -c ${navet_properties}
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<properties>
<project.builder.sourceEncoding>UTF-8</project.builder.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jetty.version>10.0.10</jetty.version>
<jetty.version>10.0.24</jetty.version>
<cxf.version>3.5.5</cxf.version>
<sl4j.version>1.7.33</sl4j.version>
<sl4j.version>1.7.36</sl4j.version>
<jersey.version>2.34</jersey.version>
</properties>

Expand Down Expand Up @@ -71,7 +71,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.1.1-jre</version>
<version>32.0.0-jre</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
Expand All @@ -91,7 +91,7 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.10.0</version>
<version>2.14.0</version>
</dependency>

<!-- Dependencies for the RESTful service API -->
Expand Down Expand Up @@ -229,15 +229,15 @@

</plugins>

<!-- Build with Java 1.8 -->
<!-- Build with Java 1.11 -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
Expand Down
46 changes: 39 additions & 7 deletions src/main/java/se/sunet/navet/service/api/NavetNotification.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ public Response(ResponseXMLTYPE data) {
// PersonPost
PersonpostTYPE personPost = post.getPersonpost();
PopulationItem.PersonItem.setAll(personPost);
// Sekretessmarkering
if (post.getSekretessmarkering() != null) {
PopulationItem.SecrecyMark = post.getSekretessmarkering().getValue().toString();
}
// SkyddadFolkbokforing
if (post.getSkyddadFolkbokforing() != null) {
PopulationItem.ProtectedPopulationRegistration = post.getSkyddadFolkbokforing().getValue().toString();
}

// Add more data?
/*
personPost.getCivilstand();
Expand All @@ -88,6 +97,8 @@ public Response(ResponseXMLTYPE data) {
public static class PopulationItem {

private CaseInformation CaseInformation = new CaseInformation();
private String SecrecyMark = "";
private String ProtectedPopulationRegistration = "";
private PersonItem PersonItem = new PersonItem();

public static class CaseInformation {
Expand Down Expand Up @@ -213,6 +224,7 @@ public static class Name {
private String GivenName;
private String MiddleName;
private String Surname;
private String NotificationName;

public void setAll(NamnTYPE name) {
// GivenNameMarking
Expand All @@ -221,21 +233,26 @@ public void setAll(NamnTYPE name) {
this.setGivenNameMarking(givenNameMarkingElement.getValue());
}
// GivenName
JAXBElement<NamnTYPE.Fornamn> givenNameElement = name.getFornamn();
JAXBElement<String> givenNameElement = name.getFornamn();
if (givenNameElement != null) {
this.setGivenName(givenNameElement.getValue().getValue());
this.setGivenName(givenNameElement.getValue());
}
// MiddleName
JAXBElement<NamnTYPE.Mellannamn> middleNameElement = name.getMellannamn();
JAXBElement<String> middleNameElement = name.getMellannamn();
if (middleNameElement != null) {
this.setMiddleName(middleNameElement.getValue().getValue());
this.setMiddleName(middleNameElement.getValue());
}
// Surname
JAXBElement<NamnTYPE.Efternamn> surNameElement = name.getEfternamn();
JAXBElement<String> surNameElement = name.getEfternamn();
if (surNameElement != null) {
this.setSurname(surNameElement.getValue().getValue());
this.setSurname(surNameElement.getValue());
}
// NotificationName
// created by SKV to be maximum 36 characters long
JAXBElement<String> notificationNameElement = name.getAviseringsnamn();
if (notificationNameElement != null) {
this.setNotificationName(notificationNameElement.getValue());
}

}

public String getGivenNameMarking() {
Expand Down Expand Up @@ -269,6 +286,14 @@ public String getSurname() {
public void setSurname(String surname) {
Surname = surname;
}

public String getNotificationName() {
return NotificationName;
}

public void setNotificationName(String notificationName) {
NotificationName = notificationName;
}
}

public static class PostalAddresses {
Expand Down Expand Up @@ -514,6 +539,13 @@ public PopulationItem.CaseInformation getCaseInformation() {
public void setCaseInformation(PopulationItem.CaseInformation caseInformation) {
CaseInformation = caseInformation;
}
public String getSecrecyMark () {
return SecrecyMark;
}

public String ProtectedPopulationRegistration () {
return ProtectedPopulationRegistration;
}

public PopulationItem.PersonItem getPersonItem() {
return PersonItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import org.apache.cxf.transport.http.HTTPConduit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se.skatteverket.folkbokforing.na.namnsokningxml.v2.NamnsokningXMLInterface;
import se.skatteverket.folkbokforing.na.namnsokningxml.v2.NamnsokningXMLService;
import se.skatteverket.folkbokforing.na.namnsokningxml.v2.NaWebServiceException;
import se.skatteverket.folkbokforing.na.namnsokningxml.v4.NamnsokningXMLInterface;
import se.skatteverket.folkbokforing.na.namnsokningxml.v4.NamnsokningXMLService;
import se.skatteverket.folkbokforing.na.namnsokningxml.v4.NaWebServiceException;
import se.skatteverket.xmls.se.skatteverket.folkbokforing.na.epersondata.v1.*;

import javax.net.ssl.KeyManager;
Expand All @@ -32,7 +32,7 @@ public class NamnsokningService {
private String organisationNumber;
private String orderId;
private String wsBaseEndpoint;
private static String serviceName = "V2/namnsokningXML";
private static String serviceName = "namnsokningXML";

public NamnsokningService(String wsBaseEndpoint, String orgNum, String orderId) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, IOException {
this.wsBaseEndpoint = wsBaseEndpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import org.apache.cxf.transport.http.HTTPConduit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se.skatteverket.folkbokforing.na.personpostxml.v2.NaWebServiceException;
import se.skatteverket.folkbokforing.na.personpostxml.v2.PersonpostXMLService;
import se.skatteverket.folkbokforing.na.personpostxml.v2.PersonpostXMLInterface;
import se.skatteverket.folkbokforing.na.personpostxml.v4.NaWebServiceException;
import se.skatteverket.folkbokforing.na.personpostxml.v4.PersonpostXMLService;
import se.skatteverket.folkbokforing.na.personpostxml.v4.PersonpostXMLInterface;
import se.skatteverket.xmls.se.skatteverket.folkbokforing.na.epersondata.v1.BestallningTYPE;
import se.skatteverket.xmls.se.skatteverket.folkbokforing.na.epersondata.v1.PersonpostRequestTYPE;
import se.skatteverket.xmls.se.skatteverket.folkbokforing.na.epersondata.v1.ResponseXMLTYPE;
Expand Down Expand Up @@ -35,7 +35,7 @@ public class PersonPostService {
private String organisationNumber;
private String orderId;
private String wsBaseEndpoint;
private static String serviceName = "V2/personpostXML";
private static String serviceName = "personpostXML";

public PersonPostService(String wsBaseEndpoint, String orgNum, String orderId) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, IOException {
this.wsBaseEndpoint = wsBaseEndpoint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ private ServletContextHandler getServletContext(String packagesLocation, String
return context;
}

private SslContextFactory getSslContextFactory(String keyStorePath, String keyStorePassword, String keyManagerPassword) {
SslContextFactory sslContextFactory = new SslContextFactory();
private SslContextFactory.Server getSslContextFactory(String keyStorePath, String keyStorePassword, String keyManagerPassword) {
SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
sslContextFactory.setKeyStorePath(keyStorePath);
sslContextFactory.setKeyStorePassword(keyStorePassword);
sslContextFactory.setKeyManagerPassword(keyManagerPassword);
return sslContextFactory;
}

private void configureSslServer(String host, Integer port, SslContextFactory sslContextFactory) {
private void configureSslServer(String host, Integer port, SslContextFactory.Server sslContextFactory) {
HttpConfiguration https_config = new HttpConfiguration();
https_config.setSecureScheme("https");
https_config.setSecurePort(port);
Expand Down Expand Up @@ -147,7 +147,7 @@ public void setup(String configFile) throws Exception {
String jettyKeyStorePath = prop.getProperty("jettyKeyStorePath");
String jettyKeyStorePassword = prop.getProperty("jettyKeyStorePassword");
String jettyKeyManagerPassword = prop.getProperty("jettyKeyManagerPassword");
SslContextFactory sslContextFactory = getSslContextFactory(jettyKeyStorePath, jettyKeyStorePassword, jettyKeyManagerPassword);
SslContextFactory.Server sslContextFactory = getSslContextFactory(jettyKeyStorePath, jettyKeyStorePassword, jettyKeyManagerPassword);
configureSslServer(host, port, sslContextFactory);
}
}
Expand Down
23 changes: 15 additions & 8 deletions src/main/resources/META-INF/wsdl/namnsokningXML.wsdl
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:impl="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v2" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:na="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1" targetNamespace="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v2">
<wsdl:documentation>Version 2.0</wsdl:documentation>
<wsdl:definitions
targetNamespace="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v4"
xmlns:impl="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v4"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:na="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1">
<wsdl:documentation>Version 4.0</wsdl:documentation>
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v2">
<xsd:import schemaLocation="schema/Epersondata.xsd" namespace="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1"/>
<xsd:schema targetNamespace="http://www.skatteverket.se/folkbokforing/na/namnsokningXML/v4" xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:import
schemaLocation="schema/Epersondata.xsd" namespace="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getDataRequest">
Expand All @@ -19,15 +26,15 @@
<wsdl:operation name="getData">
<wsdl:input message="impl:getDataRequest" name="getDataRequest"/>
<wsdl:output message="impl:getDataResponse" name="getDataResponse"/>
<wsdl:fault message="impl:NaWebServiceException" name="NaWebServiceException"/>
<wsdl:fault message="impl:NaWebServiceException" name="NaWebServiceException" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="NamnsokningXMLSoapBinding" type="impl:NamnsokningXMLInterface">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getData">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getDataRequest">
<wsdlsoap:body use="literal" parts="parameters"/>
<wsdlsoap:body use="literal" parts="parameters"/>
</wsdl:input>
<wsdl:output name="getDataResponse">
<wsdlsoap:body use="literal" parts="parameters"/>
Expand All @@ -39,7 +46,7 @@
</wsdl:binding>
<wsdl:service name="NamnsokningXMLService">
<wsdl:port binding="impl:NamnsokningXMLSoapBinding" name="namnsokningXML">
<wsdlsoap:address location="https://www2.skatteverket.se/na/na_epersondata/V2/namnsokningXML"/>
<wsdlsoap:address location="https://www2.skatteverket.se/na/na_epersondata/V4/namnsokningXML"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
</wsdl:definitions>
23 changes: 15 additions & 8 deletions src/main/resources/META-INF/wsdl/personpostXML.wsdl
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:impl="http://www.skatteverket.se/folkbokforing/na/personpostXML/v2" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:na="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1" targetNamespace="http://www.skatteverket.se/folkbokforing/na/personpostXML/v2">
<wsdl:documentation>Version 2.0</wsdl:documentation>
<wsdl:definitions
targetNamespace="http://www.skatteverket.se/folkbokforing/na/personpostXML/v4"
xmlns:impl="http://www.skatteverket.se/folkbokforing/na/personpostXML/v4"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:na="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1">
<wsdl:documentation>Version 4.0</wsdl:documentation>
<wsdl:types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.skatteverket.se/folkbokforing/na/personpostXML/v2">
<xsd:import schemaLocation="schema/Epersondata.xsd" namespace="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1"/>
<xsd:schema targetNamespace="http://www.skatteverket.se/folkbokforing/na/personpostXML/v4" xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:import
schemaLocation="schema/Epersondata.xsd" namespace="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getDataRequest">
Expand All @@ -19,15 +26,15 @@
<wsdl:operation name="getData">
<wsdl:input message="impl:getDataRequest" name="getDataRequest"/>
<wsdl:output message="impl:getDataResponse" name="getDataResponse"/>
<wsdl:fault message="impl:NaWebServiceException" name="NaWebServiceException"/>
<wsdl:fault message="impl:NaWebServiceException" name="NaWebServiceException" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PersonpostXMLSoapBinding" type="impl:PersonpostXMLInterface">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getData">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getDataRequest">
<wsdlsoap:body use="literal" parts="parameters"/>
<wsdlsoap:body use="literal" parts="parameters"/>
</wsdl:input>
<wsdl:output name="getDataResponse">
<wsdlsoap:body use="literal" parts="parameters"/>
Expand All @@ -39,7 +46,7 @@
</wsdl:binding>
<wsdl:service name="PersonpostXMLService">
<wsdl:port binding="impl:PersonpostXMLSoapBinding" name="personpostXML">
<wsdlsoap:address location="https://www2.skatteverket.se/na/na_epersondata/V2/personpostXML"/>
<wsdlsoap:address location="https://www2.skatteverket.se/na/na_epersondata/V4/personpostXML"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
</wsdl:definitions>
17 changes: 14 additions & 3 deletions src/main/resources/META-INF/wsdl/schema/Epersondata.xsd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- version: na_webservices_xmls.7_2.28 -->
<xs:schema targetNamespace="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1" elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:tns="http://xmls.skatteverket.se/se/skatteverket/folkbokforing/na/epersondata/V1"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
Expand Down Expand Up @@ -104,6 +105,7 @@ version="1.0">
<xs:element name="PostnummerFrom" type="tns:PostNrDelTYPE" nillable="true"/>
<xs:element name="PostnummerTom" type="tns:PostNrDelTYPE" nillable="true"/>
<xs:element name="Postort" type="tns:Strang27TYPE" nillable="true"/>
<xs:element name="Kategori" type="tns:KategoriTYPE" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

Expand All @@ -128,11 +130,10 @@ version="1.0">

<xs:simpleType name="FodelsetidDelTYPE">
<xs:annotation>
<xs:documentation>Inledande del av födelsetid, max 8 tkn, datatyp = number</xs:documentation>
<xs:documentation>Inledande del av födelsetid, 8 tkn, datatyp = number</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:integer">
<xs:minInclusive value = "1" />
<xs:maxInclusive value = "99999999" />
<xs:pattern value="([0-9]{4})(0[1-9]|1[012])([0-2][0-9]|3[0-1]|[6-8][0-9]|9[0-1])"/>
</xs:restriction>
</xs:simpleType>

Expand Down Expand Up @@ -164,4 +165,14 @@ version="1.0">
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="KategoriTYPE">
<xs:annotation>
<xs:documentation>Kategorivillkor, sträng med 2 tecken. "AL" för alla (standard), "FB" för Folkbokförda.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="AL"/>
<xs:enumeration value="FB"/>
</xs:restriction>
</xs:simpleType>

</xs:schema>
Loading

0 comments on commit 972dbb6

Please sign in to comment.