diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2015-02-18 13:30:32 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2015-02-18 13:30:32 +0100 |
commit | 570527d48e3bf03444cdda08a4c1bcf8e7d4ff42 (patch) | |
tree | c31a6a9c2a76d0d56c9953f8242a32f4f365a85c /id | |
parent | bceb4fd58c7d17c4fdc6908f77f546c96c0920a4 (diff) | |
parent | 7310bfceb351ce02fb323e888f4d479efba1aa7f (diff) | |
download | moa-id-spss-570527d48e3bf03444cdda08a4c1bcf8e7d4ff42.tar.gz moa-id-spss-570527d48e3bf03444cdda08a4c1bcf8e7d4ff42.tar.bz2 moa-id-spss-570527d48e3bf03444cdda08a4c1bcf8e7d4ff42.zip |
Merge remote-tracking branch 'remotes/origin/moa-2.1-Snapshot' into during_authsource_refactoring
Diffstat (limited to 'id')
5 files changed, 64 insertions, 18 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java index d0cd05482..8aef6af2d 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java @@ -121,6 +121,7 @@ public class PEPSConnectorServlet extends AuthServlet { try {
AuthConfigurationProvider authConfigurationProvider = AuthConfigurationProvider.getInstance();
dtlUrl = authConfigurationProvider.getDocumentServiceUrl();
+ Logger.info ("PEPSConnectorServlet, using dtlUrl:"+dtlUrl);
} catch (Exception e) {
dtlUrl = "http://testvidp.buergerkarte.at/DocumentService/DocumentService";
e.printStackTrace();
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java index 501e33a75..bb3d8b1fd 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java @@ -56,6 +56,7 @@ import org.apache.velocity.app.VelocityEngine; import org.bouncycastle.util.encoders.UrlBase64; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; +import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.data.IAuthData; import at.gv.egovernment.moa.id.protocols.stork2.ExternalAttributeRequestRequiredException; @@ -108,15 +109,25 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider { super(attributes); this.oasisDssWebFormURL = oasisDssWebFormURL; - Properties props = new Properties(); try { - props.load(DatabaseConnectorMySQLImpl.class.getResourceAsStream("docservice.properties")); - dtlUrl = props.getProperty("docservice.url"); - } catch (IOException e) { + AuthConfigurationProvider authConfigurationProvider = AuthConfigurationProvider.getInstance(); + dtlUrl = authConfigurationProvider.getDocumentServiceUrl(); + Logger.info ("SignedDocAttributeRequestProvider, using dtlUrl:"+dtlUrl); + } catch (Exception e) { dtlUrl = "http://testvidp.buergerkarte.at/DocumentService/DocumentService"; - Logger.error("Loading DTL config failed, using default value:"+dtlUrl); e.printStackTrace(); - } + Logger.error("Loading documentservice url failed, using default value:"+dtlUrl); + } + +// Properties props = new Properties(); +// try { +// props.load(DatabaseConnectorMySQLImpl.class.getResourceAsStream("docservice.properties")); +// dtlUrl = props.getProperty("docservice.url"); +// } catch (IOException e) { +// dtlUrl = "http://testvidp.buergerkarte.at/DocumentService/DocumentService"; +// Logger.error("Loading DTL config failed, using default value:"+dtlUrl); +// e.printStackTrace(); +// } } /* @@ -208,7 +219,16 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider { // set the url in the SignResponse DocumentWithSignature documentWithSignature = new DocumentWithSignature(); DocumentType value = new DocumentType(); - value.setDocumentURL(dtlUrl); + if(dtlUrl.endsWith("?wsdl")) + { + String tmp = dtlUrl.replace("?wsdl", ""); + Logger.debug("DocumentUrl ends with ? wsdl, using "+tmp+" instead."); + value.setDocumentURL(tmp); + } + else + { + value.setDocumentURL(dtlUrl); + } documentWithSignature.setDocument(value); if(signResponse.getOptionalOutputs()!=null) { @@ -356,7 +376,13 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider { byte[] data = getDocumentFromDtl(docRequest, dtlURL);//dtlUrl //load doc from DTL - Logger.debug("data:"+data); + Logger.debug("data:"+data+" "+data.length); + try{ + Logger.trace("data:"+new String(data,"UTF-8")); + }catch(Exception e) + { + Logger.trace("data: creating String failed:"+e); + } String mime = getDocumentMimeFromDtl(docId, dtlURL);//dtlUrl Logger.debug("mime:"+mime); @@ -367,11 +393,28 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider { IncludeObject.class); signRequest.getOptionalInputs().getAny().removeAll(includeObjects); + String documentId = null; + Object objDoc = signRequest.getInputDocuments().getDocumentOrTransformedDataOrDocumentHash().get(0); + if (objDoc != null && objDoc instanceof DocumentType) + { + DocumentType document = (DocumentType)objDoc; + documentId = document.getID(); + } DocumentType document = new DocumentType(); - Base64Data b64data = new Base64Data(); - b64data.setValue(data); - b64data.setMimeType(mime); - document.setBase64Data(b64data); + if(documentId != null) + document.setID(documentId); + if(signRequest.getProfile().toLowerCase().contains("xades")) + { + document.setBase64XML(data); + } + else + { + Base64Data b64data = new Base64Data(); + b64data.setValue(data); + b64data.setMimeType(mime); + document.setBase64Data(b64data); + } + signRequest.setInputDocuments(ApiUtils.createInputDocuments(document)); //override old signRequestString @@ -380,6 +423,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider { IOUtils.copy(istr, writer, "UTF-8"); signRequestString = writer.toString(); Logger.info("Signrequest overwritten"); + Logger.debug("Signrequest overwritten:"+signRequestString); } catch (Exception e) { e.printStackTrace(); throw new Exception("Could not marshall sign request", e); @@ -470,6 +514,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider { URL url = null; try { + Logger.debug("getDocumentFromDtl:"+dtlUrl); url = new URL(dtlUrl); QName qname = new QName("http://stork.eu", "DocumentService"); diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java index 991682c9b..9a0f87488 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/PersonalAttributeList.java @@ -54,13 +54,13 @@ public final class PersonalAttributeList extends /** * Hash with the latest fetched attribute name alias. */ - private final transient Map<String, Integer> latestAttrAlias = + private final Map<String, Integer> latestAttrAlias = new HashMap<String, Integer>(); /** * Hash with mapping number of alias or the attribute name. */ - private final transient Map<String, Integer> attrAliasNumber = + private final Map<String, Integer> attrAliasNumber = new HashMap<String, Integer>(); /** diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java index 1974f4f66..276b26a03 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAttrQueryResponse.java @@ -38,7 +38,7 @@ public class STORKAttrQueryResponse implements Serializable { private String subStatusCode;
/** Audience restriction. */
- private transient String audienceRest;
+ private String audienceRest;
/** Error message. */
private String message;
@@ -65,7 +65,7 @@ public class STORKAttrQueryResponse implements Serializable { private List<Assertion> assertions;
/** The complete list from all assertions **/
- private transient IPersonalAttributeList totalAttributeList = new PersonalAttributeList();
+ private IPersonalAttributeList totalAttributeList = new PersonalAttributeList();
/** All personal attribute lists **/
private List<IPersonalAttributeList> attributeLists;
diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java index c4a3e2b6c..62a5343ec 100644 --- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java +++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnResponse.java @@ -47,7 +47,7 @@ public final class STORKAuthnResponse implements Serializable { private String subStatusCode; /** Audience restriction. */ - private transient String audienceRest; + private String audienceRest; /** Error message. */ private String message; @@ -74,7 +74,7 @@ public final class STORKAuthnResponse implements Serializable { private List<Assertion> assertions; /** The complete list from all assertions **/ - private transient IPersonalAttributeList totalAttributeList = new PersonalAttributeList(); + private IPersonalAttributeList totalAttributeList = new PersonalAttributeList(); /** All personal attribute lists **/ private List<IPersonalAttributeList> attributeLists; |