LogoutViewBean.java revision 41202e15f589286770cacca433bbee5df379d00b
/**
* 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.15 2009/11/25 11:59:42 manish_rustagi Exp $
*
*/
/**
* Portions Copyrighted 2011-2012 ForgeRock Inc
*/
/**
* This class is a default implementation of <code>LogoutViewBean</code> auth
* Logout UI.
*/
public class LogoutViewBean extends AuthViewBeanBase {
/**
* 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 {
// I18N get resource bundle
} else {
}
}
if (logoutDebug.messageEnabled()) {
}
} catch (Exception e) {
}
// Get the Login URL and query map
try {
if (logoutDebug.messageEnabled()) {
+ " Cannot get Login URL");
}
}
}
// If there is a gotoUrl value and the orgDN is null do some additional processing
if (logoutDebug.messageEnabled()) {
}
// First check if there is a org parameter in request, for example realm=/sub-realm
if (logoutDebug.messageEnabled()) {
logoutDebug.message("Attempting to get orgDN from AuthUtils for serverName " + request.getServerName());
}
} else {
if (logoutDebug.messageEnabled()) {
}
}
// Last resort, get it from the root domain
}
}
if (isGotoSet()) {
if (logoutDebug.messageEnabled()) {
}
}
// set the cookie Value or set the logoutcookie string in
// the case of URL rewriting otherwise set in the responsed
// header
cookieSupported = true;
} else {
cookieSupported = false;
}
if (cookieSupported) {
} else {
if (logoutDebug.messageEnabled()) {
}
}
}
// get the Logout JSP page path
try {
if (logoutDebug.messageEnabled()) {
}
if (doSendRedirect(loginURL)) {
return;
} else {
if (queryIndex != -1) {
}
} else {
}
}
} catch (Exception e) {
if (logoutDebug.messageEnabled()) {
}
}
super.forwardTo(requestContext);
return;
}
boolean wasTokenValid = false;
try {
if (postProcessURL != null) {
}
} catch (SSOException ssoe) {
try {
if (logoutDebug.messageEnabled()) {
}
if (doSendRedirect(LOGINURL)) {
return;
} else {
}
if (logoutDebug.messageEnabled()) {
}
}
super.forwardTo(requestContext);
return;
}
if (!wasTokenValid) {
if (!isGotoSet()) {
if (originalRedirectURL != null) {
try {
if (logoutDebug.messageEnabled()) {
}
if (index != -1) {
+ "/Logout";
}
if (logoutDebug.messageEnabled()) {
"Redirect to Original Redirect URL :"
}
if (doSendRedirect(originalRedirectURL)) {
return;
}
} catch (Exception e) {
}
} else {
try {
if (logoutDebug.messageEnabled()) {
"Goto LOGINURL : "+ LOGINURL);
}
if (doSendRedirect(LOGINURL)) {
return;
} else {
}
} catch (Exception e) {
}
}
}
}
if (!redirectToGoto(locale)) {
super.forwardTo(requestContext);
}
}
}
}
}
} else {
}
if (logoutDebug.messageEnabled()) {
}
return relativeFileName;
}
/**
* 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 */
);
}
/* 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 {
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 */
static {
}
}