aboutsummaryrefslogtreecommitdiff
path: root/id.server/src/at/gv/egovernment
diff options
context:
space:
mode:
authorharald.bratko <harald.bratko@d688527b-c9ab-4aba-bd8d-4036d912da1d>2006-02-28 14:17:33 +0000
committerharald.bratko <harald.bratko@d688527b-c9ab-4aba-bd8d-4036d912da1d>2006-02-28 14:17:33 +0000
commitb89550cb29a6cc4b36147d3d9925709c38ba8171 (patch)
treec322649eda4fffa7cb2b61eb1a5b0657be9ca887 /id.server/src/at/gv/egovernment
parent18241a6df201ffa83e8dcc1d84e9ae8505c268f7 (diff)
downloadmoa-id-spss-b89550cb29a6cc4b36147d3d9925709c38ba8171.tar.gz
moa-id-spss-b89550cb29a6cc4b36147d3d9925709c38ba8171.tar.bz2
moa-id-spss-b89550cb29a6cc4b36147d3d9925709c38ba8171.zip
Updated for loading templates from the config file.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@640 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'id.server/src/at/gv/egovernment')
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/auth/AuthenticationServer.java18
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java91
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java52
3 files changed, 129 insertions, 32 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id.server/src/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
index ea9d7a0d3..c0fcc6a68 100644
--- a/id.server/src/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
+++ b/id.server/src/at/gv/egovernment/moa/id/auth/AuthenticationServer.java
@@ -175,7 +175,7 @@ public class AuthenticationServer implements MOAIDAuthConstants {
session.setTarget(target);
session.setOAURLRequested(oaURL);
session.setPublicOAURLPrefix(oaParam.getPublicURLPrefix());
- session.setAuthURL(authURL);
+ session.setAuthURL(authURL);
session.setTemplateURL(templateURL);
session.setBusinessService(oaParam.getBusinessService());
String returnURL =
@@ -197,6 +197,10 @@ public class AuthenticationServer implements MOAIDAuthConstants {
ex);
}
String bkuSelectionTemplate = null;
+ // override template url by url from configuration file
+ if (oaParam.getBkuSelectionTemplateURL() != null) {
+ bkuSelectionTemplateURL = oaParam.getBkuSelectionTemplateURL();
+ }
if (bkuSelectionTemplateURL != null) {
try {
bkuSelectionTemplate = new String(FileUtils.readURL(bkuSelectionTemplateURL));
@@ -318,13 +322,19 @@ public class AuthenticationServer implements MOAIDAuthConstants {
REQ_VERIFY_IDENTITY_LINK,
session.getSessionID());
String template = null;
- if (session.getTemplateURL() != null) {
+ // override template url by url from configuration file
+ if (oaParam.getTemplateURL() != null) {
+ templateURL = oaParam.getTemplateURL();
+ } else {
+ templateURL = session.getTemplateURL();
+ }
+ if (templateURL != null) {
try {
- template = new String(FileUtils.readURL(session.getTemplateURL()));
+ template = new String(FileUtils.readURL(templateURL));
} catch (IOException ex) {
throw new AuthenticationException(
"auth.03",
- new Object[] { session.getTemplateURL(), ex.toString()},
+ new Object[] { templateURL, ex.toString()},
ex);
}
}
diff --git a/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java b/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java
index 6b9e09b63..7d3a6d4ab 100644
--- a/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java
+++ b/id.server/src/at/gv/egovernment/moa/id/config/ConfigurationBuilder.java
@@ -76,6 +76,12 @@ public class ConfigurationBuilder {
private static final String AUTH_BKU_XPATH =
ROOT + CONF + "AuthComponent/" + CONF + "BKUSelection";
/** an XPATH-Expression */
+ private static final String AUTH_BKUSELECT_TEMPLATE_XPATH =
+ ROOT + CONF + "AuthComponent/" + CONF + "Templates/" + CONF + "BKUSelectionTemplate/@URL";
+ /** an XPATH-Expression */
+ private static final String AUTH_TEMPLATE_XPATH =
+ ROOT + CONF + "AuthComponent/" + CONF + "Templates/" + CONF + "Template/@URL";
+ /** an XPATH-Expression */
public static final String AUTH_SECLAYER_TRANSFORMS_INFO_FILENAME_XPATH =
ROOT + CONF + "AuthComponent/" + CONF + "SecurityLayer/" + CONF + "TransformsInfo/@filename";
/** an XPATH-Expression */
@@ -105,7 +111,13 @@ public class ConfigurationBuilder {
/** an XPATH-Expression */
private static final String OA_AUTH_COMPONENT_XPATH = CONF + "AuthComponent";
/** an XPATH-Expression */
- private static final String OA_AUTH_COMPONENT_IDENT_NUMBER_XPATH = CONF + "IdentificationNumber";
+ private static final String OA_AUTH_COMPONENT_IDENT_NUMBER_XPATH = CONF + "IdentificationNumber";
+ /** an XPATH-Expression */
+ private static final String OA_AUTH_COMPONENT_BKUSELECT_TEMPLATE_XPATH =
+ CONF + "Templates/" + CONF + "BKUSelectionTemplate/@URL";
+ /** an XPATH-Expression */
+ private static final String OA_AUTH_COMPONENT_TEMPLATE_XPATH =
+ CONF + "Templates/" + CONF + "Template/@URL";
/** an XPATH-Expression */
private static final String OA_AUTH_COMPONENT_TRANSFORMS_INFO_FILENAME_XPATH = CONF + "TransformsInfo/@filename";
/** an XPATH-Expression */
@@ -176,10 +188,10 @@ public class ConfigurationBuilder {
/**
* main configuration file directory name used to configure MOA-ID
*/
- private String rootConfigFileDir;
+ private String rootConfigFileDir_;
/** The root element of the MOA-ID configuration */
- private Element configElem;
+ private Element configElem_;
/**
* Creates a new <code>MOAConfigurationProvider</code>.
@@ -187,8 +199,8 @@ public class ConfigurationBuilder {
* @param configElem The root element of the MOA-ID configuration.
*/
public ConfigurationBuilder(Element configElem, String rootConfigDir) {
- this.configElem = configElem;
- this.rootConfigFileDir = rootConfigDir;
+ configElem_ = configElem;
+ rootConfigFileDir_ = rootConfigDir;
}
/**
@@ -197,7 +209,7 @@ public class ConfigurationBuilder {
* @return The root element of the MOA-ID configuration.
*/
public Element getConfigElem() {
- return configElem;
+ return configElem_;
}
/**
@@ -207,7 +219,7 @@ public class ConfigurationBuilder {
*/
public ConnectionParameter buildAuthBKUConnectionParameter() {
- Element authBKU = (Element) XPathUtils.selectSingleNode(getConfigElem(), AUTH_BKU_XPATH);
+ Element authBKU = (Element) XPathUtils.selectSingleNode(configElem_, AUTH_BKU_XPATH);
if (authBKU==null) return null;
return buildConnectionParameter(authBKU);
}
@@ -221,7 +233,7 @@ public class ConfigurationBuilder {
*/
public String buildAuthBKUSelectionType() {
- Element authBKU = (Element) XPathUtils.selectSingleNode(getConfigElem(), AUTH_BKU_XPATH);
+ Element authBKU = (Element) XPathUtils.selectSingleNode(configElem_, AUTH_BKU_XPATH);
if (authBKU==null) return null;
return (authBKU).getAttribute("BKUSelectionAlternative");
}
@@ -268,7 +280,7 @@ public class ConfigurationBuilder {
String fileURL = transformsInfoFileNames[i];
//if fileURL is relative to rootConfigFileDir make it absolute
- fileURL = FileUtils.makeAbsoluteURL(fileURL, rootConfigFileDir);
+ fileURL = FileUtils.makeAbsoluteURL(fileURL, rootConfigFileDir_);
String transformsInfo = FileUtils.readURL(fileURL, DEFAULT_ENCODING);
transformsInfos[i] = transformsInfo;
}
@@ -282,7 +294,7 @@ public class ConfigurationBuilder {
*/
public ConnectionParameter buildMoaSpConnectionParameter() {
- Element connectionParameter = (Element) XPathUtils.selectSingleNode(getConfigElem(), AUTH_MOA_SP_XPATH);
+ Element connectionParameter = (Element) XPathUtils.selectSingleNode(configElem_, AUTH_MOA_SP_XPATH);
if (connectionParameter==null) return null;
return buildConnectionParameter(connectionParameter);
}
@@ -294,7 +306,7 @@ public class ConfigurationBuilder {
*/
public String getMoaSpIdentityLinkTrustProfileID() {
return XPathUtils.getElementValue(
- getConfigElem(),
+ configElem_,
AUTH_MOA_SP_VERIFY_IDENTITY_TRUST_ID_XPATH,
"");
}
@@ -304,7 +316,7 @@ public class ConfigurationBuilder {
*/
public String getTrustedCACertificates() {
return XPathUtils.getElementValue(
- getConfigElem(),
+ configElem_,
TRUSTED_CA_CERTIFICATES_XPATH,null);
}
@@ -315,7 +327,7 @@ public class ConfigurationBuilder {
*/
public String getMoaSpAuthBlockTrustProfileID() {
return XPathUtils.getElementValue(
- getConfigElem(),
+ configElem_,
AUTH_MOA_SP_VERIFY_AUTH_TRUST_ID_XPATH,
"");
}
@@ -330,7 +342,7 @@ public class ConfigurationBuilder {
List verifyTransformsInfoIDs = new ArrayList();
NodeIterator vtIter =
XPathUtils.selectNodeIterator(
- getConfigElem(),
+ configElem_,
AUTH_MOA_SP_VERIFY_AUTH_VERIFY_ID_XPATH);
Element vtElem;
@@ -356,7 +368,7 @@ public class ConfigurationBuilder {
List x509SubjectNameList = new ArrayList();
NodeIterator x509Iter =
XPathUtils.selectNodeIterator(
- getConfigElem(),
+ configElem_,
AUTH_IDENTITY_LINK_X509SUBJECTNAME_XPATH);
Element x509Elem;
@@ -380,8 +392,13 @@ public class ConfigurationBuilder {
*/
public OAAuthParameter[] buildOnlineApplicationAuthParameters() throws ConfigurationException {
+ String bkuSelectionTemplateURL =
+ XPathUtils.getAttributeValue(configElem_,AUTH_BKUSELECT_TEMPLATE_XPATH,null);
+ String templateURL =
+ XPathUtils.getAttributeValue(configElem_,AUTH_TEMPLATE_XPATH,null);
+
List OA_set = new ArrayList();
- NodeList OAIter = XPathUtils.selectNodeList(getConfigElem(), OA_XPATH);
+ NodeList OAIter = XPathUtils.selectNodeList(configElem_, OA_XPATH);
for (int i = 0; i < OAIter.getLength(); i++) {
Element oAElem = (Element) OAIter.item(i);
@@ -434,7 +451,9 @@ public class ConfigurationBuilder {
oap.setProvideStammzahl(BoolUtils.valueOf(authComponent.getAttribute("provideStammzahl")));
oap.setProvideAuthBlock(BoolUtils.valueOf(authComponent.getAttribute("provideAUTHBlock")));
oap.setProvideIdentityLink(BoolUtils.valueOf(authComponent.getAttribute("provideIdentityLink")));
- oap.setProvideCertificate(BoolUtils.valueOf(authComponent.getAttribute("provideCertificate")));
+ oap.setProvideCertificate(BoolUtils.valueOf(authComponent.getAttribute("provideCertificate")));
+ oap.setBkuSelectionTemplateURL(buildTemplateURL(authComponent, OA_AUTH_COMPONENT_BKUSELECT_TEMPLATE_XPATH, bkuSelectionTemplateURL));
+ oap.setTemplateURL(buildTemplateURL(authComponent, OA_AUTH_COMPONENT_TEMPLATE_XPATH, templateURL));
// load OA specific transforms if present
String[] transformsInfoFileNames = buildTransformsInfoFileNames(authComponent, OA_AUTH_COMPONENT_TRANSFORMS_INFO_FILENAME_XPATH);
try {
@@ -452,6 +471,26 @@ public class ConfigurationBuilder {
return result;
}
+
+ /**
+ * Builds the URL for a BKUSelectionTemplate or a Template. The method selects
+ * the uri string from the MOA ID configuration file via the given xpath expression
+ * and returns either this string or the default value.
+ *
+ * @param oaAUTHComponent The AuthComponent element to get the template from.
+ * @param xpathExpr The xpath expression for selecting the template uri.
+ * @param defaultURL The default template url.
+ * @return The template url. This may either the via xpath selected uri
+ * or, if no template is specified within the online appliacation,
+ * the default url. Both may be <code>null</code>.
+ */
+ private String buildTemplateURL(Element oaAAuthComponent, String xpathExpr, String defaultURL) {
+ String templateURL = XPathUtils.getAttributeValue(oaAAuthComponent, xpathExpr, defaultURL);
+ if (templateURL != null) {
+ templateURL = FileUtils.makeAbsoluteURL(templateURL, rootConfigFileDir_);
+ }
+ return templateURL;
+ }
/**
* Build a bean containing all information about the ProxyComponent
@@ -460,7 +499,7 @@ public class ConfigurationBuilder {
public ConnectionParameter buildAuthComponentConnectionParameter()
{
- Element connectionParameter = (Element) XPathUtils.selectSingleNode(getConfigElem(), PROXY_AUTH_XPATH);
+ Element connectionParameter = (Element) XPathUtils.selectSingleNode(configElem_, PROXY_AUTH_XPATH);
if (connectionParameter==null) return null;
return buildConnectionParameter(connectionParameter);
@@ -478,7 +517,7 @@ public class ConfigurationBuilder {
XPathUtils.getElementValue(root,CONNECTION_PARAMETER_ACCEPTED_CERTS_XPATH,null));
result.setAcceptedServerCertificates(FileUtils.makeAbsoluteURL(
- result.getAcceptedServerCertificates(), rootConfigFileDir));
+ result.getAcceptedServerCertificates(), rootConfigFileDir_));
result.setUrl(
XPathUtils.getAttributeValue(root, CONNECTION_PARAMETER_URL_XPATH, ""));
@@ -486,7 +525,7 @@ public class ConfigurationBuilder {
XPathUtils.getElementValue(root,CONNECTION_PARAMETERN_KEYSTORE_XPATH,null));
result.setClientKeyStore(FileUtils.makeAbsoluteURL(
- result.getClientKeyStore(), rootConfigFileDir));
+ result.getClientKeyStore(), rootConfigFileDir_));
result.setClientKeyStorePassword(
XPathUtils.getAttributeValue(root,CONNECTION_PARAMETER_KEYSTORE_PASS_XPATH,""));
@@ -510,7 +549,7 @@ public class ConfigurationBuilder {
public OAProxyParameter[] buildOnlineApplicationProxyParameters() throws ConfigurationException{
List oA_list = new ArrayList();
- NodeList OAIter = XPathUtils.selectNodeList(getConfigElem(), OA_XPATH);
+ NodeList OAIter = XPathUtils.selectNodeList(configElem_, OA_XPATH);
for (int i = 0; i < OAIter.getLength(); i++) {
Element oAElem = (Element) OAIter.item(i);
@@ -521,12 +560,12 @@ public class ConfigurationBuilder {
Element proxyComponentElem = (Element) XPathUtils.selectSingleNode(oAElem,OA_PROXY_COMPONENT_XPATH);
if (proxyComponentElem != null) {
oap.setConfigFileURL(XPathUtils.getAttributeValue(oAElem, OA_PROXY_URL_XPATH, null));
- oap.setConfigFileURL(FileUtils.makeAbsoluteURL(oap.getConfigFileURL(), rootConfigFileDir));
+ oap.setConfigFileURL(FileUtils.makeAbsoluteURL(oap.getConfigFileURL(), rootConfigFileDir_));
// default session time out: 3600 sec = 1 h
oap.setSessionTimeOut(new Integer(XPathUtils.getAttributeValue(oAElem,OA_PROXY_SESSION_TIMEOUT_XPATH,"3600")).intValue());
oap.setLoginParameterResolverImpl(XPathUtils.getAttributeValue(oAElem, OA_PROXY_LOGIN_PARA_XPATH, null));
oap.setLoginParameterResolverConfiguration(XPathUtils.getAttributeValue(oAElem, OA_PROXY_LOGIN_PARA_CONF_XPATH, null));
- oap.setLoginParameterResolverConfiguration(FileUtils.makeAbsoluteURL(oap.getLoginParameterResolverConfiguration(), rootConfigFileDir));
+ oap.setLoginParameterResolverConfiguration(FileUtils.makeAbsoluteURL(oap.getLoginParameterResolverConfiguration(), rootConfigFileDir_));
oap.setConnectionBuilderImpl(XPathUtils.getAttributeValue(oAElem,OA_PROXY_CONNECTION_BUILDER_XPATH, null));
ConnectionParameter conPara = buildConnectionParameter(proxyComponentElem);
@@ -557,7 +596,7 @@ public class ConfigurationBuilder {
Map genericConfiguration = new HashMap();
NodeIterator gcIter =
XPathUtils.selectNodeIterator(
- getConfigElem(),
+ configElem_,
GENERIC_CONFIGURATION_XPATH);
Element gcElem;
@@ -680,7 +719,7 @@ public class ConfigurationBuilder {
public String getDefaultChainingMode() {
String defaultChaining =
XPathUtils.getAttributeValue(
- getConfigElem(),
+ configElem_,
CHAINING_MODES_DEFAULT_XPATH,
CM_CHAINING);
@@ -695,7 +734,7 @@ public class ConfigurationBuilder {
public Map buildChainingModes() {
Map chainingModes = new HashMap();
NodeIterator trustIter =
- XPathUtils.selectNodeIterator(getConfigElem(), TRUST_ANCHOR_XPATH);
+ XPathUtils.selectNodeIterator(configElem_, TRUST_ANCHOR_XPATH);
Element trustAnchorElem;
while ((trustAnchorElem = (Element) trustIter.nextNode()) != null) {
diff --git a/id.server/src/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java b/id.server/src/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java
index ad4dd4b62..4a41f9e75 100644
--- a/id.server/src/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java
+++ b/id.server/src/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java
@@ -9,6 +9,11 @@ import at.gv.egovernment.moa.id.config.OAParameter;
* @author Stefan Knirsch
* @version $Id$
*/
+/**
+ *
+ *
+ * @author Harald Bratko
+ */
public class OAAuthParameter extends OAParameter {
/**
* Sercurity Layer version
@@ -51,6 +56,14 @@ public class OAAuthParameter extends OAParameter {
* determines whether the certificate is to be included in the authentication data
*/
private boolean provideCertificate;
+ /**
+ * url to a template for web page "Auswahl der B&uuml;rgerkartenumgebung"
+ */
+ private String bkuSelectionTemplateURL;
+ /**
+ * template for web page "Anmeldung mit B&uuml;rgerkarte"
+ */
+ private String templateURL;
/**
* Returns <code>true</code> if the Security Layer version is version 1.2,
@@ -127,6 +140,25 @@ public class OAAuthParameter extends OAParameter {
public String getKeyBoxIdentifier() {
return keyBoxIdentifier;
}
+
+ /**
+ * Returns the BkuSelectionTemplate url.
+ * @return The BkuSelectionTemplate url or <code>null</code> if no url for
+ * a BkuSelectionTemplate is set.
+ */
+ public String getBkuSelectionTemplateURL() {
+ return bkuSelectionTemplateURL;
+ }
+
+ /**
+ * Returns the TemplateURL url.
+ * @return The TemplateURL url or <code>null</code> if no url for
+ * a Template is set.
+ */
+ public String getTemplateURL() {
+ return templateURL;
+ }
+
/**
* Sets the security layer version.
* Also sets {@link slVersion12} to <code>true</code> if the Security Layer
@@ -192,6 +224,22 @@ public class OAAuthParameter extends OAParameter {
public void setKeyBoxIdentier(String keyBoxIdentifier) {
this.keyBoxIdentifier = keyBoxIdentifier;
}
-
-
+
+ /**
+ * Sets the BkuSelectionTemplate url.
+ * @param bkuSelectionTemplateURL The url string specifying the location
+ * of a BkuSelectionTemplate.
+ */
+ public void setBkuSelectionTemplateURL(String bkuSelectionTemplateURL) {
+ this.bkuSelectionTemplateURL = bkuSelectionTemplateURL;
+ }
+
+ /**
+ * Sets the Template url.
+ * @param templateURL The url string specifying the location
+ * of a Template.
+ */
+ public void setTemplateURL(String templateURL) {
+ this.templateURL = templateURL;
+ }
}