From 9913cfa7185c00238750d2b87f90d625e183b7df Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Fri, 5 May 2023 08:28:21 +0200 Subject: [PATCH] Clarify error message --- .../src/org/argeo/cms/acr/CmsContentRepository.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/org.argeo.cms/src/org/argeo/cms/acr/CmsContentRepository.java b/org.argeo.cms/src/org/argeo/cms/acr/CmsContentRepository.java index 3b47c1630..89e725043 100644 --- a/org.argeo.cms/src/org/argeo/cms/acr/CmsContentRepository.java +++ b/org.argeo.cms/src/org/argeo/cms/acr/CmsContentRepository.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; +import javax.security.auth.Subject; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; @@ -42,8 +43,11 @@ public class CmsContentRepository extends AbstractContentRepository { @Override public ContentSession get(Locale locale) { - if (!CmsSession.hasCmsSession(CurrentSubject.current())) { - if (DataAdminPrincipal.isDataAdmin(CurrentSubject.current())) { + Subject subject = CurrentSubject.current(); + if (subject == null) + throw new IllegalStateException("Caller must be authenticated"); + if (!CmsSession.hasCmsSession(subject)) { + if (DataAdminPrincipal.isDataAdmin(subject)) { // TODO open multiple data admin sessions? return getSystemSession(); } -- 2.30.2