From d7404bc44ae84df98031a87052ff2d71ac960bd1 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 7 Jan 2014 11:03:11 +0100 Subject: short Bugfixes, but not complete --- .../auth/builder/StartAuthenticationBuilder.java | 4 ++-- .../id/protocols/oauth20/OAuth20TokenAction.java | 25 ++++++++++++---------- .../id/storage/AuthenticationSessionStoreage.java | 1 + 3 files changed, 17 insertions(+), 13 deletions(-) (limited to 'id/server/idserverlib/src/main/java') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/StartAuthenticationBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/StartAuthenticationBuilder.java index c616d94b3..91040dde2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/StartAuthenticationBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/StartAuthenticationBuilder.java @@ -44,13 +44,13 @@ public class StartAuthenticationBuilder { AuthenticationServer.startSTORKAuthentication(req, resp, moasession); return ""; - } else {*/ + } else { //normal MOA-ID authentication Logger.debug("Starting normal MOA-ID authentication"); String getIdentityLinkForm = AuthenticationServer.getInstance().startAuthentication(moasession, req); return getIdentityLinkForm; - //} + } } } diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/OAuth20TokenAction.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/OAuth20TokenAction.java index 70f425148..d66f9cb2a 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/OAuth20TokenAction.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/oauth20/OAuth20TokenAction.java @@ -27,6 +27,7 @@ import at.gv.egovernment.moa.id.auth.builder.BPKBuilder; import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; import at.gv.egovernment.moa.id.auth.exception.BuildException; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; +import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; @@ -111,7 +112,7 @@ public class OAuth20TokenAction implements IAction { OAuth20Util.addProperytiesToJsonObject(jsonObject, params); String jsonResponse = jsonObject.toString(); Logger.debug("JSON Response: " + jsonResponse); - + // write respone to http response httpResp.setContentType("application/json"); httpResp.setStatus(HttpServletResponse.SC_OK); @@ -124,18 +125,20 @@ public class OAuth20TokenAction implements IAction { throw new OAuth20ServerErrorException(); } finally { - if (session != null) { - // destroy session for clean up - try { - Logger.debug("Going to destroy session: " + session.getSessionID()); - AuthenticationSessionStoreage.destroySession(session.getSessionID()); - } - catch (MOADatabaseException e) { - } - } + ConfigurationDBUtils.closeSession(); + +// if (session != null) { +// // destroy session for clean up +// try { +// Logger.debug("Going to destroy session: " + session.getSessionID()); +// AuthenticationSessionStoreage.destroySession(session.getSessionID()); +// } +// catch (MOADatabaseException e) { +// } +// } } } - + /* * (non-Javadoc) * @see diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java index e40d11128..d0c28538c 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/storage/AuthenticationSessionStoreage.java @@ -209,6 +209,7 @@ public class AuthenticationSessionStoreage { //Assertion requires an unique artifact if (result.size() != 1) { Logger.trace("No entries found."); + tx.commit(); throw new MOADatabaseException("No session found with this sessionID"); } -- cgit v1.2.3