aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2015-02-20 08:49:37 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-02-20 08:49:37 +0100
commit1b476c125248f5790a6c09c2b91a25148d6e57b2 (patch)
treea63347747dc2a64329105629f07d152a6beb455b /id
parent6032b2a39960a98b7a4026da1bcc7e8454b4cc53 (diff)
downloadmoa-id-spss-1b476c125248f5790a6c09c2b91a25148d6e57b2.tar.gz
moa-id-spss-1b476c125248f5790a6c09c2b91a25148d6e57b2.tar.bz2
moa-id-spss-1b476c125248f5790a6c09c2b91a25148d6e57b2.zip
some minor fixes
Diffstat (limited to 'id')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java15
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/AuthenticationServer.java11
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java3
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java1
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/data/BPKDecryptionParameters.java14
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java7
6 files changed, 46 insertions, 5 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java
index b68db92a4..f45a16780 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/advancedlogging/StatisticLogger.java
@@ -23,6 +23,7 @@
package at.gv.egovernment.moa.id.advancedlogging;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
@@ -160,8 +161,9 @@ public class StatisticLogger {
dblog.setPv(false);
}
+ InputStream is = null;
try {
- InputStream is = new ByteArrayInputStream(mandate.getMandate());
+ is = new ByteArrayInputStream(mandate.getMandate());
JAXBContext jc = JAXBContext.newInstance(Mandate.class);
Unmarshaller u = jc.createUnmarshaller();
@@ -189,6 +191,17 @@ public class StatisticLogger {
} catch (JAXBException e) {
Logger.warn("Advancted logging can not parse mandate.", e);
+
+ } finally {
+ if (is!=null) {
+ try {
+ is.close();
+
+ } catch (IOException e) {
+ Logger.warn("Close InputStream failed." , e);
+
+ }
+ }
}
}
}
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 b9ce76d0c..fd7c7f237 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
@@ -1058,6 +1058,7 @@ public class AuthenticationServer implements MOAIDAuthConstants {
ByteArrayInputStream bais = new ByteArrayInputStream(mandate
.getMandate());
Document doc = DOMUtils.parseDocumentSimple(bais);
+ bais.close();
return doc.getDocumentElement();
}
@@ -1952,6 +1953,16 @@ public class AuthenticationServer implements MOAIDAuthConstants {
} catch (Throwable e) {
throw new CertificateException(e);
+
+ } finally {
+ try {
+ is.close();
+
+ } catch (IOException e) {
+ Logger.warn("Close InputStream failed." , e);
+
+ }
+
}
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java
index 5d816be1b..82e079459 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java
@@ -610,7 +610,8 @@ public class AuthenticationDataBuilder implements MOAIDAuthConstants {
if (extractor.containsAttribute(PVPConstants.EID_IDENTITY_LINK_NAME)) {
try {
InputStream idlStream = Base64Utils.decodeToStream(extractor.getSingleAttributeValue(PVPConstants.EID_IDENTITY_LINK_NAME), false);
- IdentityLink idl = new IdentityLinkAssertionParser(idlStream).parseIdentityLink();
+ IdentityLink idl = new IdentityLinkAssertionParser(idlStream).parseIdentityLink();
+ idlStream.close();
buildOAspecificIdentityLink(oaParam, authData, idl);
} catch (ParseException e) {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java
index 90b72b72b..933dddb31 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/OAAuthParameter.java
@@ -46,6 +46,7 @@
package at.gv.egovernment.moa.id.config.auth;
+import java.io.IOException;
import java.security.PrivateKey;
import java.util.ArrayList;
import java.util.HashMap;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/data/BPKDecryptionParameters.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/data/BPKDecryptionParameters.java
index 787a480f0..b7d5ebed5 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/data/BPKDecryptionParameters.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/data/BPKDecryptionParameters.java
@@ -55,10 +55,12 @@ public class BPKDecryptionParameters implements Serializable{
/**
* @return
+ * @throws IOException
*/
- public PrivateKey getPrivateKey() {
+ public PrivateKey getPrivateKey() {
+ InputStream in = null;
try {
- InputStream in = new ByteArrayInputStream(keyStore);
+ in = new ByteArrayInputStream(keyStore);
KeyStore store = KeyStoreUtils.loadKeyStore(in , keyStorePassword);
char[] chPassword = " ".toCharArray();
@@ -83,6 +85,14 @@ public class BPKDecryptionParameters implements Serializable{
} catch (NoSuchAlgorithmException e) {
Logger.error("Can not load private key from keystore.", e);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ Logger.warn("Close InputStream failed." , e);
+ }
+ }
}
return null;
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 bb3d8b1fd..2c77db94e 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
@@ -189,6 +189,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
IOUtils.copy(istr, writer, "UTF-8");
signResponseString = writer.toString();
Logger.info("SignResponse with error (unmodified):"+signResponseString);
+ istr.close();
}
else
{
@@ -198,6 +199,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
IOUtils.copy(dataSource.getInputStream(), baos);
byte[] data = baos.toByteArray();
+ baos.close();
//update doc in DTL
String docId, dssId = "";
@@ -255,7 +257,8 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
StringWriter writer = new StringWriter();
IOUtils.copy(istr, writer, "UTF-8");
signResponseString = writer.toString();
- Logger.info("SignResponse overwritten:"+signResponseString);
+ Logger.info("SignResponse overwritten:"+signResponseString);
+ istr.close();
}
else
{
@@ -304,6 +307,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
IOUtils.copy(istr, writer, "UTF-8");
signResponseString = writer.toString();
Logger.info("SignResponse overwritten:"+signResponseString);
+ istr.close();
}
}
else
@@ -424,6 +428,7 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
signRequestString = writer.toString();
Logger.info("Signrequest overwritten");
Logger.debug("Signrequest overwritten:"+signRequestString);
+ istr.close();
} catch (Exception e) {
e.printStackTrace();
throw new Exception("Could not marshall sign request", e);