Skip to content

Commit

Permalink
fix(jans-auth-server): authz challenge session attributes are overwri…
Browse files Browse the repository at this point in the history
…tten after external script run #6933 (#6936)

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
Signed-off-by: Mustafa Baser <mbaser@mail.com>
  • Loading branch information
yuriyz authored and devrimyatar committed Dec 7, 2023
1 parent 87fbb24 commit 228d040
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -189,10 +189,16 @@ private SessionId generateAuthenticateSessionWithCookie(AuthzRequest authzReques
Map<String, String> requestParameterMap = requestParameterService.getAllowedParameters(parameterMap);

SessionId sessionUser = sessionIdService.generateAuthenticatedSessionId(authzRequest.getHttpRequest(), user.getDn(), authzRequest.getPrompt());
sessionUser.setSessionAttributes(requestParameterMap);
final Set<String> sessionAttributesKeySet = sessionUser.getSessionAttributes().keySet();
requestParameterMap.forEach((key, value) -> {
if (!sessionAttributesKeySet.contains(key)) {
sessionUser.getSessionAttributes().put(key, value);
}
});

cookieService.createSessionIdCookie(sessionUser, authzRequest.getHttpRequest(), authzRequest.getHttpResponse(), false);
sessionIdService.updateSessionId(sessionUser);
log.trace("Session updated with {}", sessionUser);

return sessionUser;
}
Expand Down

0 comments on commit 228d040

Please sign in to comment.