LogoutViewBean.java revision 25e37495f2591ee8f2c057f2644ed5570b4c078d
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: LogoutViewBean.java,v 1.10 2009/01/16 06:30:13 hengming Exp $
*
*/
/*
* Portions Copyrighted [2010-2011] [ForgeRock AS]
*/
/**
* This class is a default implementation of <code>LogoutViewBean</code> auth
* Logout UI.
*/
public class LogoutViewBean
/**
* Creates <code>LoginViewBean</code> object.
*/
public LogoutViewBean() {
super(PAGE_NAME);
}
/** registers child views */
protected void registerChildren() {
super.registerChildren();
}
/**
* Forwards the request to this view bean, displaying the page. This
* method is the equivalent of <code>RequestDispatcher.forward()</code>,
* meaning that the same semantics apply to the use of this method.
* This method makes implicit use of the display URL returned
* by the <code>getDisplayURL()</code> method.
* @param requestContext servlet context for auth request
*/
if (requestContext != null) {
}
if (logoutDebug.messageEnabled()) {
}
try {
ssoTokenExists = true;
if (strIndexType != null) {
}
}
if (ssoTokenExists) {
}
if (logoutDebug.messageEnabled()) {
}
} catch (Exception e) {
}
if (cookieSupported) {
} else {
if (logoutDebug.messageEnabled()) {
}
}
// Invalidate HttpSession
if (logoutJspPage!=null && logoutJspPage.length()!=0) { //default logout page: set - redirecting to the custom logout page
if (!ssoTokenExists) {
if (!isGotoSet()) {
try {
super.forwardTo(requestContext);
return;
} catch (Exception e) {
}
}
}
} else {
// get the Logout JSP page path
if (!ssoTokenExists) {
if (!isGotoSet()) {
try {
if (logoutDebug.messageEnabled()) {
}
if (doSendRedirect(LOGINURL)) {
return;
} else {
}
} catch (Exception e) {
}
}
}
}
if (!redirectToGoto(locale)) {
super.forwardTo(requestContext);
}
}
if (ssoTokenExists) {
} else {
}
if (logoutDebug.messageEnabled()) {
}
return relativeFileName;
}
private void clearAllCookies() {
// No cookie domain specified in profile
if (cookieDomainSet.isEmpty()) {
} else {
}
}
if (storeCookies != null &&
!storeCookies.isEmpty()) {
response);
}
}
}
}
}
/**
* Returns display url for auth auth Logout UI
*
* @return display url for auth auth Logout UI
*/
public String getDisplayURL() {
if (logoutDebug.messageEnabled()) {
}
return jsp_page;
}
/**
*
*
*/
if (logoutDebug.messageEnabled()) {
}
}
} else {
return super.createChild(name);
}
}
/**
* Called as notification that the JSP has begun its display
* processing. In addition to performing the default behavior in the
* superclass's version, this method executes any auto-retrieving or auto-
* executing models associated with this view unless auto-retrieval is
* disabled.
*
* @param event Display Event.
* @throws ModelControlException if manipulation of a model fails during
* display preparation or execution of auto-retrieving models.
*/
throws ModelControlException {
}
/* returns the url encoded with the logout cookie string */
return AuthClientUtils.addLogoutCookieToURL(
}
/* Checks if request should use sendRedirect */
}
// Check whether the 'goto' query parameter value exists or not
private boolean isGotoSet() {
return true;
} else {
return false;
}
}
// Redirect to the 'goto' query parameter value
if (isGotoSet()) {
if (logoutDebug.messageEnabled()) {
}
try {
} catch (MalformedURLException murle) {
if (logoutDebug.warningEnabled()) {
+ gotoUrl);
}
return false;
}
try {
if (doSendRedirect(gotoUrl)) {
return true;
}
}
} catch (Exception e) {
if (logoutDebug.messageEnabled()) {
"'goto' Redirect failed : " + gotoUrl, e);
}
}
}
return false;
}
/**
* Handles href logout request
* @param event request invocation event
* @throws ServletException if it fails to forward logout request
* @throws IOException if it fails to forward logout request
*/
throws ServletException, IOException {
//ViewBean targetView = getViewBean(LoginViewBean.class);
//targetView.forwardTo(getRequestContext());
forwardTo();
}
////////////////////////////////////////////////////////////////////////////
// Display cycle events:
// If the fireDisplayEvents attribute in a display field tag is set to true,
// then the begin/endDisplay events will fire for that display field.
////////////////////////////////////////////////////////////////////////////
/**
* Using the display cycle event to adjust the value of a given field
*
*/
/**
* Returns if it begins href logout display
* @param event child display event
* @return <code>true</code> by default.
*/
return true;
}
/**
* Returns if it begins content href logout display
* @param event child display event
* @return <code>true</code> by default.
*/
return true;
}
/**
* Returns if it begins static text logout display
* @param event child display event
* @return <code>true</code> by default.
*/
return true;
}
/**
* Returns tile Index.
*
* @return Tile index.
*/
public String getTileIndex() {
return "";
}
/**
* Returns <code>true</code> to display static text content.
*
* @param event Child display event.
* @return <code>true</code> to display static text content.
*/
return true;
}
if (e instanceof L10NMessage) {
} else {
return e.getMessage();
}
}
////////////////////////////////////////////////////////////////////////////
// Class variables
////////////////////////////////////////////////////////////////////////////
/** Default page name */
////////////////////////////////////////////////////////////////////////////
// Instance variables
////////////////////////////////////////////////////////////////////////////
/** Logout result value */
/** Goto url */
/** JSP page */
/** Resource bundle for <code>Locale</code> */
private boolean cookieSupported;
/** Default parameter name for login url */
/** Default parameter name for logout text */
/** Default parameter name for goto login text after logout */
public static final String TXT_GOTO_LOGIN_AFTER_LOGOUT =
"txtGotoLoginAfterLogout";
/** Default parameter name for logout html title */
private boolean ssoTokenExists = false;
static {
}
}