diff options
author | James Moger <james.moger@gitblit.com> | 2013-11-16 09:46:55 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-11-26 16:07:04 -0500 |
commit | a7a0b8ea01dca14602fdb49047d987c36461e861 (patch) | |
tree | e7db370fc0230c627f54b0e6eef64f1282c591e7 /src/main/java/com/gitblit/wicket/AuthorizationStrategy.java | |
parent | 718ae7b9f7970ea4475027c8ef91875c0bea5861 (diff) | |
download | gitblit-a7a0b8ea01dca14602fdb49047d987c36461e861.tar.gz gitblit-a7a0b8ea01dca14602fdb49047d987c36461e861.zip |
Refactor access to home page class
Change-Id: Ice5706dc0659a44f54e5bf29ca66580e3be22418
Diffstat (limited to 'src/main/java/com/gitblit/wicket/AuthorizationStrategy.java')
-rw-r--r-- | src/main/java/com/gitblit/wicket/AuthorizationStrategy.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/com/gitblit/wicket/AuthorizationStrategy.java b/src/main/java/com/gitblit/wicket/AuthorizationStrategy.java index e3774d82..a00e2e2f 100644 --- a/src/main/java/com/gitblit/wicket/AuthorizationStrategy.java +++ b/src/main/java/com/gitblit/wicket/AuthorizationStrategy.java @@ -19,6 +19,7 @@ import org.apache.wicket.Component; import org.apache.wicket.RestartResponseException;
import org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListener;
import org.apache.wicket.authorization.strategies.page.AbstractPageAuthorizationStrategy;
+import org.apache.wicket.markup.html.WebPage;
import com.gitblit.GitBlit;
import com.gitblit.Keys;
@@ -28,13 +29,16 @@ import com.gitblit.wicket.pages.BasePage; public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy implements
IUnauthorizedComponentInstantiationListener {
- public AuthorizationStrategy() {
+ Class<? extends WebPage> homepageClass;
+
+ public AuthorizationStrategy(Class<? extends WebPage> homepageClass) {
+ this.homepageClass = homepageClass;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected boolean isPageAuthorized(Class pageClass) {
- if (GitBlitWebApp.HOME_PAGE_CLASS.equals(pageClass)) {
+ if (homepageClass.equals(pageClass)) {
// allow all requests to get to the HomePage with its inline
// authentication form
return true;
@@ -79,7 +83,7 @@ public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy imp public void onUnauthorizedInstantiation(Component component) {
if (component instanceof BasePage) {
- throw new RestartResponseException(GitBlitWebApp.HOME_PAGE_CLASS);
+ throw new RestartResponseException(homepageClass);
}
}
}
|