MNT-17850 Add configurable login page link to auth response page

The new configuration property is giving an ability to configure
a link to custom login page in Alfresco web app which is displayed
on the page after failed auth:
kerberos.authentication.sso.login.page.link


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@136663 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alex Mukha
2017-05-09 13:00:20 +00:00
parent 9c38654cfd
commit da8e77045b
2 changed files with 31 additions and 2 deletions

View File

@@ -85,6 +85,29 @@ public abstract class BaseSSOAuthenticationFilter extends BaseAuthenticationFilt
protected static final String MIME_HTML_TEXT = "text/html";
protected String loginPageLink;
/**
* @return login page link, which is send back to the client if the login fails in the filter.
* Override to change the default behaviour.
*/
public String getLoginPageLink()
{
if (loginPageLink == null || loginPageLink.isEmpty())
{
return "/faces" + getLoginPage();
}
else
{
return loginPageLink;
}
}
public void setLoginPageLink(String loginPageLink)
{
this.loginPageLink = loginPageLink;
}
/**
* @param serverConfiguration the serverConfiguration to set
*/
@@ -576,7 +599,7 @@ public abstract class BaseSSOAuthenticationFilter extends BaseAuthenticationFilt
final PrintWriter out = resp.getWriter();
out.println("<html><head>");
out.println("<meta http-equiv=\"Refresh\" content=\"0; url=" +
req.getContextPath() + "/faces" + getLoginPage() +
req.getContextPath() + getLoginPageLink() +
"\">");
out.println("</head><body><p>Please <a href=\"" +
req.getContextPath() + "/faces" + getLoginPage() +

View File

@@ -47,6 +47,12 @@ public class KerberosAuthenticationFilter extends BaseKerberosAuthenticationFilt
// Debug logging
private static Log logger = LogFactory.getLog(KerberosAuthenticationFilter.class);
@Override
public String getLoginPageLink()
{
return loginPageLink;
}
/* (non-Javadoc)
* @see org.alfresco.repo.webdav.auth.BaseSSOAuthenticationFilter#onValidateFailed(javax.servlet.ServletContext, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.http.HttpSession)
*/
@@ -92,7 +98,7 @@ public class KerberosAuthenticationFilter extends BaseKerberosAuthenticationFilt
out.println("<html><head>");
// Remove the auto refresh to avoid refresh loop, MNT-16931
// out.println("<meta http-equiv=\"Refresh\" content=\"0; url=" + req.getContextPath() + "/webdav\">");
out.println("</head><body><p>Please <a href=\"" + req.getContextPath() + "/webdav\">log in</a>.</p>");
out.println("</head><body><p>Please <a href=\"" + req.getContextPath() + getLoginPageLink() +"\">log in</a>.</p>");
out.println("</body></html>");
out.close();
}