Skip to content

Commit 3a3b8b0

Browse files
author
Joerg Huber
committed
Fixed issue with secTokenSessions when token was updated.
1 parent f2b8799 commit 3a3b8b0

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

SIF3InfraREST/sif3InfraCommon/src/sif3/infra/common/env/mgr/DirectProviderEnvironmentManager.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,20 @@ private EnvironmentType updateSessionAndExtractEnvironment(SIF3Session sif3Sessi
450450

451451
// XML no longer needed.
452452
sif3Session.setEnvironmentXML(null);
453-
454-
// add to session Store
453+
454+
// Ok here we have to be careful. If external security services are used there is the possibility that new tokens are used for each
455+
// separate access. This means that we need to check first if there is a security token, although different, already linked to a session.
456+
SIF3Session currentSIF3Session = sessions.get(sif3Session.getSessionToken());
457+
458+
//now we can add/replace the current session in session store
455459
sessions.put(sif3Session.getSessionToken(), sif3Session);
460+
461+
// Check if we had a session and if it had a security token
462+
if ((currentSIF3Session != null) && (StringUtils.notEmpty(currentSIF3Session.getSecurityToken())))
463+
{
464+
// remove this
465+
secTokenSession.remove(currentSIF3Session.getSecurityToken());
466+
}
456467

457468
// link session to security token if it is available
458469
if (StringUtils.notEmpty(sif3Session.getSecurityToken()))

0 commit comments

Comments
 (0)