diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-10-21 10:26:15 +0200 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-10-21 10:26:15 +0200 |
commit | 121e70662f53fe0820823a23784794021fbc7920 (patch) | |
tree | 85d7b652f4f94f4a34c3aa45851f202dfcc43437 /id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols | |
parent | 65cdf9b59c2d2836bdc24cca27992a1f32f7876e (diff) | |
download | moa-id-spss-121e70662f53fe0820823a23784794021fbc7920.tar.gz moa-id-spss-121e70662f53fe0820823a23784794021fbc7920.tar.bz2 moa-id-spss-121e70662f53fe0820823a23784794021fbc7920.zip |
fix possible multi-threading problem with database connections
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols')
-rw-r--r-- | id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/AttributQueryAction.java | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/AttributQueryAction.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/AttributQueryAction.java index 6375f26a3..cd14664f9 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/AttributQueryAction.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/AttributQueryAction.java @@ -48,9 +48,7 @@ import at.gv.egovernment.moa.id.commons.api.AuthConfiguration; import at.gv.egovernment.moa.id.commons.api.IOAAuthParameters; import at.gv.egovernment.moa.id.commons.api.IRequest; import at.gv.egovernment.moa.id.commons.api.exceptions.MOAIDException; -import at.gv.egovernment.moa.id.commons.db.MOASessionDBUtils; import at.gv.egovernment.moa.id.commons.db.dao.session.InterfederationSessionStore; -import at.gv.egovernment.moa.id.commons.db.dao.session.OASessionStore; import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.data.IAuthData; @@ -80,7 +78,6 @@ public class AttributQueryAction implements IAction { @Autowired private AuthenticationDataBuilder authDataBuilder; @Autowired private IDPCredentialProvider pvpCredentials; @Autowired private AuthConfiguration authConfig; - @Autowired private MOASessionDBUtils moaSessionDBUtils; @Autowired(required=true) private MOAMetadataProvider metadataProvider; private final static List<String> DEFAULTSTORKATTRIBUTES = Arrays.asList( @@ -192,21 +189,11 @@ public class AttributQueryAction implements IAction { AuthenticationSession session, List<Attribute> reqAttributes, InterfederationSessionStore nextIDPInformation) throws MOAIDException { try { //mark AttributeQuery as used if it exists - OASessionStore activeOA = authenticationSessionStorage.searchActiveOASSOSession(session, pendingReq.getOAURL(), pendingReq.requestedModule()); - if (activeOA != null) { - //mark - if ( pendingReq instanceof PVPTargetConfiguration && - ((PVPTargetConfiguration) pendingReq).getRequest() instanceof MOARequest && - ((PVPTargetConfiguration) pendingReq).getRequest().getInboundMessage() instanceof AttributeQuery) { - try { - activeOA.setAttributeQueryUsed(true); - moaSessionDBUtils.saveOrUpdate(activeOA); - - } catch (MOADatabaseException e) { - Logger.error("MOASession interfederation information can not stored to database.", e); - - } - } + if ( pendingReq instanceof PVPTargetConfiguration && + ((PVPTargetConfiguration) pendingReq).getRequest() instanceof MOARequest && + ((PVPTargetConfiguration) pendingReq).getRequest().getInboundMessage() instanceof AttributeQuery) { + + authenticationSessionStorage.markOAWithAttributeQueryUsedFlag(session, pendingReq.getOAURL(), pendingReq.requestedModule()); } //build OnlineApplication dynamic from requested attributes (AttributeQuerry Request) and configuration @@ -249,20 +236,16 @@ public class AttributQueryAction implements IAction { AssertionAttributeExtractor extractor = authDataBuilder.getAuthDataFromAttributeQuery(reqAttributes, nextIDPInformation.getUserNameID(), idp); - try { - //mark attribute request as used - if (nextIDPInformation.isStoreSSOInformation()) { - nextIDPInformation.setAttributesRequested(true); - moaSessionDBUtils.saveOrUpdate(nextIDPInformation); + //mark attribute request as used + if (nextIDPInformation.isStoreSSOInformation()) { + nextIDPInformation.setAttributesRequested(true); + authenticationSessionStorage.persistIdpInformation(nextIDPInformation); + //moaSessionDBUtils.saveOrUpdate(nextIDPInformation); - //delete federated IDP from Session - } else { - moaSessionDBUtils.delete(nextIDPInformation); - - } - - } catch (MOADatabaseException e) { - Logger.error("MOASession interfederation information can not stored to database.", e); + //delete federated IDP from Session + } else { + authenticationSessionStorage.deleteIdpInformation(nextIDPInformation); + //moaSessionDBUtils.delete(nextIDPInformation); } |