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", "Register:com.arsdigita.kernel.security.CookieLoginModule:optional",
"RegisterSSO:com.arsdigita.kernel.security.SimpleSSOLoginModule:requisite", "RegisterSSO:com.arsdigita.kernel.security.SimpleSSOLoginModule:requisite",
"RegisterSSO:com.arsdigita.kernel.security.CookieLoginModule:optional", "RegisterSSO:com.arsdigita.kernel.security.CookieLoginModule:optional",
"RegisterSAML:com.arsdigita.kernel.security.SamlLoginModule:requisite", // "RegisterSAML:com.arsdigita.kernel.security.SamlLoginModule:requisite",
"RegisterSAML:com.arsdigita.kernel.security.CookieLoginModule:optional" // "RegisterSAML:com.arsdigita.kernel.security.CookieLoginModule:optional"
}); });
private final Parameter m_adminEmail = new StringParameter( private final Parameter m_adminEmail = new StringParameter(
"waf.admin.contact_email", Parameter.OPTIONAL, null); "waf.admin.contact_email", Parameter.OPTIONAL, null);

View File

@ -96,6 +96,8 @@ public class UserLoginForm
private boolean m_autoRegistrationOn; private boolean m_autoRegistrationOn;
private final SecurityConfig securityConfig = SecurityConfig.getConfig(); private final SecurityConfig securityConfig = SecurityConfig.getConfig();
private boolean ssoSuccessful = false;
/** /**
* Default constructor delegates to a constructor which creates a LoginForm * Default constructor delegates to a constructor which creates a LoginForm
* without a link to a newUserRegistrationForm. * without a link to a newUserRegistrationForm.
@ -230,6 +232,7 @@ public class UserLoginForm
try { try {
Web.getUserContext().loginSSO(); Web.getUserContext().loginSSO();
s_log.info("loginSSO ok, now processing redirect_url"); s_log.info("loginSSO ok, now processing redirect_url");
ssoSuccessful = true;
process(event); process(event);
return; return;
} catch (LoginException le) { } catch (LoginException le) {
@ -326,7 +329,8 @@ public class UserLoginForm
throw new ReturnSignal(req, url); throw new ReturnSignal(req, url);
} }
//Cancel: //Cancel:
if (m_saveCancelSection.getCancelButton().isSelected(state)) { if (m_saveCancelSection.getCancelButton().isSelected(state)
|| ssoSuccessful) {
//redirect the user to the place they came from. //redirect the user to the place they came from.
try { try {
@ -339,6 +343,7 @@ public class UserLoginForm
path), path),
true); true);
} }
ssoSuccessful = false;
throw new ReturnSignal(req, refererURI); throw new ReturnSignal(req, refererURI);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -126,7 +126,8 @@ public class FreeMarkerPresentationManager implements PresentationManager {
final InputStream manifestInputStream = servletContext final InputStream manifestInputStream = servletContext
.getResourceAsStream(themeManifestPath); .getResourceAsStream(themeManifestPath);
if (manifestInputStream == null) { if (manifestInputStream == null) {
LOGGER.error(String.format("No theme manifest found at path \"%s\". " LOGGER.error(String.format(
"No theme manifest found at path \"%s\". "
+ "Falling back to \"%s\". Used sitename \"%s\".", + "Falling back to \"%s\". Used sitename \"%s\".",
themeManifestPath, themeManifestPath,
PageTransformer.class.getName(), PageTransformer.class.getName(),
@ -239,6 +240,10 @@ public class FreeMarkerPresentationManager implements PresentationManager {
new FormatDateTime(manifest.getDateFormats(), new FormatDateTime(manifest.getDateFormats(),
new Locale(selectedLocale.getLanguage()))); new Locale(selectedLocale.getLanguage())));
configuration.setSharedVariable(
"sortAttachmentList", new SortAttachmentList()
);
data.put("serverName", request.getServerName()); data.put("serverName", request.getServerName());
data.put("serverPort", request.getServerPort()); data.put("serverPort", request.getServerPort());
data.put("userAgent", request.getHeader("user-Agent")); data.put("userAgent", request.getHeader("user-Agent"));
@ -443,7 +448,6 @@ public class FreeMarkerPresentationManager implements PresentationManager {
.get(0)) .get(0))
.getAsString(); .getAsString();
ResourceBundle.clearCache(); ResourceBundle.clearCache();
final ResourceBundle bundle = ResourceBundle.getBundle(bundleName, final ResourceBundle bundle = ResourceBundle.getBundle(bundleName,
locale, locale,
@ -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( private String findContentItemTemplate(
final Templates templates, final Templates templates,
final String objectType, final String objectType,