diff --git a/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java b/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java index 9a2dea80e..edb0f98d3 100755 --- a/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java +++ b/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java @@ -127,8 +127,8 @@ public class SecurityConfig extends AbstractConfig { "Register:com.arsdigita.kernel.security.CookieLoginModule:optional", "RegisterSSO:com.arsdigita.kernel.security.SimpleSSOLoginModule:requisite", "RegisterSSO:com.arsdigita.kernel.security.CookieLoginModule:optional", - "RegisterSAML:com.arsdigita.kernel.security.SamlLoginModule:requisite", - "RegisterSAML:com.arsdigita.kernel.security.CookieLoginModule:optional" +// "RegisterSAML:com.arsdigita.kernel.security.SamlLoginModule:requisite", +// "RegisterSAML:com.arsdigita.kernel.security.CookieLoginModule:optional" }); private final Parameter m_adminEmail = new StringParameter( "waf.admin.contact_email", Parameter.OPTIONAL, null); diff --git a/ccm-core/src/com/arsdigita/ui/login/UserLoginForm.java b/ccm-core/src/com/arsdigita/ui/login/UserLoginForm.java index 3b0970ea1..af6def069 100755 --- a/ccm-core/src/com/arsdigita/ui/login/UserLoginForm.java +++ b/ccm-core/src/com/arsdigita/ui/login/UserLoginForm.java @@ -95,6 +95,8 @@ public class UserLoginForm private Password m_password; private boolean m_autoRegistrationOn; private final SecurityConfig securityConfig = SecurityConfig.getConfig(); + + private boolean ssoSuccessful = false; /** * Default constructor delegates to a constructor which creates a LoginForm @@ -230,6 +232,7 @@ public class UserLoginForm try { Web.getUserContext().loginSSO(); s_log.info("loginSSO ok, now processing redirect_url"); + ssoSuccessful = true; process(event); return; } catch (LoginException le) { @@ -326,7 +329,8 @@ public class UserLoginForm throw new ReturnSignal(req, url); } //Cancel: - if (m_saveCancelSection.getCancelButton().isSelected(state)) { + if (m_saveCancelSection.getCancelButton().isSelected(state) + || ssoSuccessful) { //redirect the user to the place they came from. try { @@ -339,6 +343,7 @@ public class UserLoginForm path), true); } + ssoSuccessful = false; throw new ReturnSignal(req, refererURI); } catch (URISyntaxException e) { e.printStackTrace(); diff --git a/ccm-themedirector/src/org/libreccm/theming/FreeMarkerPresentationManager.java b/ccm-themedirector/src/org/libreccm/theming/FreeMarkerPresentationManager.java index 48ed15609..d34efd36f 100644 --- a/ccm-themedirector/src/org/libreccm/theming/FreeMarkerPresentationManager.java +++ b/ccm-themedirector/src/org/libreccm/theming/FreeMarkerPresentationManager.java @@ -72,7 +72,7 @@ public class FreeMarkerPresentationManager implements PresentationManager { pageTransformer.servePage(document, request, response); return; } - + final org.w3c.dom.Document w3cDocument = document.getInternalDocument(); final Node root = w3cDocument.getDocumentElement(); @@ -126,8 +126,9 @@ public class FreeMarkerPresentationManager implements PresentationManager { final InputStream manifestInputStream = servletContext .getResourceAsStream(themeManifestPath); if (manifestInputStream == null) { - LOGGER.error(String.format("No theme manifest found at path \"%s\". " - + "Falling back to \"%s\". Used sitename \"%s\".", + LOGGER.error(String.format( + "No theme manifest found at path \"%s\". " + + "Falling back to \"%s\". Used sitename \"%s\".", themeManifestPath, PageTransformer.class.getName(), currentSiteName)); @@ -239,6 +240,10 @@ public class FreeMarkerPresentationManager implements PresentationManager { new FormatDateTime(manifest.getDateFormats(), new Locale(selectedLocale.getLanguage()))); + configuration.setSharedVariable( + "sortAttachmentList", new SortAttachmentList() + ); + data.put("serverName", request.getServerName()); data.put("serverPort", request.getServerPort()); data.put("userAgent", request.getHeader("user-Agent")); @@ -253,7 +258,7 @@ public class FreeMarkerPresentationManager implements PresentationManager { response.setCharacterEncoding(StandardCharsets.UTF_8.toString()); response.setContentType("text/html"); - try (PrintWriter writer = response.getWriter()) { + try ( PrintWriter writer = response.getWriter()) { template.process(data, writer); @@ -442,7 +447,6 @@ public class FreeMarkerPresentationManager implements PresentationManager { final String key = ((TemplateScalarModel) list .get(0)) .getAsString(); - ResourceBundle.clearCache(); final ResourceBundle bundle = ResourceBundle.getBundle(bundleName, @@ -604,6 +608,28 @@ public class FreeMarkerPresentationManager implements PresentationManager { } + private class SortAttachmentList implements TemplateMethodModelEx { + + public SortAttachmentList() { + super(); + } + + @Override + public Object exec(final List list) throws TemplateModelException { + + if (list.isEmpty() || list.size() != 2) { + throw new IllegalArgumentException( + "SortAttachmentList requires the following parameters: " + + "list: list to sort, " + + "attribute: Attribute to use for sorting" + ); + } + + return list.get(0); + } + + } + private String findContentItemTemplate( final Templates templates, final String objectType,