From cba8d3b1bcfbe7efbb95bca972c614d91f759322 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 4 May 2019 18:06:28 +0200 Subject: fix bug in PendingRequestStorage --- .../eaaf/core/impl/idp/auth/RequestStorage.java | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'eaaf_core/src') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java index 2b0cbab3..9758e258 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java @@ -160,14 +160,25 @@ public class RequestStorage implements IRequestStorage{ */ @Override public String changePendingRequestID(IRequest pendingRequest) throws EAAFException { - - //TODO!!!! - if (pendingRequest instanceof RequestImpl) { - //final String newRequestID = Random.nextHexRandom32(); + + //get old internal pendingReqId + String oldInternalRequestID = null; + try { + oldInternalRequestID = + pendingReqIdGenerationStrategy.getPendingRequestIdWithOutChecks(pendingRequest.getPendingRequestId()); + + } catch (final PendingReqIdValidationException e) { + //it's no problem, because it must be valid before when pending-request was loaded and we change it now + oldInternalRequestID = e.getInvalidInternalPendingReqId(); + + } + + + //generate new pendingReqId and get internalPendingReqId final String newRequestID = pendingReqIdGenerationStrategy.generateExternalPendingRequestId(); ((RequestImpl)pendingRequest).setPendingRequestId(newRequestID); - + String newInternalPendingRequestId = null; try { newInternalPendingRequestId = pendingReqIdGenerationStrategy.getPendingRequestIdWithOutChecks(newRequestID); @@ -177,20 +188,10 @@ public class RequestStorage implements IRequestStorage{ } - String oldInternalRequestID = null; - try { - oldInternalRequestID = - pendingReqIdGenerationStrategy.validateAndGetPendingRequestId(pendingRequest.getPendingRequestId()); - - } catch (final PendingReqIdValidationException e) { - //it's no problem, because it must be valid before when pending-request was loaded and we change it now - oldInternalRequestID = e.getInvalidInternalPendingReqId(); - - } + //change Key in cache log.debug("Change pendingRequestID from " + pendingRequest.getPendingRequestId() - + " to " + newRequestID); - + + " to " + newRequestID); transactionStorage.changeKey(oldInternalRequestID, newInternalPendingRequestId, pendingRequest); //only delete oldRequestID, no change. -- cgit v1.2.3