aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
Diffstat (limited to 'id')
-rw-r--r--id/ConfigWebTool/pom.xml11
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/EncodingFilter.java123
-rw-r--r--id/ConfigWebTool/src/main/resources/struts.xml26
-rw-r--r--id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml2
-rw-r--r--id/server/data/deploy/conf/moa-id-configuration/moa-id-configtool.properties2
-rw-r--r--id/server/doc/handbook/config/config.html6
-rw-r--r--id/server/idserverlib/pom.xml1
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java8
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/ParamValidatorUtils.java4
-rw-r--r--id/server/stork2-commons/pom.xml4
-rw-r--r--id/server/stork2-commons/src/test/java/eu/stork/peps/tests/ComplexAttributesMarshalling.java15
11 files changed, 188 insertions, 14 deletions
diff --git a/id/ConfigWebTool/pom.xml b/id/ConfigWebTool/pom.xml
index 7154cc2bb..36fe03457 100644
--- a/id/ConfigWebTool/pom.xml
+++ b/id/ConfigWebTool/pom.xml
@@ -69,7 +69,6 @@
<dependency>
<groupId>MOA.id.server</groupId>
<artifactId>moa-id-commons</artifactId>
- <version>2.0.1</version>
</dependency>
<dependency>
<groupId>MOA.id.server</groupId>
@@ -140,11 +139,17 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
- <dependency>
+<!-- <dependency>
<groupId>iaik</groupId>
<artifactId>commons-iaik</artifactId>
<version>0.7.1</version>
- </dependency>
+ <exclusions>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency> -->
</dependencies>
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/EncodingFilter.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/EncodingFilter.java
new file mode 100644
index 000000000..71f9536ae
--- /dev/null
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/filter/EncodingFilter.java
@@ -0,0 +1,123 @@
+package at.gv.egovernment.moa.id.configuration.filter;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:thomas.knall@iaik.tugraz.at">Thomas Knall</a>
+ */
+public class EncodingFilter implements javax.servlet.Filter {
+
+ private static final String SERVLET_INIT_PARAM_ENCODING = "encoding";
+
+ private static final String SERVLET_INIT_PARAM_SET_REQUEST_ENCODING = "setRequestEncoding";
+ private static final String SERVLET_INIT_PARAM_FORCE_REQUEST_ENCODING = "forceRequestEncoding";
+
+ private static final String SERVLET_INIT_PARAM_SET_RESPONSE_ENCODING = "setResponseEncoding";
+ private static final String SERVLET_INIT_PARAM_FORCE_RESPONSE_ENCODING = "forceResponseEncoding";
+
+ private static final boolean DEFAULT_SET_REQUEST_ENCODING_VALUE = true;
+ private static final boolean DEFAULT_FORCE_REQUEST_ENCODING_VALUE = true;
+ private static final boolean DEFAULT_SET_RESPONSE_ENCODING_VALUE = false;
+ private static final boolean DEFAULT_FORCE_RESPONSE_ENCODING_VALUE = false;
+
+ private Logger log = Logger.getLogger(getClass().getName());
+
+ private String encoding = null;
+
+ private boolean setRequestEncoding;
+ private boolean forceRequestEncoding;
+
+ private boolean setResponseEncoding;
+ private boolean forceResponseEncoding;
+
+ private boolean enabled = false;
+
+ private boolean parseBooleanInitParameter(final FilterConfig filterConfig, String parameterName, boolean defaultValue) {
+ String paramValue = filterConfig.getInitParameter(parameterName);
+ if (paramValue == null) {
+ return defaultValue;
+ }
+ paramValue = paramValue.trim();
+ if (paramValue.equalsIgnoreCase("true")) {
+ return true;
+ } else if (paramValue.equalsIgnoreCase("false")){
+ return false;
+ } else {
+ log.warn("Unknown value \"" + paramValue + "\" for init parameter \"" + parameterName + "\" detected. Should be \"true\" or \"false\". Using default value \"" + defaultValue + "\".");
+ return defaultValue;
+ }
+ }
+
+ public void init(final FilterConfig filterConfig) throws ServletException {
+ log.debug("Initializing encoding filter (" + getClass().getName() + ").");
+
+ // mandatory parameter encoding
+ String desiredEncoding = filterConfig.getInitParameter(SERVLET_INIT_PARAM_ENCODING);
+ if (StringUtils.isEmpty(desiredEncoding)) {
+ log.warn("Unable to initialize encoding filter (" + getClass().getName() + "). Init parameter \"" + SERVLET_INIT_PARAM_ENCODING + "\" empty or not supplied.");
+ } else if (!Charset.isSupported(desiredEncoding)) {
+ log.warn("Unable to initialize encoding filter (" + getClass().getName() + "). Encoding \"" + desiredEncoding + "\" is not supported.");
+ } else {
+ this.encoding = desiredEncoding;
+ this.enabled = true;
+ this.setRequestEncoding = this.parseBooleanInitParameter(filterConfig, SERVLET_INIT_PARAM_SET_REQUEST_ENCODING, DEFAULT_SET_REQUEST_ENCODING_VALUE);
+ this.forceRequestEncoding = this.parseBooleanInitParameter(filterConfig, SERVLET_INIT_PARAM_FORCE_REQUEST_ENCODING, DEFAULT_FORCE_REQUEST_ENCODING_VALUE);
+ this.setResponseEncoding = this.parseBooleanInitParameter(filterConfig, SERVLET_INIT_PARAM_SET_RESPONSE_ENCODING, DEFAULT_SET_RESPONSE_ENCODING_VALUE);
+ this.forceResponseEncoding = this.parseBooleanInitParameter(filterConfig, SERVLET_INIT_PARAM_FORCE_RESPONSE_ENCODING, DEFAULT_FORCE_RESPONSE_ENCODING_VALUE);
+ log.debug("Encoding filter \"" + getClass().getName() + "\" configured: " + this.toString(true));
+
+ }
+ }
+
+ public String toString(boolean verbose) {
+ if (verbose) {
+ return new ToStringBuilder(this)
+ .append(SERVLET_INIT_PARAM_ENCODING, this.encoding)
+ .append(SERVLET_INIT_PARAM_SET_REQUEST_ENCODING, this.setRequestEncoding)
+ .append(SERVLET_INIT_PARAM_FORCE_REQUEST_ENCODING, this.forceRequestEncoding)
+ .append(SERVLET_INIT_PARAM_SET_RESPONSE_ENCODING, this.setResponseEncoding)
+ .append(SERVLET_INIT_PARAM_FORCE_RESPONSE_ENCODING, this.forceResponseEncoding)
+ .toString();
+ } else {
+ return super.toString();
+ }
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, final FilterChain filterChain) throws IOException, ServletException {
+ if (this.enabled) {
+ if (this.setRequestEncoding) {
+ if (this.forceRequestEncoding) {
+ log.trace("Forcing request encoding \"" + this.encoding + "\".");
+ request.setCharacterEncoding(this.encoding);
+ } else if (request.getCharacterEncoding() == null) {
+ log.trace("Request character encoding not set. Setting to \"" + this.encoding + "\".");
+ request.setCharacterEncoding(this.encoding);
+ }
+ }
+ if (this.setResponseEncoding) {
+ if (this.forceResponseEncoding) {
+ log.trace("Forcing response encoding \"" + this.encoding + "\".");
+ response.setCharacterEncoding(this.encoding);
+ } else if (response.getCharacterEncoding() == null) {
+ log.trace("Response character encoding not set. Setting to \"" + this.encoding + "\".");
+ response.setCharacterEncoding(this.encoding);
+ }
+ }
+ }
+ filterChain.doFilter(request, response);
+ }
+
+ public void destroy() {
+ }
+}
diff --git a/id/ConfigWebTool/src/main/resources/struts.xml b/id/ConfigWebTool/src/main/resources/struts.xml
index 9a098da5a..55490788d 100644
--- a/id/ConfigWebTool/src/main/resources/struts.xml
+++ b/id/ConfigWebTool/src/main/resources/struts.xml
@@ -6,10 +6,23 @@
<struts>
<constant name="struts.custom.i18n.resources" value="webpages" />
+ <constant name="struts.mapper.action.prefix.enabled" value="true" />
+ <constant name="struts.mapper.action.prefix.crossNamespaces" value="false" />
<package name="default" namespace="/" extends="struts-default">
- <default-interceptor-ref name="defaultStack"/>
+
+
+ <interceptors>
+ <interceptor-stack name="OwnStack">
+ <interceptor-ref name="defaultStack" />
+ <interceptor-ref name="params">
+ <param
+ name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.*</param>
+ </interceptor-ref>
+ </interceptor-stack>
+ </interceptors>
+ <default-interceptor-ref name="OwnStack"/>
<action name="index" method="start" class="at.gv.egovernment.moa.id.configuration.struts.action.IndexAction">
<result name="success">/index.jsp</result>
@@ -69,7 +82,16 @@
<package name="secure" namespace="/secure" extends="struts-default">
- <default-interceptor-ref name="defaultStack"/>
+ <interceptors>
+ <interceptor-stack name="OwnStack">
+ <interceptor-ref name="defaultStack" />
+ <interceptor-ref name="params">
+ <param
+ name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.*</param>
+ </interceptor-ref>
+ </interceptor-stack>
+ </interceptors>
+ <default-interceptor-ref name="OwnStack"/>
<action name="index">
<result type="redirectAction">
diff --git a/id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml b/id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml
index a44cf8ce5..b55e97f23 100644
--- a/id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml
+++ b/id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml
@@ -46,7 +46,7 @@
<filter>
<filter-name>EncodingFilter</filter-name>
- <filter-class>at.iaik.commons.webapp.filter.encoding.EncodingFilter</filter-class>
+ <filter-class>at.gv.egovernment.moa.id.configuration.filter.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
diff --git a/id/server/data/deploy/conf/moa-id-configuration/moa-id-configtool.properties b/id/server/data/deploy/conf/moa-id-configuration/moa-id-configtool.properties
index 2bb9cb005..05b5fbdef 100644
--- a/id/server/data/deploy/conf/moa-id-configuration/moa-id-configtool.properties
+++ b/id/server/data/deploy/conf/moa-id-configuration/moa-id-configtool.properties
@@ -2,6 +2,8 @@
general.login.deaktivate=false
general.publicURLContext=https://localhost:8443/moa-id-configuration
+general.defaultlanguage=de
+
##Mail
general.mail.host=smtp.localhost...
#general.mail.host.port=
diff --git a/id/server/doc/handbook/config/config.html b/id/server/doc/handbook/config/config.html
index c704e85d1..ddbe1ac37 100644
--- a/id/server/doc/handbook/config/config.html
+++ b/id/server/doc/handbook/config/config.html
@@ -200,6 +200,12 @@
<td>Public URL Prefix unter dem die zu konfigurierende MOA-ID-Auth Instanz erreichbar ist</td>
</tr>
<tr>
+ <td>general.defaultlanguage</td>
+ <td>de, en</td>
+ <td><p>Hiermit kann die Sprache, welche f&uuml;r die Darstellung der Texte verwendet wird, festgelegt werden.</p>
+ <p><strong>Hinweis</strong>: Aktuell wird nur Deutsch (de) oder Englisch (en) unterst&uuml;tzt.</p></td>
+ </tr>
+ <tr>
<td>general.userrequests.cleanup.delay</td>
<td>18</td>
<td>Innerhalb dieses Zeitraums muss ein neuer Benutzer die im Benutzerprofil hinterlegte eMail Adresse validieren. </td>
diff --git a/id/server/idserverlib/pom.xml b/id/server/idserverlib/pom.xml
index ae4c57fc8..285a5da9c 100644
--- a/id/server/idserverlib/pom.xml
+++ b/id/server/idserverlib/pom.xml
@@ -34,7 +34,6 @@
<dependency>
<groupId>MOA.id.server</groupId>
<artifactId>moa-id-commons</artifactId>
- <version>${pom.version}</version>
</dependency>
<!-- <dependency>
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java
index 6517325b9..11e280d8f 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/binding/PostBinding.java
@@ -122,7 +122,13 @@ public class PostBinding implements IDecoder, IEncoder {
MOARequest request = new MOARequest(inboundMessage);
request.setVerified(false);
- request.setEntityID(messageContext.getPeerEntityMetadata().getEntityID());
+
+ if (messageContext.getPeerEntityMetadata() != null)
+ request.setEntityID(messageContext.getPeerEntityMetadata().getEntityID());
+
+ else
+ Logger.info("No Metadata found for OA with EntityID " + inboundMessage.getIssuer().getValue());
+
request.setRelayState(messageContext.getRelayState());
return request;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/ParamValidatorUtils.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/ParamValidatorUtils.java
index 0cb11cf5f..5eb55317a 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/ParamValidatorUtils.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/ParamValidatorUtils.java
@@ -232,8 +232,8 @@ public class ParamValidatorUtils implements MOAIDAuthConstants{
return true;
}
else {
- Logger.error("Fehler Ueberpruefung Parameter bkuURI. bkuURI ist nicht auf Liste der vertrauenswuerdigen BKUs (Konfigurationselement: MOA-IDConfiguration/TrustedBKUs)");
- Logger.error("Ueberpruefte bkuURI: " + bkuURI);
+ Logger.error("Fehler Ueberpruefung Parameter bkuURI. "
+ + bkuURI + " ist nicht auf Liste der vertrauenswuerdigen BKUs (Konfigurationselement: MOA-IDConfiguration/TrustedBKUs)");
return false;
}
}
diff --git a/id/server/stork2-commons/pom.xml b/id/server/stork2-commons/pom.xml
index b13035307..c1dd27924 100644
--- a/id/server/stork2-commons/pom.xml
+++ b/id/server/stork2-commons/pom.xml
@@ -122,8 +122,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
- <source>1.7</source>
- <target>1.7</target>
+ <source>1.6</source>
+ <target>1.6</target>
</configuration>
</plugin>
<plugin>
diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/ComplexAttributesMarshalling.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/ComplexAttributesMarshalling.java
index c7e195fa6..d411a2f42 100644
--- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/ComplexAttributesMarshalling.java
+++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/ComplexAttributesMarshalling.java
@@ -88,10 +88,15 @@ public class ComplexAttributesMarshalling {
m.marshal(objf.createCanonicalResidenceAddress(object), new FileOutputStream("CanonicalAddressType.xml"));
m.marshal(objf.createCanonicalResidenceAddress(object), System.out);
}
- catch (JAXBException | FileNotFoundException e)
+ catch (JAXBException e )
{
e.printStackTrace();
+
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+
}
+
}
/**
@@ -156,8 +161,14 @@ public class ComplexAttributesMarshalling {
m.marshal(o.createHasAccountInBank(object), new FileOutputStream ("hasbankaccount.xml"));
m.marshal(o.createHasAccountInBank(object), System.out);
- } catch (JAXBException | FileNotFoundException e) {
+ }
+ catch (JAXBException e )
+ {
+ e.printStackTrace();
+
+ } catch (FileNotFoundException e) {
e.printStackTrace();
+
}
}
/**