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

Signed-off-by: YuriyZ <yzabrovarniy@gmail.com>
  • Loading branch information
yuriyz committed Dec 5, 2023
1 parent d461661 commit 1e08809
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
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 1e08809

Please sign in to comment.