Skip to content

Commit bbd4ea4

Browse files
committed
Remove 'leaving secure site' redirect page from Struts project
1 parent aa2743a commit bbd4ea4

8 files changed

Lines changed: 11 additions & 60 deletions

File tree

gocwebtemplate-core/gocwebtemplate-core-base/src/main/java/goc/webtemplate/component/BaseUtil.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
import goc.webtemplate.Constants;
99

1010
public final class BaseUtil {
11-
public static void doLeaveSecureSite(HttpServletRequest req, HttpServletResponse res) throws Exception { //TODO: Remove this once no longer referenced
12-
String redirectUrl = URLDecoder.decode(req.getParameter("targetUrl"), "UTF-8");
13-
res.sendRedirect(redirectUrl);
14-
}
15-
1611
public static void doLocaleSwitch(HttpServletRequest req, HttpServletResponse res) throws Exception {
1712
String currLang = req.getSession().getAttribute(Constants.CURRENT_LANG_SESSION_KEY) == null ?
1813
req.getLocale().getLanguage() :

gocwebtemplate-core/gocwebtemplate-core-jsp/src/main/java/goc/webtemplate/component/jsp/BaseCoreBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected String getDefaultLanguageLinkUrl() {
3535

3636
@Override
3737
protected String getDefaultLeaveSecureSiteRedirectUrl() {
38-
return "leavesecuresiteredirect.action";
38+
return null;
3939
}
4040

4141
@Override

gocwebtemplate-core/gocwebtemplate-core-jsp/src/main/java/goc/webtemplate/component/jsp/LeaveSecureSiteAction.java

Lines changed: 0 additions & 11 deletions
This file was deleted.

gocwebtemplate-sample-jsp/src/main/java/goc/webtemplate/jsp/samplebeans/LeaveSecureSiteSampleBean.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public void onWebTemplateInitialize() {
1212

1313
lssw.setEnabled(true);
1414
lssw.setMessage("You are about to leave a secure site, do you wish to continue?");
15-
lssw.setRedirectUrl("leavesecuresiteredirect.action");
1615
lssw.setExcludedDomains("www.esdc.gc.ca,www.jobbank.gc.ca,www.readseal.ca");
1716
lssw.setCancelMessage("Don't leave");
1817
lssw.setYesMessage("Yes, leave this site");

gocwebtemplate-sample-jsp/src/main/resources/struts.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
<result-types>
1414
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
1515
</result-types>
16-
<action name="leavesecuresiteredirect" class="goc.webtemplate.component.jsp.LeaveSecureSiteAction" method="execute"></action>
1716
<action name="switchlocale" class="goc.webtemplate.component.jsp.SwitchLocaleAction" method="execute"></action>
1817
<!-- ============================================================== -->
1918

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
For the up to date release/change log, please refer to:
22

3-
https://gccode.ssc-spc.gc.ca/iitb-dgiit/sds/GOCWebTemplates/JavaTemplates/releases
3+
https://github.com/wet-boew/cdts-JavaTemplates/releases

gocwebtemplate-sample-jsp/src/main/webapp/samplecontents/leavesecuresitesamplecontent.jsp

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
<ul>
1818
<li>display the message to the user in the form of a modal window</li>
1919
<li>display the message your application provides</li>
20-
<li>allow your application to execute any clean up code (ex: close session, gracefully logout user etc...)</li>
2120
<li>allow your application to exlude any domains from raising the warning</li>
21+
<li>optionally, allow your application to execute any clean up code (ex: close session, gracefully logout user etc...)</li>
2222
</ul>
2323
<h2>How it works</h2>
2424
<ul>
@@ -29,29 +29,21 @@
2929
<li>A "Yes" button appears on the window to allow the user to continue with the redirection to the selected link. (Text can be customized, see below.)</li>
3030
</ul>
3131
</li>
32-
<li>if the "Yes" button is clicked:
33-
<ul>
34-
<li>the user will first be redirect to the url set in <code class="wb-prettify">"leavingSecureSiteRedirectUrl"</code> via either the cdn.properties file or programmatically</li>
35-
<li>the info of the linked that was clicked is part of the querystring to that url</li>
36-
<li>in the redirect url provided earlier, attach the preRenderView event to the page and execute a custom bean method to perform the redirect</li>
37-
<li>execute any clean up code your application requires</li>
38-
<li>once executed the custom bean class will redirect the user to the url of the clicked link</li>
39-
<li>the leave secure site feature is already provided by default as part of the GoC Web Template package, by default it will use the templates/leavesecuresiteredirect.xhtml page</li>
40-
<li>by default the leave secure site redirect page will invoke the <code class="wb-prettify">leavesecuresiteredirect.action</code> Struts Action already pre-registered in struts.xml</li>
41-
</ul>
32+
<li>if the "Yes" button is clicked, the browser will be directed to the external link</li>
33+
<li>optionally, a redirect url can be set in <code class="wb-prettify">"leavingSecureSiteRedirectUrl"</code> via either the cdn.properties file or programmatically.
34+
If this is used, the browser will be directed to this page before leaving, where the application can terminate the user's session and let them proceed to the external link.
35+
The external link will be presented to the user by placing an element <code class="wb-prettify">&lt;span class="wb-exitscript wb-exitscript-exiturlparam"&gt;&lt;/span&gt;</code> on the page.
36+
For an example of a "middle page", refer to <a href="https://wet-boew.github.io/wet-boew/demos/exitscript/exitscript-en.html#wb-auto-3">scenario 3 link in the WET Documentation</a>.
4237
</li>
4338
</ul>
4439
<p>Here is a local link that will not display the warning: <a href="basesettingssample.action">Link to Local Page</a></p>
45-
<p>Here is an external link that will display the warning:<a href="https://gccode.ssc-spc.gc.ca/iitb-dgiit/sds/GOCWebTemplates/JavaTemplates/wikis/Redirect-Page">Link to External Page</a></p>
40+
<p>Here is an external link that will display the warning:<a href="https://github.com/wet-boew/cdts-JavaTemplates/wiki/Redirect-Page">Link to External Page</a></p>
4641
<h2>Steps to implement:</h2>
4742
<h3>Enable the leaving secure site feature</h3>
4843
<ul>
4944
<li>Set, via the cdn.properties file or programmatically in your custom bean class, <code class="wb-prettify">"Enabled"</code> to <strong>"true"</strong></li>
5045
<li>Provide the message to be displayed by setting the <code class="wb-prettify">"Message"</code> programmatically via the <code class="wb-prettify">setLeavingSecureSiteWarning</code> method in your custom bean class.</li>
51-
<li>Set, via the cdn.properties file or programmatically in your custom bean class, <code class="wb-prettify">"RedirectUrl"</code> to your action class which will execute your clean up code and then redirect to the selected url.</li>
5246
<li>Set, via the cdn.properties or programmatically in your custom bean class, <code class="wb-prettify">"ExcludedDomain"</code> the list of domains you do not want to raise the warning</li>
53-
<li>Optionally, provide a cancel message by setting the <code class="wb-prettify">"CancelMessage"</code> programmatically via the <code class="wb-prettify">setLeavingSecureSiteWarning</code> method in your custom bean class.</li>
54-
<li>Optionally, provide a yes message by setting the <code class="wb-prettify">"YesMessage"</code> programmatically via the <code class="wb-prettify">setLeavingSecureSiteWarning</code> method in your custom bean class.</li>
5547
</ul>
5648
<div class="wb-prettify all-pre lang-vb linenums">
5749
<pre>
@@ -62,7 +54,6 @@ public void onWebTemplateInitialize() {
6254

6355
lssw.setEnabled(true);
6456
lssw.setMessage("You are about to leave a secure site, do you wish to continue?");
65-
lssw.setRedirectUrl("leavesecuresiteredirect.action");
6657
lssw.setExcludedDomains("www.esdc.gc.ca,www.jobbank.gc.ca,www.readseal.ca");
6758
lssw.setCancelMessage("Don't leave");
6859
lssw.setYesMessage("Yes, leave this site");
@@ -73,26 +64,4 @@ public void onWebTemplateInitialize() {
7364
}
7465
</pre>
7566
</div>
76-
<h3>Created your custom "redirect" class</h3>
77-
<ul>
78-
<li>Create a class and a public method will be invoked by the preRenderView event of the redirect url</li>
79-
<li>enter your clean up code if required</li>
80-
<li>redirect to the <code class="wb-prettify">"targetURL"</code> parameter value in the querystring</li>
81-
</ul>
82-
<div class="wb-prettify all-pre lang-vb linenums">
83-
<h3>Code Sample for your Redirect action class</h3>
84-
<pre>
85-
import java.net.URLDecoder;
86-
import javax.servlet.http.HttpServletRequest;
87-
import org.apache.struts2.ServletActionContext;
88-
89-
public class LeaveSecureSiteAction {
90-
public void execute() throws Exception {
91-
HttpServletRequest currentReq = ServletActionContext.getRequest();
92-
String redirectUrl = URLDecoder.decode(currentReq.getParameter("targetUrl"), "UTF-8");
93-
ServletActionContext.getResponse().sendRedirect(redirectUrl);
94-
}
95-
}
96-
</pre>
97-
</div>
9867
<%@ include file="_sampleslist.jsp" %>

gocwebtemplate-sample-spring/src/main/resources/samples/LeavingSecureSiteSample.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ <h2>How it works</h2>
3636
<li>optionally, a redirect url can be set in <code class="wb-prettify">"leavingSecureSiteRedirectUrl"</code> via either the cdn.properties file or programmatically.
3737
If this is used, the browser will be directed to this page before leaving, where the application can terminate the user's session and let them proceed to the external link.
3838
The external link will be presented to the user by placing an element <code class="wb-prettify">&lt;span class="wb-exitscript wb-exitscript-exiturlparam"&gt;&lt;/span&gt;</code> on the page.
39-
An example of "middle page" is available in the <a href="https://wet-boew.github.io/wet-boew/docs/ref/exitscript/exiturl-en.html?exturl=http%3A%2F%2Fcsszengarden.com%2F219">WET Documentation</a>.
39+
For an example of a "middle page", refer to <a href="https://wet-boew.github.io/wet-boew/demos/exitscript/exitscript-en.html#wb-auto-3">scenario 3 link in the WET Documentation</a>.
4040
</li>
4141
</ul>
4242
<p>Here is a local link that will not display the warning: <a href="BaseSettingsSample">Link to Local Page</a></p>
43-
<p>Here is an external link that will display the warning: <a href="https://gccode.ssc-spc.gc.ca/iitb-dgiit/sds/GOCWebTemplates/JavaTemplates/wikis/Redirect-Page">Link to External Page</a></p>
43+
<p>Here is an external link that will display the warning: <a href="https://github.com/wet-boew/cdts-JavaTemplates/wiki/Redirect-Page">Link to External Page</a></p>
4444
<h2>Steps to implement:</h2>
4545
<h3>Enable the leaving secure site feature</h3>
4646
<ul>

0 commit comments

Comments
 (0)