AMSetupFilter.java revision 2d148ab324513a084980477239a7892b43c125d0
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 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: AMSetupFilter.java,v 1.12 2008/07/13 06:06:49 kevinserwin Exp $
*
* Portions Copyrighted 2011-2015 ForgeRock AS.
*/
/**
* This filter brings administrator to a configuration page
* where the product can be configured if the product is not
* yet configured.
*/
public final class AMSetupFilter implements Filter {
private boolean passthrough;
".ico", ".htm", ".css", ".js", ".jpg", ".gif", ".png",".JPG", "SMSObjectIF" , "setSetupProgress",
"setUpgradeProgress", "/legal-notices/"
};
private final AMSetupWrapper setupWrapper;
public AMSetupFilter() {
this(new AMSetupWrapper());
}
this.setupWrapper = setupWrapper;
}
/**
* Redirects request to configuration page if the product is not yet
* configured.
*
* @param request Servlet Request.
* @param response Servlet Response.
* @param filterChain Filter Chain.
* @throws IOException if configuration file cannot be read.
* @throws ServletException if there are errors in the servlet space.
*/
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException,
try {
if (setupWrapper.isCurrentConfigurationValid()) {
} else {
}
} else {
&& !setupWrapper.isUpgradeCompleted()) {
} else {
}
} else {
} else {
} else {
} else {
}
}
}
}
}
}
}
/**
* Returns <code>true</code> if the request for resources.
*
* @param httpRequest HTTP Servlet request.
* @return <code>true</code> if the request for resources.
*/
boolean ok = false;
}
return ok;
}
/**
* Destroy the filter config on sever shutdowm
*/
public void destroy() {
}
/**
* Initializes the filter.
*
* @param filterConfig Filter Configuration.
*/
//Set the encryption Key
}
}
/**
* Returns <code>true</code> if the request is allowed without processing.
*
* @return <code>true</code> if the request is allowed without processing.
*/
private boolean isPassthrough() {
return passthrough;
}
/**
* Sets the request for images such that they are not processed.
*/
private void markPassthrough() {
passthrough = true;
}
static class AMSetupWrapper {
}
return AMSetupUtils.getRandomString();
}
boolean isCurrentConfigurationValid() {
return AMSetupServlet.isCurrentConfigurationValid();
}
return AMSetupServlet.getBootStrapFile();
}
boolean isVersionNewer() {
return VersionUtils.isVersionNewer();
}
boolean isUpgradeCompleted() {
return AMSetupServlet.isUpgradeCompleted();
}
}
}
}