X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Fauth%2FCmsAuthUtils.java;h=dde2d73f50efffa23f6267d454e9b9c24f75de76;hb=6be83ba7b02c903dfb5aa5df9f7ef58bbbd9f6be;hp=aa313ee0a954e6b2b1fa088f9c1881d9e093de72;hpb=6d206b9052689ffa880cd4593bfefa704dc0dd46;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/auth/CmsAuthUtils.java b/org.argeo.cms/src/org/argeo/cms/auth/CmsAuthUtils.java index aa313ee0a..dde2d73f5 100644 --- a/org.argeo.cms/src/org/argeo/cms/auth/CmsAuthUtils.java +++ b/org.argeo.cms/src/org/argeo/cms/auth/CmsAuthUtils.java @@ -145,7 +145,8 @@ class CmsAuthUtils { + " for existing CMS session " + cmsSession); } // keyring - subject.getPrivateCredentials().addAll(cmsSession.getSecretKeys()); + if (cmsSession != null) + subject.getPrivateCredentials().addAll(cmsSession.getSecretKeys()); } else {// anonymous if (cmsSession.getAuthorization().getName() != null) { cmsSession.close(); @@ -157,18 +158,19 @@ class CmsAuthUtils { cmsSession = new WebCmsSessionImpl(subject, authorization, locale, request); } // request.setAttribute(CmsSession.class.getName(), cmsSession); - CmsSessionId nodeSessionId = new CmsSessionId(cmsSession.getUuid()); - if (subject.getPrivateCredentials(CmsSessionId.class).size() == 0) - subject.getPrivateCredentials().add(nodeSessionId); - else { - UUID storedSessionId = subject.getPrivateCredentials(CmsSessionId.class).iterator().next().getUuid(); - // if (storedSessionId.equals(httpSessionId.getValue())) - throw new CmsException( - "Subject already logged with session " + storedSessionId + " (not " + nodeSessionId + ")"); + if (cmsSession != null) { + CmsSessionId nodeSessionId = new CmsSessionId(cmsSession.getUuid()); + if (subject.getPrivateCredentials(CmsSessionId.class).size() == 0) + subject.getPrivateCredentials().add(nodeSessionId); + else { + UUID storedSessionId = subject.getPrivateCredentials(CmsSessionId.class).iterator().next() + .getUuid(); + // if (storedSessionId.equals(httpSessionId.getValue())) + throw new CmsException( + "Subject already logged with session " + storedSessionId + " (not " + nodeSessionId + ")"); + } } - } else - - { + } else { // TODO desktop, CLI } }