diff options
author | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2014-07-02 16:02:45 +0200 |
---|---|---|
committer | Alexander Marsalek <amarsalek@iaik.tugraz.at> | 2014-07-02 16:02:45 +0200 |
commit | 6e409edd540fb7e2bb6a66f14adeb72e550669c1 (patch) | |
tree | d20f652b3c9d63a76cfa57ecc8e23e691efb39d6 /id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java | |
parent | 60fbf20c8f9017f6f9eb011a0df059bb1ada615c (diff) | |
download | moa-id-spss-6e409edd540fb7e2bb6a66f14adeb72e550669c1.tar.gz moa-id-spss-6e409edd540fb7e2bb6a66f14adeb72e550669c1.tar.bz2 moa-id-spss-6e409edd540fb7e2bb6a66f14adeb72e550669c1.zip |
added support for splitting authnrequest &signrequest
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java index a8cf5014f..c2eefa3d8 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java @@ -76,6 +76,7 @@ import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser; import at.gv.egovernment.moa.id.auth.parser.InfoboxReadResponseParser; import at.gv.egovernment.moa.id.auth.parser.VerifyXMLSignatureResponseParser; import at.gv.egovernment.moa.id.auth.servlet.PEPSConnectorServlet; +import at.gv.egovernment.moa.id.auth.servlet.PEPSConnectorWithLocalSigningServlet; import at.gv.egovernment.moa.id.auth.validator.CreateXMLSignatureResponseValidator; import at.gv.egovernment.moa.id.auth.validator.IdentityLinkValidator; import at.gv.egovernment.moa.id.auth.validator.InfoboxValidator; @@ -1795,12 +1796,37 @@ public class AuthenticationServer implements MOAIDAuthConstants { PersonalAttribute newAttribute = new PersonalAttribute(); newAttribute.setName("signedDoc"); List<String> value = new ArrayList<String>(); - value.add(generateDssSignRequest(CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession), - "application/xhtml+xml", - moasession.getCcc())); - newAttribute.setValue(value); - attributeList.add(newAttribute); - + + Logger.debug("PEPS supports XMLSignatures:"+cpeps.isXMLSignatureSupported()); + if(cpeps.isXMLSignatureSupported())//Send SignRequest to PEPS + { + value.add(generateDssSignRequest(CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession), + "application/xhtml+xml", moasession.getCcc())); + newAttribute.setValue(value); + attributeList.add(newAttribute); + } + else//Process SignRequest locally with MOCCA + { + String target = moasession.getTarget(); + moasession.setTarget("AT"); + String signedDoc = (generateDssSignRequest(CreateXMLSignatureRequestBuilder.buildForeignIDTextToBeSigned("wie im Signaturzertifikat (as in my signature certificate)", oaParam, moasession), + "application/xhtml+xml", "AT"));//moasession.getCcc() + moasession.setTarget(target); + Logger.warn("signedDoc to store:"+signedDoc); + //attributeList.add(newAttribute); + + //store SignRequest for later... + moasession.setSignedDoc(signedDoc); + + acsURL = issuerValue + PEPSConnectorWithLocalSigningServlet.PEPSCONNECTOR_SERVLET_URL_PATTERN; + try { + AuthenticationSessionStoreage.storeSession(moasession); + } catch (MOADatabaseException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } if (Logger.isDebugEnabled()) { Logger.debug("The following attributes are requested for this OA:"); @@ -1817,7 +1843,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { //generate AuthnRquest STORKAuthnRequest authnRequest = new STORKAuthnRequest(); authnRequest.setDestination(destination); - authnRequest.setAssertionConsumerServiceURL(acsURL); + authnRequest.setAssertionConsumerServiceURL(acsURL);//PEPSConnectorWithLocalSigning authnRequest.setProviderName(providerName); authnRequest.setIssuer(issuerValue); authnRequest.setQaa(oaParam.getQaaLevel()); @@ -1834,7 +1860,6 @@ public class AuthenticationServer implements MOAIDAuthConstants { authnRequest.setCitizenCountryCode(moasession.getCcc()); - Logger.debug("STORK AuthnRequest succesfully assembled."); STORKSAMLEngine samlEngine = STORKSAMLEngine.getInstance("outgoing"); @@ -1842,7 +1867,6 @@ public class AuthenticationServer implements MOAIDAuthConstants { if (samlEngine == null) { Logger.error("Could not initalize STORK SAML engine."); throw new MOAIDException("stork.00", null); - } try { @@ -1905,7 +1929,7 @@ public class AuthenticationServer implements MOAIDAuthConstants { idGenerator = new SecureRandomIdentifierGenerator(); DocumentType doc = new DocumentType(); - doc.setBase64XML(text.getBytes()); + doc.setBase64XML(text.getBytes("UTF-8")); doc.setID(idGenerator.generateIdentifier()); SignRequest request = new SignRequest(); |