aboutsummaryrefslogtreecommitdiff
path: root/id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolverPlainData.java
diff options
context:
space:
mode:
Diffstat (limited to 'id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolverPlainData.java')
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolverPlainData.java55
1 files changed, 33 insertions, 22 deletions
diff --git a/id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolverPlainData.java b/id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolverPlainData.java
index 1f59aa809..597a6bc7d 100644
--- a/id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolverPlainData.java
+++ b/id.server/src/at/gv/egovernment/moa/id/proxy/XMLLoginParameterResolverPlainData.java
@@ -150,7 +150,7 @@ public class XMLLoginParameterResolverPlainData
}
//TODO document
- public Map getAuthenticationHeaders(OAConfiguration oaConf, AuthenticationData authData, String clientIPAddress) throws NotAllowedException
+ public Map getAuthenticationHeaders(OAConfiguration oaConf, AuthenticationData authData, String clientIPAddress, boolean businessService) throws NotAllowedException
{
Map result = new HashMap();
if(oaConf.getAuthType().equals("basic"))
@@ -158,7 +158,14 @@ public class XMLLoginParameterResolverPlainData
String famName = resolveValue(MOAFamilyName, authData, clientIPAddress);
String givenName = resolveValue(MOAGivenName, authData, clientIPAddress);
String dateOfBirth = resolveValue(MOADateOfBirth, authData, clientIPAddress);
- String bPK = resolveValue(MOABPK, authData, clientIPAddress);
+ String bPK ="";
+ String wType= "";
+ if (businessService) {
+ bPK = resolveValue(MOAWBPK, authData, clientIPAddress);
+ wType = "w";
+ } else {
+ bPK = resolveValue(MOABPK, authData, clientIPAddress);
+ }
String userid = "";
String password = "";
String param1 = "";
@@ -168,15 +175,15 @@ public class XMLLoginParameterResolverPlainData
LPRParams params = null;
boolean userFound = false;
- //first step: search for bPK entry in user list
- Logger.debug("XMLLoginParameterResolverPlainData: search for automatic login data for bPK:" + bPK);
+ //first step: search for (w)bPK entry in user list
+ Logger.debug("XMLLoginParameterResolverPlainData: search for automatic login data for "+ wType + "bPK:" + bPK);
params = (LPRParams)bPKMap.get(bPK);
if(params == null)
- Logger.debug("XMLLoginParameterResolverPlainData: params for bPK: " + bPK + " not found in file!");
+ Logger.debug("XMLLoginParameterResolverPlainData: params for "+ wType + "bPK: " + bPK + " not found in file!");
else
if(params.getEnabled())
{ //if user is enabled: get related parameters
- Logger.debug("XMLLoginParameterResolverPlainData: bPK: " + bPK + " found in list; user is enabled");
+ Logger.debug("XMLLoginParameterResolverPlainData: "+ wType + "bPK: " + bPK + " found in list; user is enabled");
Logger.debug("XMLLoginParameterResolverPlainData: using: " + params.toString());
userid = params.getUN();
password = params.getPW();
@@ -186,7 +193,7 @@ public class XMLLoginParameterResolverPlainData
userFound = true;
} else
{
- Logger.info("XMLLoginParameterResolverPlainData: bPK: " + bPK + " found in list; user is NOT enabled");
+ Logger.info("XMLLoginParameterResolverPlainData: "+ wType + "bPK: " + bPK + " found in list; user is NOT enabled");
}
if(!userFound) //secound step: search for name entry in user list
{
@@ -241,7 +248,7 @@ public class XMLLoginParameterResolverPlainData
return result;
}
- public Map getAuthenticationParameters(OAConfiguration oaConf, AuthenticationData authData, String clientIPAddress)
+ public Map getAuthenticationParameters(OAConfiguration oaConf, AuthenticationData authData, String clientIPAddress, boolean businessService)
{
Map result = new HashMap();
if(oaConf.getAuthType().equals("param"))
@@ -268,7 +275,9 @@ public class XMLLoginParameterResolverPlainData
if(predicate.equals(MOADateOfBirth))
return authData.getDateOfBirth();
if(predicate.equals(MOABPK))
- return authData.getPBK();
+ return authData.getBPK();
+ if(predicate.equals(MOAWBPK))
+ return authData.getWBPK();
if(predicate.equals(MOAPublicAuthority))
if(authData.isPublicAuthority())
return "true";
@@ -309,11 +318,13 @@ public class XMLLoginParameterResolverPlainData
}
}
- private void buildInfo(Document doc)
+ private void buildInfo(Document doc, boolean businessService)
{
Element root = doc.getDocumentElement();
NodeList idList = root.getElementsByTagName("Identity");
NodeList paramList = root.getElementsByTagName("Parameters");
+ String wType ="";
+ if (businessService) wType = "w";
for(int i = 0; i < idList.getLength(); i++)
Logger.debug("XMLLoginParameterResolverPlainData: LocalName idList: " + idList.item(i).getLocalName());
@@ -340,11 +351,11 @@ public class XMLLoginParameterResolverPlainData
namedMap.put(tmpStr, new LPRParams(tmpBool, tmpElem.getAttribute("UN"), tmpElem.getAttribute("PW")));
} else
{
- tmpList = tmpElem.getElementsByTagName("bPKIdentity");
+ tmpList = tmpElem.getElementsByTagName(wType + "bPKIdentity");
if(1 == tmpList.getLength())
{
tmpElem = (Element)tmpList.item(0);
- String tmpStr = tmpElem.getAttribute("bPK");
+ String tmpStr = tmpElem.getAttribute(wType + "bPK");
boolean tmpBool = false;
if(tmpElem.getFirstChild() != null && "1".compareTo(tmpElem.getFirstChild().getNodeValue()) == 0)
tmpBool = true;
@@ -354,26 +365,26 @@ public class XMLLoginParameterResolverPlainData
bPKMap.put(tmpStr, new LPRParams(tmpBool, tmpElem.getAttribute("UN"), tmpElem.getAttribute("PW")));
} else
{
- Logger.warn("XMLLoginParameterResolverPlainData: wrong format no NamedIdentity or bPKIdentity found");
+ Logger.warn("XMLLoginParameterResolverPlainData: wrong format or incorrect mode; no NamedIdentity or " + wType + "bPKIdentity found");
}
}
}
Logger.debug("namedMap:" + namedMap.toString());
- Logger.debug("bPKMap:" + bPKMap.toString());
+ Logger.debug(wType + "bPKMap:" + bPKMap.toString());
}
- 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_NAME1 = "moa.id.xmllpr1.configuration";
+ //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_NAME1 = "moa.id.xmllpr1.configuration";
private Map bPKMap;
private Map namedMap;
- public void configure(String configuration) throws LoginParameterResolverException {
+ public void configure(String configuration, Boolean businessService) throws LoginParameterResolverException {
Logger.info("XMLLoginParameterResolverPlainData: initialization string: " + configuration);
this.configuration = configuration;
String fileName = configuration;
@@ -382,6 +393,6 @@ public class XMLLoginParameterResolverPlainData
Logger.info("XMLLoginParameterResolverPlainData: used file name string: " + fileName);
}
Document doc = readXMLFile(fileName);
- buildInfo(doc);
+ buildInfo(doc, businessService.booleanValue() );
}
} \ No newline at end of file