The UserLoginForm did not redirect after a successful SSO Login

git-svn-id: https://svn.libreccm.org/ccm/trunk@6222 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-09-28 14:34:07 +00:00
parent 7837170b4a
commit 83e586ab37
3 changed files with 39 additions and 8 deletions

View File

@ -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);

View File

@ -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();

View File

@ -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,