Skip to content

Commit 13154c3

Browse files
work-ltopaolobazzi
authored andcommitted
Update subject on client session if it deviates from the on RunContext
This happens if an AccessController updates the subject. 393222
1 parent 9705635 commit 13154c3

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

  • org.eclipse.scout.rt.server.commons/src/main/java/org/eclipse/scout/rt/server/commons/authentication
  • org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html

‎org.eclipse.scout.rt.server.commons/src/main/java/org/eclipse/scout/rt/server/commons/authentication/IAccessController.java‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
2+
* Copyright (c) 2010, 2026 BSI Business Systems Integration AG
33
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0
@@ -38,13 +38,7 @@
3838
*/
3939
@Bean
4040
public interface IAccessController {
41-
42-
/**
43-
* Allows to inform the {@link org.eclipse.scout.rt.ui.html.IUiSession} that a new Subject is created by an
44-
* {@link IAccessController} that should be updated on the {@link org.eclipse.scout.rt.client.IClientSession}
45-
*/
46-
String UPDATED_SUBJECT = "scout.authentication.updatedSubject";
47-
41+
4842
/**
4943
* Invoke to authenticate the given {@link HttpServletRequest}.
5044
* <p>

‎org.eclipse.scout.rt.ui.html/src/main/java/org/eclipse/scout/rt/ui/html/UiSession.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
import org.eclipse.scout.rt.platform.util.concurrent.FutureCancelledError;
6464
import org.eclipse.scout.rt.platform.util.concurrent.ThreadInterruptedError;
6565
import org.eclipse.scout.rt.platform.util.concurrent.TimedOutError;
66-
import org.eclipse.scout.rt.server.commons.authentication.IAccessController;
6766
import org.eclipse.scout.rt.server.commons.servlet.CookieUtility;
6867
import org.eclipse.scout.rt.server.commons.servlet.HttpClientInfo;
6968
import org.eclipse.scout.rt.server.commons.servlet.UrlHints;
@@ -812,8 +811,7 @@ public JSONObject getAlreadyProcessedResponse(JsonRequest jsonRequest) {
812811

813812
/**
814813
* Verifies if an access controller has created a new {@link Subject} and replaces the current one on the
815-
* {@link IClientSession} with the new one. An {@link IAccessController} can request this by setting the
816-
* {@link IAccessController#UPDATED_SUBJECT} attribute on the request.
814+
* {@link IClientSession} with the new one.
817815
*/
818816
@Override
819817
public void verifySubject(HttpServletRequest request) {
@@ -824,7 +822,7 @@ public void verifySubject(HttpServletRequest request) {
824822
if (subject == null) {
825823
return;
826824
}
827-
if (request.getAttribute(IAccessController.UPDATED_SUBJECT) != null) {
825+
if (!ObjectUtility.equals(subject, m_clientSession.getSubject())) {
828826
m_clientSession.setSubject(subject);
829827
}
830828
}

0 commit comments

Comments
 (0)