aboutsummaryrefslogtreecommitdiff
path: root/id.server/src/at/gv/egovernment/moa/id/proxy
diff options
context:
space:
mode:
Diffstat (limited to 'id.server/src/at/gv/egovernment/moa/id/proxy')
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/ConnectionBuilderFactory.java2
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/DefaultConnectionBuilder.java1
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/DefaultLoginParameterResolver.java7
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolver.java63
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolverException.java37
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolverFactory.java17
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolver.java481
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ConfigurationServlet.java9
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java14
9 files changed, 594 insertions, 37 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/ConnectionBuilderFactory.java b/id.server/src/at/gv/egovernment/moa/id/proxy/ConnectionBuilderFactory.java
index 7a6c3e575..ff7787839 100644
--- a/id.server/src/at/gv/egovernment/moa/id/proxy/ConnectionBuilderFactory.java
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/ConnectionBuilderFactory.java
@@ -4,8 +4,8 @@ import java.util.HashMap;
import java.util.Map;
import at.gv.egovernment.moa.id.config.ConfigurationException;
-import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider;
import at.gv.egovernment.moa.id.config.proxy.OAProxyParameter;
+import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider;
/**
* Factory delivering a {@link ConnectionBuilder} implementation for
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/DefaultConnectionBuilder.java b/id.server/src/at/gv/egovernment/moa/id/proxy/DefaultConnectionBuilder.java
index 48e21f673..2ac8fe28e 100644
--- a/id.server/src/at/gv/egovernment/moa/id/proxy/DefaultConnectionBuilder.java
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/DefaultConnectionBuilder.java
@@ -36,6 +36,7 @@ public class DefaultConnectionBuilder implements ConnectionBuilder {
disableHostnameVerification = BoolUtils.valueOf(
ProxyConfigurationProvider.getInstance().getGenericConfigurationParameter(
"ProxyComponent.DisableHostnameVerification"));
+ //TODO undocumented feature
if (disableHostnameVerification)
Logger.warn("ProxyComponent.DisableHostnameVerification: " + disableHostnameVerification);
}
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/DefaultLoginParameterResolver.java b/id.server/src/at/gv/egovernment/moa/id/proxy/DefaultLoginParameterResolver.java
index db3c452bc..033a74934 100644
--- a/id.server/src/at/gv/egovernment/moa/id/proxy/DefaultLoginParameterResolver.java
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/DefaultLoginParameterResolver.java
@@ -21,6 +21,13 @@ public class DefaultLoginParameterResolver implements LoginParameterResolver {
*/
public DefaultLoginParameterResolver() {
}
+
+ /**
+ * Configuration mehtod (not used)
+ */
+ public void configure(String configuration) throws LoginParameterResolverException {
+ }
+
/**
* @see at.gv.egovernment.moa.id.proxy.LoginParameterResolver#getAuthenticationHeaders(at.gv.egovernment.moa.id.config.proxy.OAConfiguration, at.gv.egovernment.moa.id.auth.data.AuthenticationData, java.lang.String)
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolver.java b/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolver.java
index 497176a96..434a4f674 100644
--- a/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolver.java
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolver.java
@@ -14,33 +14,34 @@ import at.gv.egovernment.moa.id.data.AuthenticationData;
* @version $Id$
*/
public interface LoginParameterResolver {
-
- /** Constants used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code>,
- * naming predicates used by the <code>LoginParameterResolver</code>. */
- public static final String MOAGivenName = "MOAGivenName";
- /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
- public static final String MOAFamilyName = "MOAFamilyName";
- /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
- public static final String MOADateOfBirth = "MOADateOfBirth";
- /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
- public static final String MOAVPK = "MOAVPK";
- /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
- public static final String MOAPublicAuthority = "MOAPublicAuthority";
- /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
- public static final String MOABKZ = "MOABKZ";
- /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
- public static final String MOAQualifiedCertificate = "MOAQualifiedCertificate";
- /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
- public static final String MOAZMRZahl = "MOAZMRZahl";
- /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
- public static final String MOAIPAddress = "MOAIPAddress";
-
+
+ /** Constants used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code>,
+ * naming predicates used by the <code>LoginParameterResolver</code>. */
+ public static final String MOAGivenName = "MOAGivenName";
+ /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
+ public static final String MOAFamilyName = "MOAFamilyName";
+ /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
+ public static final String MOADateOfBirth = "MOADateOfBirth";
+ /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
+ public static final String MOAVPK = "MOAVPK";
+ /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
+ public static final String MOAPublicAuthority = "MOAPublicAuthority";
+ /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
+ public static final String MOABKZ = "MOABKZ";
+ /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
+ public static final String MOAQualifiedCertificate =
+ "MOAQualifiedCertificate";
+ /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
+ public static final String MOAZMRZahl = "MOAZMRZahl";
+ /** Constant used in <code>MOAIDConfiguration-1.1.xsd</code>, type <code>MOAAuthDataType</code> */
+ public static final String MOAIPAddress = "MOAIPAddress";
+
/**
* Returns authentication headers to be added to a URLConnection.
*
* @param oaConf configuration data
* @param authData authentication data
- * @param clientIPAddress client IP address
+ * @param clientIPAddress client IP address
* @return A map, the keys being header names and values being corresponding header values.
* <br>In case of authentication type <code>"basic-auth"</code>, header fields
* <code>username</code> and <code>password</code>.
@@ -48,25 +49,27 @@ public interface LoginParameterResolver {
* derived from parameter mapping and authentication data provided.
* <br>Otherwise, an empty map.
*/
- public Map getAuthenticationHeaders (
+ public Map getAuthenticationHeaders(
OAConfiguration oaConf,
AuthenticationData authData,
- String clientIPAddress);
-
+ String clientIPAddress) throws LoginParameterResolverException;
+
/**
* Returns request parameters to be added to a URLConnection.
*
* @param oaConf configuration data
* @param authData authentication data
- * @param clientIPAddress client IP address
+ * @param clientIPAddress client IP address
* @return A map, the keys being parameter names and values being corresponding parameter values.
* <br>In case of authentication type <code>"param-auth"</code>, parameters
* derived from parameter mapping and authentication data provided.
* <br>Otherwise, an empty map.
*/
- public Map getAuthenticationParameters (
- OAConfiguration oaConf,
- AuthenticationData authData,
- String clientIPAddress);
+ public Map getAuthenticationParameters(
+ OAConfiguration oaConf,
+ AuthenticationData authData,
+ String clientIPAddress) throws LoginParameterResolverException;
+
+ public void configure(String configuration) throws LoginParameterResolverException;
}
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolverException.java b/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolverException.java
new file mode 100644
index 000000000..3aa2368bf
--- /dev/null
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolverException.java
@@ -0,0 +1,37 @@
+package at.gv.egovernment.moa.id.proxy;
+
+import at.gv.egovernment.moa.id.MOAIDException;
+
+/**
+ * Exception thrown while proxying a request to the online application
+ *
+ * @author Rudolf Schamberger
+ * @version $Id$
+ */
+public class LoginParameterResolverException extends MOAIDException {
+
+ /**
+ * Constructor for LoginParameterResolverException.
+ * @param messageId
+ * @param parameters
+ */
+ public LoginParameterResolverException(
+ String messageId,
+ Object[] parameters) {
+ super(messageId, parameters);
+ }
+
+ /**
+ * Constructor for LoginParameterResolverException.
+ * @param messageId
+ * @param parameters
+ * @param wrapped
+ */
+ public LoginParameterResolverException(
+ String messageId,
+ Object[] parameters,
+ Throwable wrapped) {
+ super(messageId, parameters, wrapped);
+ }
+
+}
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolverFactory.java b/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolverFactory.java
index 2ab245923..0db7f66fe 100644
--- a/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolverFactory.java
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/LoginParameterResolverFactory.java
@@ -1,11 +1,12 @@
package at.gv.egovernment.moa.id.proxy;
+import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import at.gv.egovernment.moa.id.config.ConfigurationException;
-import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider;
import at.gv.egovernment.moa.id.config.proxy.OAProxyParameter;
+import at.gv.egovernment.moa.id.config.proxy.ProxyConfigurationProvider;
/**
* Factory delivering a {@link LoginParameterResolver} implementation for
@@ -39,11 +40,25 @@ public class LoginParameterResolverFactory {
OAProxyParameter oaParam = proxyConf.getOnlineApplicationParameters()[i];
String publicURLPrefix = oaParam.getPublicURLPrefix();
String className = oaParam.getLoginParameterResolverImpl();
+ String configuration = oaParam.getLoginParameterResolverConfiguration();
+
if (className != null) {
try {
+ Class lprClass = Class.forName(className);
LoginParameterResolver lpr = (LoginParameterResolver)Class.forName(className).newInstance();
+
+ Class[] argumentTypes = { String.class };
+ Method confMethod = lprClass.getMethod( "configure", argumentTypes );
+
+ Object[] arguments = { new String(configuration) };
+ confMethod.invoke( lpr, arguments );
+
+ lpr.configure(configuration);
loginParameterResolverMap.put(publicURLPrefix, lpr);
}
+ catch (LoginParameterResolverException lpex) {
+ throw new ConfigurationException("config.11", new Object[] {className}, lpex);
+ }
catch (Throwable ex) {
throw new ConfigurationException("config.07", new Object[] {publicURLPrefix}, ex);
}
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolver.java b/id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolver.java
new file mode 100644
index 000000000..3f7a6872c
--- /dev/null
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolver.java
@@ -0,0 +1,481 @@
+package at.gv.egovernment.moa.id.proxy;
+
+import java.io.File;
+import at.gv.egovernment.moa.id.config.proxy.OAConfiguration;
+import at.gv.egovernment.moa.id.data.AuthenticationData;
+import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.util.Base64Utils;
+import java.io.IOException;
+import java.util.*;
+//import org.apache.xerces.parsers.AbstractDOMParser;
+import org.apache.xerces.parsers.DOMParser;
+import org.w3c.dom.*;
+
+/**
+ * XMLLoginParameterResolver an implementation of implementation of interface
+ * <code>LoginParameterResolver</code>
+ * This implementation used to map identities stored in an XML file to parameters
+ * which are given to OAs.
+ *
+ * @author Rudolf Schamberger
+ * @version $Id$
+ */
+public class XMLLoginParameterResolver implements LoginParameterResolver {
+
+ //file which is parsed and interpreted for paremeter resolving.
+ private String identityFile;
+
+ /**
+ * inner class used to store mapped parameters
+ */
+ class LPRParams {
+
+ /**
+ * getter method for parameter Enabled.
+ * Parameter Enabled decides if mapped parameters should be used by XMLLoginParameterResolver
+ */
+ public boolean getEnabled() {
+ return enabled.booleanValue();
+ }
+
+ /**
+ * getter method for parameter UN (username)
+ * @return Parameter UN or <code>null</code> not set.
+ */
+ public String getUN() {
+ return UN;
+ }
+
+ /**
+ * getter method for parameter PW (password)
+ * @return Parameter PW or <code>null</code> not set.
+ */
+ public String getPW() {
+ return PW;
+ }
+
+ /**
+ * getter method for parameter Param1
+ * @return Parameter Param1 or <code>null</code> not set.
+ */
+ public String getParam1() {
+ return Param1;
+ }
+
+ /**
+ * getter method for parameter Param2
+ * @return Parameter Param2 or <code>null</code> not set.
+ */
+ public String getParam2() {
+ return Param2;
+ }
+
+ /**
+ * getter method for parameter Param3
+ * @return Parameter Param3 or <code>null</code> not set.
+ */
+ public String getParam3() {
+ return Param3;
+ }
+
+ /**
+ * Returns a string representation of LPRParams
+ *
+ * @return a <code>String</code> representation of this object.
+ * @see XMLLoginParameterResolver.LPRParams
+ */
+ public String toString() {
+ return "Enabled: "
+ + enabled.toString()
+ + "UN: '"
+ + UN
+ + "' PW: '"
+ + PW
+ + "' Param1: '"
+ + Param1
+ + "' Param2: '"
+ + Param2
+ + "' Param3: '"
+ + Param3
+ + "'\n";
+ }
+
+ //private member variables used
+ private Boolean enabled = null;
+ private String UN = null;
+ private String PW = null;
+ private String Param1 = null;
+ private String Param2 = null;
+ private String Param3 = null;
+
+ /**
+ * Constructs a newly allocated <code>XMLLoginParameterResolver.LPRParams</code> object.
+ *
+ * @param enabled enable user mapping to parameter set for the parameter set.
+ * @param UN username used in HTTP 401 - BasicAuthentication
+ * @param PW password used in HTTP 401 - BasicAuthentication
+ * @param Param1 parameter1 used in HeaderAuthentication and ParameterAuthentication
+ * @param Param2 parameter2 used in HeaderAuthentication and ParameterAuthentication
+ * @param Param3 parameter3 used in HeaderAuthentication and ParameterAuthentication
+ **/
+ LPRParams(boolean enabled, String UN, String PW, String Param1, String Param2, String Param3) {
+ this.enabled = new Boolean(enabled);
+ this.UN = UN;
+ this.PW = PW;
+ this.Param1 = Param1;
+ this.Param1 = Param2;
+ this.Param1 = Param3;
+ }
+
+ /**
+ * Constructs a newly allocated <code>XMLLoginParameterResolver.LPRParams</code> object.
+ *
+ * @param enabled enable user mapping to parameter set for the parameter set.
+ * @param UN username used in HTTP 401 - BasicAuthentication
+ * @param PW password used in HTTP 401 - BasicAuthentication
+ **/
+ LPRParams(boolean enabled, String UN, String PW) {
+ this(enabled, UN, PW, null, null, null);
+ }
+ }
+
+ /**
+ * Constructs a newly allocated <code>XMLLoginParameterResolver</code> object.
+ **/
+ public XMLLoginParameterResolver() {
+ bPKMap = new HashMap();
+ namedMap = new HashMap();
+ }
+
+ /**
+ * configuration method
+ * @param configuration enabled enable user mapping to parameter set for the parameter set.
+ */
+ public void configure(String configuration) throws LoginParameterResolverException {
+ File idFile;
+ this.identityFile = configuration;
+
+ try {
+ if (null == identityFile || false == (idFile = new File(identityFile)).canRead()) {
+ Logger.error("XMLLoginParameterResolver could not read '"
+ + identityFile
+ + "' " );
+ return;
+ }
+ Document doc = readXMLFile(identityFile);
+ buildInfo(doc);
+ } catch (Throwable ex) {
+ throw new LoginParameterResolverException("config.11", new Object[] {identityFile}, ex);
+ }
+ isConfigured = true;
+ }
+
+ public Map getAuthenticationHeaders(
+ OAConfiguration oaConf,
+ AuthenticationData authData,
+ String clientIPAddress) throws LoginParameterResolverException {
+ Map result = new HashMap();
+
+ if (!isConfigured) {
+ throw new LoginParameterResolverException("XMLLoginParameterResolver with configuration '" +
+ identityFile + "' is not configured!", null);
+ }
+
+ String famName = resolveValue("MOAFamilyName", authData, clientIPAddress);
+ String givenName = resolveValue("MOAGivenName", authData, clientIPAddress);
+ String dateOfBirth = resolveValue("MOADateOfBirth", authData, clientIPAddress);
+ String bPK = resolveValue("MOAVPK", authData, clientIPAddress);
+ String userid = "";
+ String password = "";
+ LPRParams params = null;
+ boolean userFound = false;
+
+ //try bPK and named search
+ userFound = bPKIdentitySearch(bPK, params);
+
+ if(false == userFound)
+ namedIdentitySearch(famName, givenName, dateOfBirth, params);
+
+ if(false == userFound)
+ return result;
+
+ //HTTP 401 - Basic Authentication
+ if (oaConf.getAuthType().equals("basic")) {
+ userid = params.getUN();
+ password = params.getPW();
+
+ try {
+ String userIDPassword = userid + ":" + password;
+ String credentials = Base64Utils.encode(userIDPassword.getBytes());
+ Logger.debug("XMLLoginParameterResolver: calculated credentials: " + credentials);
+ result.put("Authorization", "Basic " + credentials);
+ } catch (IOException ignore) {
+ }
+ return result;
+ }
+ if (oaConf.getAuthType().equals("header")) {
+ String key;
+ String resolvedValue;
+ result.put("Param1", params.getParam1());
+ result.put("Param2", params.getParam2());
+ result.put("Param3", params.getParam3());
+ return result;
+ /* for (Iterator iter = oaConf.getHeaderAuthMapping().keySet().iterator();
+ iter.hasNext();
+ result.put(key, resolvedValue)) {
+ key = (String) iter.next();
+ String predicate = (String) oaConf.getHeaderAuthMapping().get(key);
+ resolvedValue = resolveValue(predicate, authData, clientIPAddress);
+ }
+ */
+ }
+ return result;
+ }
+
+ public Map getAuthenticationParameters(
+ OAConfiguration oaConf,
+ AuthenticationData authData,
+ String clientIPAddress) {
+
+ Map result = new HashMap();
+
+ if (!isConfigured) {
+ Logger.warn("XMLLoginParameterResolver with configuration '" + identityFile + " is not configured");
+ return result;
+ }
+
+ String famName = resolveValue("MOAFamilyName", authData, clientIPAddress);
+ String givenName = resolveValue("MOAGivenName", authData, clientIPAddress);
+ String dateOfBirth = resolveValue("MOADateOfBirth", authData, clientIPAddress);
+ String bPK = resolveValue("MOAVPK", authData, clientIPAddress);
+ String userid = "";
+ String password = "";
+ LPRParams params = null;
+ boolean userFound = false;
+
+ //try bPK and named search
+ userFound = bPKIdentitySearch(bPK, params);
+
+ if (false == userFound)
+ namedIdentitySearch(famName, givenName, dateOfBirth, params);
+
+ if (false == userFound)
+ return result;
+
+ if (oaConf.getAuthType().equals("param")) {
+ result.put("Param1", params.getParam1());
+ result.put("Param2", params.getParam2());
+ result.put("Param3", params.getParam3());
+ return result;
+ /*
+ String key;
+ String resolvedValue;
+ for (Iterator iter = oaConf.getParamAuthMapping().keySet().iterator();
+ iter.hasNext();
+ result.put(key, resolvedValue)) {
+ key = (String) iter.next();
+ String predicate = (String) oaConf.getParamAuthMapping().get(key);
+ resolvedValue = resolveValue(predicate, authData, clientIPAddress);
+ }
+ */
+
+ }
+ return result;
+ }
+
+ private static String resolveValue(
+ String predicate,
+ AuthenticationData authData,
+ String clientIPAddress) {
+ if (predicate.equals("MOAGivenName"))
+ return authData.getGivenName();
+ if (predicate.equals("MOAFamilyName"))
+ return authData.getFamilyName();
+ if (predicate.equals("MOADateOfBirth"))
+ return authData.getDateOfBirth();
+ if (predicate.equals("MOAVPK"))
+ return authData.getVPK();
+ if (predicate.equals("MOAPublicAuthority"))
+ if (authData.isPublicAuthority())
+ return "true";
+ else
+ return "false";
+ if (predicate.equals("MOABKZ"))
+ return authData.getPublicAuthorityCode();
+ if (predicate.equals("MOAQualifiedCertificate"))
+ if (authData.isQualifiedCertificate())
+ return "true";
+ else
+ return "false";
+ if (predicate.equals("MOAZMRZahl"))
+ return authData.getIdentificationValue();
+ if (predicate.equals("MOAIPAddress"))
+ return clientIPAddress;
+ else
+ return null;
+ }
+
+ private Document readXMLFile(String fileName) {
+ Logger.info("XMLLoginParameterResolver: Loading MOA-OA configuration " + fileName);
+ DOMParser parser = new DOMParser();
+ try {
+ parser.setFeature("http://xml.org/sax/features/validation", true);
+ parser.setFeature("http://apache.org/xml/features/validation/schema", true);
+ parser.parse(fileName);
+ return parser.getDocument();
+ } catch (Exception e) {
+ String msg = e.toString();
+ Logger.error("XMLLoginParameterResolver: Error parsing file" + fileName + "\n" + msg);
+ return null;
+ }
+ }
+
+ private void buildInfo(Document doc) {
+ Element root = doc.getDocumentElement();
+ NodeList idList = root.getElementsByTagName(XSD_IDELEM);
+ NodeList paramList = root.getElementsByTagName("Parameters");
+ for (int i = 0; i < idList.getLength(); i++)
+ Logger.debug("XMLLoginParameterResolver: LocalName idList: " + idList.item(i).getLocalName());
+
+ for (int i = 0; i < paramList.getLength(); i++)
+ Logger.debug(
+ "XMLLoginParameterResolver: LocalName paramList: " + paramList.item(i).getLocalName());
+
+ for (int i = 0; i < idList.getLength(); i++) {
+ Element tmpElem = (Element) idList.item(i);
+ NodeList tmpList = tmpElem.getElementsByTagName("NamedIdentity");
+ for (int j = 0; j < tmpList.getLength(); j++)
+ Logger.debug("XMLLoginParameterResolver: LocalName tmp: " + tmpList.item(j).getLocalName());
+
+ if (1 == tmpList.getLength()) {
+ tmpElem = (Element) tmpList.item(0);
+ String tmpStr = tmpElem.getAttribute("SurName") + "," + tmpElem.getAttribute("GivenName");
+ boolean tmpBool = false;
+ if (tmpElem.getFirstChild() != null
+ && "1".compareTo(tmpElem.getFirstChild().getNodeValue()) == 0)
+ tmpBool = true;
+ Logger.debug(
+ "XMLLoginParameterResolver: tmpStr: "
+ + tmpStr
+ + " value: "
+ + (new Boolean(tmpBool)).toString());
+ tmpElem = (Element) paramList.item(i);
+ Logger.debug(
+ "XMLLoginParameterResolver: attribute UN: "
+ + tmpElem.getAttribute("UN")
+ + " attribute PW: "
+ + tmpElem.getAttribute("PW"));
+ namedMap.put(
+ tmpStr,
+ new LPRParams(tmpBool, tmpElem.getAttribute("UN"), tmpElem.getAttribute("PW")));
+ } else {
+ tmpList = tmpElem.getElementsByTagName("bPKIdentity");
+ if (1 == tmpList.getLength()) {
+ tmpElem = (Element) tmpList.item(0);
+ String tmpStr = tmpElem.getAttribute("bPK");
+ boolean tmpBool = false;
+ if (tmpElem.getFirstChild() != null
+ && "1".compareTo(tmpElem.getFirstChild().getNodeValue()) == 0)
+ tmpBool = true;
+ Logger.debug(
+ "XMLLoginParameterResolver: tmpStr: "
+ + tmpStr
+ + " value: "
+ + (new Boolean(tmpBool)).toString());
+ tmpElem = (Element) paramList.item(i);
+ Logger.debug(
+ "XMLLoginParameterResolver: attribute UN: "
+ + tmpElem.getAttribute("UN")
+ + " attribute PW: "
+ + tmpElem.getAttribute("PW")
+ + " attribute Param1: "
+ + tmpElem.getAttribute("Param1"));
+ bPKMap.put(
+ tmpStr,
+ new LPRParams(tmpBool, tmpElem.getAttribute("UN"), tmpElem.getAttribute("PW")));
+ } else {
+ Logger.warn(
+ "XMLLoginParameterResolver: wrong format no NamedIdentity or bPKIdentity found");
+ }
+ }
+ }
+
+ Logger.debug("namedMap:" + namedMap.toString());
+ Logger.debug("bPKMap:" + bPKMap.toString());
+ }
+
+ private void buildIdentityInfo(Document doc) {
+
+ }
+
+
+ boolean bPKIdentitySearch(String bPK, LPRParams params) {
+ //search for mapping with bPK of the user
+ Logger.info("XMLLoginParameterResolver: search for login data mapped to bPK:" + bPK);
+ params = (LPRParams) bPKMap.get(bPK);
+ if (null == params) {
+ Logger.info("XMLLoginParameterResolver: params for bPK: " + bPK + " not found!");
+ return false;
+ } else if (params.getEnabled()) {
+ Logger.info("XMLLoginParameterResolver: bPK: " + bPK + "found in list; user is enabled");
+ Logger.debug("XMLLoginParameterResolver: using: " + params.toString());
+ return true;
+ }
+ Logger.info("XMLLoginParameterResolver: bPK: " + bPK + "found in list but user is NOT enabled");
+ return false;
+ }
+
+ boolean namedIdentitySearch(
+ String famName,
+ String givenName,
+ String dateOfBirth,
+ LPRParams params) {
+ Logger.info(
+ "XMLLoginParameterResolver: search for login data for SurName:"
+ + famName
+ + " GivenName: "
+ + givenName);
+
+ params = (LPRParams) namedMap.get(famName + "," + givenName);
+ if (null == params) {
+
+ Logger.info(
+ "XMLLoginParameterResolver: params for Surname: "
+ + famName
+ + " GivenName: "
+ + givenName
+ + " not found!");
+ return false;
+ }
+
+ if (params.getEnabled()) {
+ Logger.info(
+ "XMLLoginParameterResolver: SurName:"
+ + famName
+ + " GivenName: "
+ + givenName
+ + "found in list; user is enabled");
+ Logger.debug("XMLLoginParameterResolver: using: " + params.toString());
+ return true;
+ }
+ Logger.info(
+ "XMLLoginParameterResolver: SurName:"
+ + famName
+ + " GivenName: "
+ + givenName
+ + "found in list; user is NOT enabled");
+ return false;
+ }
+
+ public static final String XSD_MAPPING = "Mapping";
+
+ public static final String XSD_DOCELEM = "MOAIdentities";
+ public static final String XSD_IDELEM = "Identity";
+ public static final String XSD_NAMEDIDELEM = "NamedIdentity";
+ public static final String XSD_BPKIDELEM = "bPKIdentity";
+ public static final String XSD_PARAMELEM = "Parameters";
+ public static final String XML_LPR_CONFIG_PROPERTY_NAME = "moa.id.xmllpr.configuration";
+ private Map bPKMap;
+ private Map namedMap;
+ private boolean isConfigured = false;
+} \ No newline at end of file
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ConfigurationServlet.java b/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ConfigurationServlet.java
index a00c48387..d6ec4951b 100644
--- a/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ConfigurationServlet.java
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ConfigurationServlet.java
@@ -2,6 +2,9 @@ package at.gv.egovernment.moa.id.proxy.servlet;
import java.io.IOException;
import java.io.PrintWriter;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.Locale;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -42,8 +45,12 @@ public class ConfigurationServlet extends HttpServlet {
out.println("<body bgcolor=\"#FFFFFF\">");
try {
MOAIDProxyInitializer.initialize();
- String message = msg.getMessage("config.00", null);
+
+ String message = msg.getMessage("config.00", new Object[]
+ { DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.GERMAN).format(new Date())} );
Logger.info(message);
+
+ //TODO low-priority: change to ErrorPage
out.println("<p><b>");
out.println(message);
out.println("</b></p>");
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java b/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java
index c52de2ba8..362849fb1 100644
--- a/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/servlet/ProxyServlet.java
@@ -36,6 +36,7 @@ import at.gv.egovernment.moa.id.data.CookieManager;
import at.gv.egovernment.moa.id.proxy.ConnectionBuilder;
import at.gv.egovernment.moa.id.proxy.ConnectionBuilderFactory;
import at.gv.egovernment.moa.id.proxy.LoginParameterResolver;
+import at.gv.egovernment.moa.id.proxy.LoginParameterResolverException;
import at.gv.egovernment.moa.id.proxy.LoginParameterResolverFactory;
import at.gv.egovernment.moa.id.proxy.MOAIDProxyInitializer;
import at.gv.egovernment.moa.id.proxy.invoke.GetAuthenticationDataInvoker;
@@ -133,10 +134,15 @@ public class ProxyServlet extends HttpServlet {
String clientIPAddress = req.getRemoteAddr();
Map loginHeaders = null;
Map loginParameters = null;
- if (oaConf.getAuthType().equals(OAConfiguration.PARAM_AUTH))
- loginParameters = lpr.getAuthenticationParameters(oaConf, authData, clientIPAddress);
- else
- loginHeaders = lpr.getAuthenticationHeaders(oaConf, authData, clientIPAddress);
+ try {
+ if (oaConf.getAuthType().equals(OAConfiguration.PARAM_AUTH))
+ loginParameters = lpr.getAuthenticationParameters(oaConf, authData, clientIPAddress);
+ else
+ loginHeaders = lpr.getAuthenticationHeaders(oaConf, authData, clientIPAddress);
+
+ } catch (LoginParameterResolverException ex) {
+ throw new ProxyException("proxy.13", new Object[] { publicURLPrefix });
+ }
// setup SSLSocketFactory for communication with the online application
SSLSocketFactory ssf = null;