aboutsummaryrefslogtreecommitdiff
path: root/id.server/src
diff options
context:
space:
mode:
authorrudolf <rudolf@d688527b-c9ab-4aba-bd8d-4036d912da1d>2004-06-14 20:32:30 +0000
committerrudolf <rudolf@d688527b-c9ab-4aba-bd8d-4036d912da1d>2004-06-14 20:32:30 +0000
commit28c12faa431907ad9272b11e419c319417533fcc (patch)
treede659406420aa5cb6a713a3a2834d2d5486c87ea /id.server/src
parenta7e9aa517fc6bd825e29436d438fbedf09d49ea8 (diff)
downloadmoa-id-spss-28c12faa431907ad9272b11e419c319417533fcc.tar.gz
moa-id-spss-28c12faa431907ad9272b11e419c319417533fcc.tar.bz2
moa-id-spss-28c12faa431907ad9272b11e419c319417533fcc.zip
Added gebDat to SAML-Assertion (RSCH)
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@123 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'id.server/src')
-rw-r--r--id.server/src/at/gv/egovernment/moa/id/auth/AuthenticationServer.java61
1 files changed, 17 insertions, 44 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 9cb473d4f..09bc821d8 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
@@ -58,6 +58,7 @@ import at.gv.egovernment.moa.util.BoolUtils;
import at.gv.egovernment.moa.util.DOMUtils;
import at.gv.egovernment.moa.util.DateTimeUtils;
import at.gv.egovernment.moa.util.FileUtils;
+import at.gv.egovernment.moa.util.OutputXML2File;
/**
* API for MOA ID Authentication Service.<br>
@@ -170,7 +171,11 @@ public class AuthenticationServer implements MOAIDAuthConstants {
// bkuSelectionType==HTMLSelect
String bkuSelectTag;
try {
- bkuSelectTag = readBKUSelectTag(AuthConfigurationProvider.getInstance(), bkuConnParam);
+ //TODO full test with different Templates
+ //bkuSelectionTag is encoded in ISO-8859-1. must be converted to UTF-8
+ bkuSelectTag = new String( readBKUSelectTag(AuthConfigurationProvider.getInstance(), bkuConnParam), "ISO-8859-1");
+ byte buff [] = bkuSelectTag.getBytes("UTF-8");
+ bkuSelectTag = new String(buff);
} catch (Throwable ex) {
throw new AuthenticationException(
"auth.03",
@@ -197,19 +202,19 @@ public class AuthenticationServer implements MOAIDAuthConstants {
* Method readBKUSelectTag.
* @param conf the ConfigurationProvider
* @param connParam the ConnectionParameter for that connection
- * @return String
+ * @return byte []
* @throws ConfigurationException on config-errors
* @throws PKIException on PKI errors
* @throws IOException on any data error
* @throws GeneralSecurityException on security errors
*/
- private String readBKUSelectTag(ConfigurationProvider conf, ConnectionParameter connParam)
+ private byte [] readBKUSelectTag(ConfigurationProvider conf, ConnectionParameter connParam)
throws ConfigurationException, PKIException, IOException, GeneralSecurityException {
if (connParam.isHTTPSURL())
- return new String(SSLUtils.readHttpsURL(conf, connParam));
+ return SSLUtils.readHttpsURL(conf, connParam);
else
- return new String(FileUtils.readURL(connParam.getUrl()));
+ return FileUtils.readURL(connParam.getUrl());
}
/**
* Processes the beginning of an authentication session.
@@ -357,7 +362,7 @@ public class AuthenticationServer implements MOAIDAuthConstants {
authConf.getMoaSpIdentityLinkTrustProfileID());
// debug output
if(null != domVerifyXMLSignatureRequest)
- debugOutputXMLFile("VerifyIdentityLinkRequest.xml", domVerifyXMLSignatureRequest);
+ OutputXML2File.debugOutputXML2File("VerifyIdentityLinkRequest.xml", domVerifyXMLSignatureRequest, DEBUG_OUTPUT_HIERARCHY);
// invokes the call
Element domVerifyXMLSignatureResponse =
new SignatureVerificationInvoker().verifyXMLSignature(domVerifyXMLSignatureRequest);
@@ -366,7 +371,7 @@ public class AuthenticationServer implements MOAIDAuthConstants {
new VerifyXMLSignatureResponseParser(domVerifyXMLSignatureResponse).parseData();
// debug output
if(null != domVerifyXMLSignatureResponse)
- debugOutputXMLFile("VerifyIdentityLinkResponse.xml", domVerifyXMLSignatureResponse);
+ OutputXML2File.debugOutputXML2File("VerifyIdentityLinkResponse.xml", domVerifyXMLSignatureResponse, DEBUG_OUTPUT_HIERARCHY);
// validates the <VerifyXMLSignatureResponse>
VerifyXMLSignatureResponseValidator.getInstance().validate(
verifyXMLSignatureResponse,
@@ -396,12 +401,13 @@ public class AuthenticationServer implements MOAIDAuthConstants {
private String buildAuthenticationBlock(AuthenticationSession session) {
IdentityLink identityLink = session.getIdentityLink();
String issuer = identityLink.getGivenName() + " " + identityLink.getFamilyName();
+ String gebDat = identityLink.getDateOfBirth();
String issueInstant = DateTimeUtils.buildDateTime(Calendar.getInstance());
String authURL = session.getAuthURL();
String target = session.getTarget();
String oaURL = session.getPublicOAURLPrefix();
String authBlock =
- new AuthenticationBlockAssertionBuilder().build(issuer, issueInstant, authURL, target, oaURL);
+ new AuthenticationBlockAssertionBuilder().build(issuer, issueInstant, authURL, target, oaURL, gebDat);
return authBlock;
}
/**
@@ -457,14 +463,14 @@ public class AuthenticationServer implements MOAIDAuthConstants {
Element domVsreq = new VerifyXMLSignatureRequestBuilder().build(csresp, vtids, tpid);
// debug output
if(null != domVsreq)
- AuthenticationServer.debugOutputXMLFile("VerifyAuthenticationBlockRequest.xml", domVsreq);
+ OutputXML2File.debugOutputXML2File("VerifyAuthenticationBlockRequest.xml", domVsreq, DEBUG_OUTPUT_HIERARCHY);
// invokes the call
Element domVsresp = new SignatureVerificationInvoker().verifyXMLSignature(domVsreq);
// parses the <VerifyXMLSignatureResponse>
VerifyXMLSignatureResponse vsresp = new VerifyXMLSignatureResponseParser(domVsresp).parseData();
// debug output
if(null != domVsresp)
- AuthenticationServer.debugOutputXMLFile("VerifyAuthenticationBlockResponse.xml", domVsresp);
+ OutputXML2File.debugOutputXML2File("VerifyAuthenticationBlockResponse.xml", domVsresp, DEBUG_OUTPUT_HIERARCHY);
// validates the <VerifyXMLSignatureResponse>
VerifyXMLSignatureResponseValidator.getInstance().validate(
vsresp,
@@ -690,38 +696,5 @@ public class AuthenticationServer implements MOAIDAuthConstants {
return param == null || param.length() == 0;
}
- /**
- * Writes an XML structure to file for debugging purposes, encoding UTF-8.
- *
- * @param filename file name
- * @param rootElem root element in DOM tree
- */
- public static void debugOutputXMLFile(String filename, Element rootElem) {
- if (Logger.isDebugEnabled(DEBUG_OUTPUT_HIERARCHY)) {
- try {
- String xmlString = new String(DOMUtils.serializeNode(rootElem));
- debugOutputXMLFile(filename, xmlString);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
- /**
- * Writes an XML structure to file for debugging purposes, encoding UTF-8.
- *
- * @param filename file name
- * @param xmlString XML string
- */
- public static void debugOutputXMLFile(String filename, String xmlString) {
- if (Logger.isDebugEnabled(DEBUG_OUTPUT_HIERARCHY)) {
- try {
- java.io.OutputStream fout = new java.io.FileOutputStream(filename);
- byte[] xmlData = xmlString.getBytes("UTF-8");
- fout.write(xmlData);
- fout.close();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
+
}