import org.apache.wicket.RestartResponseException;\r
import org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListener;\r
import org.apache.wicket.authorization.strategies.page.AbstractPageAuthorizationStrategy;\r
+import org.apache.wicket.markup.html.WebPage;\r
\r
import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy implements\r
IUnauthorizedComponentInstantiationListener {\r
\r
- public AuthorizationStrategy() {\r
+ Class<? extends WebPage> homepageClass;\r
+\r
+ public AuthorizationStrategy(Class<? extends WebPage> homepageClass) {\r
+ this.homepageClass = homepageClass;\r
}\r
\r
@SuppressWarnings({ "unchecked", "rawtypes" })\r
@Override\r
protected boolean isPageAuthorized(Class pageClass) {\r
- if (GitBlitWebApp.HOME_PAGE_CLASS.equals(pageClass)) {\r
+ if (homepageClass.equals(pageClass)) {\r
// allow all requests to get to the HomePage with its inline\r
// authentication form\r
return true;\r
public void onUnauthorizedInstantiation(Component component) {\r
\r
if (component instanceof BasePage) {\r
- throw new RestartResponseException(GitBlitWebApp.HOME_PAGE_CLASS);\r
+ throw new RestartResponseException(homepageClass);\r
}\r
}\r
}\r
import java.util.Map;\r
\r
import org.apache.wicket.Application;\r
-import org.apache.wicket.Page;\r
import org.apache.wicket.Request;\r
import org.apache.wicket.Response;\r
import org.apache.wicket.Session;\r
import com.gitblit.Keys;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.wicket.pages.ActivityPage;\r
-import com.gitblit.wicket.pages.BasePage;\r
import com.gitblit.wicket.pages.BlamePage;\r
import com.gitblit.wicket.pages.BlobDiffPage;\r
import com.gitblit.wicket.pages.BlobPage;\r
\r
public class GitBlitWebApp extends WebApplication {\r
\r
- public final static Class<? extends BasePage> HOME_PAGE_CLASS = MyDashboardPage.class;\r
+ private final Class<? extends WebPage> homePageClass = MyDashboardPage.class;\r
\r
private final Map<String, CacheControl> cacheablePages = new HashMap<String, CacheControl>();\r
\r
boolean useAuthentication = GitBlit.getBoolean(Keys.web.authenticateViewPages, false)\r
|| GitBlit.getBoolean(Keys.web.authenticateAdminPages, false);\r
if (useAuthentication) {\r
- AuthorizationStrategy authStrategy = new AuthorizationStrategy();\r
+ AuthorizationStrategy authStrategy = new AuthorizationStrategy(homePageClass);\r
getSecuritySettings().setAuthorizationStrategy(authStrategy);\r
getSecuritySettings().setUnauthorizedComponentInstantiationListener(authStrategy);\r
}\r
}\r
\r
@Override\r
- public Class<? extends Page> getHomePage() {\r
- return HOME_PAGE_CLASS;\r
+ public Class<? extends WebPage> getHomePage() {\r
+ return homePageClass;\r
}\r
\r
public boolean isCacheablePage(String mountPoint) {\r
add(new Label("title", siteName));\r
}\r
\r
- String rootLinkUrl = GitBlit.getString(Keys.web.rootLink, urlFor(GitBlitWebApp.HOME_PAGE_CLASS, null).toString());\r
+ String rootLinkUrl = GitBlit.getString(Keys.web.rootLink, urlFor(GitBlitWebApp.get().getHomePage(), null).toString());\r
ExternalLink rootLink = new ExternalLink("rootLink", rootLinkUrl);\r
WicketUtils.setHtmlTooltip(rootLink, GitBlit.getString(Keys.web.siteName, Constants.NAME));\r
add(rootLink);\r
PageParameters params = getPageParameters();\r
\r
DropDownMenuRegistration menu = new DropDownMenuRegistration("gb.filters",\r
- GitBlitWebApp.HOME_PAGE_CLASS);\r
+ GitBlitWebApp.get().getHomePage());\r
\r
// preserve repository filter option on time choices\r
menu.menuItems.addAll(getTimeFilterItems(params));\r