| | |
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.wicket.pages.BasePage;
|
| | | import com.gitblit.wicket.pages.LoginPage;
|
| | | import com.gitblit.wicket.pages.RepositoriesPage;
|
| | |
|
| | | public class AuthorizationStrategy extends AbstractPageAuthorizationStrategy implements
|
| | |
| | | @SuppressWarnings({ "unchecked", "rawtypes" })
|
| | | @Override
|
| | | protected boolean isPageAuthorized(Class pageClass) {
|
| | | if (RepositoriesPage.class.equals(pageClass)) {
|
| | | // allow all requests to get to the RepositoriesPage with its inline
|
| | | // authentication form
|
| | | return true;
|
| | | }
|
| | |
|
| | | if (BasePage.class.isAssignableFrom(pageClass)) {
|
| | | boolean authenticateView = GitBlit.getBoolean(Keys.web.authenticateViewPages, true);
|
| | | boolean authenticateAdmin = GitBlit.getBoolean(Keys.web.authenticateAdminPages, true);
|
| | |
| | | @Override
|
| | | public void onUnauthorizedInstantiation(Component component) {
|
| | | if (component instanceof BasePage) {
|
| | | GitBlitWebSession session = GitBlitWebSession.get();
|
| | | if (!session.isLoggedIn()) {
|
| | | throw new RestartResponseAtInterceptPageException(LoginPage.class);
|
| | | } else {
|
| | | throw new RestartResponseAtInterceptPageException(RepositoriesPage.class);
|
| | | }
|
| | | throw new RestartResponseAtInterceptPageException(RepositoriesPage.class);
|
| | | }
|
| | | }
|
| | | }
|