- public final static Set<String> roles(Subject subject) {
- Set<String> roles = new HashSet<String>();
- roles.add(getUsername(subject));
- for (Principal group : subject.getPrincipals(Group.class)) {
- roles.add(group.getName());
- }
- return roles;
+ // public static boolean isAuthenticated() {
+ // return getAccessControllerSubject() != null;
+ // }
+
+ /**
+ * The node authenticated component (typically a CMS view) related to this
+ * display, or null if none is available from this call. <b>Not API: Only for
+ * low-level access.</b>
+ */
+ // private static CmsAuthenticated getNodeAuthenticated() {
+ // return UiContext.getData(CmsAuthenticated.KEY);
+ // }
+
+ private static Authorization getAuthorization(Subject subject) {
+ return subject.getPrivateCredentials(Authorization.class).iterator().next();
+ }
+
+ public static boolean logoutCmsSession(Subject subject) {
+ UUID nodeSessionId;
+ if (subject.getPrivateCredentials(CmsSessionId.class).size() == 1)
+ nodeSessionId = subject.getPrivateCredentials(CmsSessionId.class).iterator().next().getUuid();
+ else
+ return false;
+ CmsSessionImpl cmsSession = CmsSessionImpl.getByUuid(nodeSessionId.toString());
+ cmsSession.close();
+ // if (log.isDebugEnabled())
+ // log.debug("Logged out CMS session " + cmsSession.getUuid());
+ return true;