summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java
diff options
context:
space:
mode:
authorThomas <thomas.lenz@egiz.gv.at>2019-05-04 18:06:28 +0200
committerThomas <thomas.lenz@egiz.gv.at>2019-05-04 18:06:28 +0200
commitcba8d3b1bcfbe7efbb95bca972c614d91f759322 (patch)
tree7e8f207550c9a68be765c99a8275309481dc518c /eaaf_core/src/main/java
parentf9a438a837221dae0320bcddefa6a86b6be7f75d (diff)
downloadEAAF-Components-cba8d3b1bcfbe7efbb95bca972c614d91f759322.tar.gz
EAAF-Components-cba8d3b1bcfbe7efbb95bca972c614d91f759322.tar.bz2
EAAF-Components-cba8d3b1bcfbe7efbb95bca972c614d91f759322.zip
fix bug in PendingRequestStorage
Diffstat (limited to 'eaaf_core/src/main/java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/RequestStorage.java35
1 files changed, 18 insertions, 17 deletions
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.