• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UnauthorizedInstantiationException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.wicket.authorization.UnauthorizedInstantiationException的典型用法代码示例。如果您正苦于以下问题:Java UnauthorizedInstantiationException类的具体用法?Java UnauthorizedInstantiationException怎么用?Java UnauthorizedInstantiationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnauthorizedInstantiationException类属于org.apache.wicket.authorization包,在下文中一共展示了UnauthorizedInstantiationException类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: AclsPage

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
/**
 * Creates an acls page and opens the permission target for editing.
 *
 * @param ptiToEdit Permission target to edit
 */
public AclsPage(final MutablePermissionTargetInfo ptiToEdit) {
    // only admins can reach here
    if (!authService.isAdmin()) {
        throw new UnauthorizedInstantiationException(AclsPage.class);
    }
    // create the panel
    final PermissionTargetListPanel panel = new PermissionTargetListPanel("permissionTargetList");
    add(panel);

    if (ptiToEdit != null) {
        // use very short ajax timer to open the edit panel
        add(new AbstractAjaxTimerBehavior(Duration.milliseconds(1)) {
            @Override
            protected void onTimer(AjaxRequestTarget target) {
                stop(); // don't fire again
                ModalHandler modalHandler = ModalHandler.getInstanceFor(AclsPage.this);
                modalHandler.setModalPanel(panel.newUpdateItemPanel(ptiToEdit));
                modalHandler.show(target);
            }
        });
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:28,代码来源:AclsPage.java


示例2: AdminPage

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
public AdminPage() {
    if (authService.isAdmin()) {
        // for now redirect all valid admin requests to the general configuration tab
        throw new RestartResponseException(GeneralConfigPage.class);
    } else if (authService.hasPermission(ArtifactoryPermission.MANAGE)) {
        throw new RestartResponseException(AclsPage.class);
    }

    // In this special condition when no license is installed we allow non-admin to visit the license page
    addonsWebManager.onNoInstalledLicense(false, new NoInstalledLicenseAction() {
        @Override
        public void act() {
            throw new RestartResponseException(LicensePage.class);
        }
    });

    // If non of the above is applicable, then the user is unauthorized!
    throw new UnauthorizedInstantiationException(getClass());
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:20,代码来源:AdminPage.java


示例3: LicensePage

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
public LicensePage() {
    Form form = new SecureForm("form");
    add(form);

    LicensePanel licensePanel = new LicensePanel("licensePanel");
    form.add(licensePanel);

    form.add(licensePanel.createSaveButton(form));
    form.add(createCancelButton());

    if (addonsManager.isLicenseInstalled() && !authService.isAdmin()) {
        throw new UnauthorizedInstantiationException(getClass());
    }

    CookieUtils.setCookie(LicensePage.COOKIE_LICENSE_PAGE_VISITED, "true");
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:17,代码来源:LicensePage.java


示例4: onUnauthorizedInstantiation

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
/**
 * @see IUnauthorizedComponentInstantiationListener#onUnauthorizedInstantiation(Component)
 */
@Override
public final void onUnauthorizedInstantiation(final Component component) {
    // If there is a sign in page class declared, and the unauthorized
    // component is a page, but it's not the sign in page
    if (component instanceof Page) {
        if (!AbstractAuthenticatedWebSession.get().isSignedIn()) {
            // Redirect to intercept page to let the user sign in
            restartResponseAtSignInPage();
        } else {
            onUnauthorizedPage((Page) component);
        }
    } else {
        // The component was not a page, so throw an exception
        throw new UnauthorizedInstantiationException(component.getClass());
    }
}
 
开发者ID:PkayJava,项目名称:pluggable,代码行数:20,代码来源:AuthenticatedWebApplication.java


示例5: onUnauthorizedInstantiation

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(final Component component) {
    SyncopeSession.get().invalidate();

    if (component instanceof Page) {
        throw new UnauthorizedInstantiationException(component.getClass());
    }

    throw new RestartResponseAtInterceptPageException(Login.class);
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:11,代码来源:SyncopeApplication.java


示例6: checkUnauthArea

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
private void checkUnauthArea(AreaKeys area, String type, String... users) throws OmException {
	for (String user : users) {
		log.debug("Positive test:: area: {}, type: {} for user: {}", area, type, user);
		testArea(user, p -> {
			tester.getRequest().setParameter(area.name(), type);
			try {
				tester.executeBehavior((AbstractAjaxBehavior)p.getBehaviorById(1));
				fail("Not authorized");
			} catch (UnauthorizedInstantiationException e) {
				assertTrue("Exception is expected", true);
			}
		});
	}
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:15,代码来源:TestMainAreas.java


示例7: getRepos

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
private List<LocalRepoDescriptor> getRepos() {
    List<LocalRepoDescriptor> repos = repoService.getDeployableRepoDescriptors();
    if (repos.isEmpty()) {
        throw new UnauthorizedInstantiationException(DeployArtifactPage.class);
    }
    Collections.sort(repos, new LocalRepoAlphaComparator());
    return repos;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:9,代码来源:DeployArtifactPanel.java


示例8: testStaticPageForSigned

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
@Test(expected=UnauthorizedInstantiationException.class)
public void testStaticPageForSigned()
{
	WicketOrientDbTester tester = wicket.getTester();
	assertEquals(tester.getApplication().getOrientDbSettings().getGuestUserName(), tester.getDatabase().getUser().getName());
	assertTrue(tester.signIn("reader", "reader"));
	tester.startPage(StaticSecuredPage.class);
	tester.signOut();
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:10,代码来源:TestSecurity.java


示例9: testDynamicPageForSigned

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
@Test(expected=UnauthorizedInstantiationException.class)
public void testDynamicPageForSigned()
{
	WicketOrientDbTester tester = wicket.getTester();
	assertEquals(tester.getApplication().getOrientDbSettings().getGuestUserName(), tester.getDatabase().getUser().getName());
	assertTrue(tester.signIn("reader", "reader"));
	tester.startPage(DynamicSecuredPage.class);
	tester.signOut();
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:10,代码来源:TestSecurity.java


示例10: onUnauthorizedComponentInstantiation

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
protected void onUnauthorizedComponentInstantiation(Component component) {
	throw new UnauthorizedInstantiationException(component.getClass());
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:4,代码来源:AbstractUnauthorizedComponentInstantiationListener.java


示例11: onUnauthorizedInstantiation

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
@Override
public void onUnauthorizedInstantiation(Component component) {
	throw new UnauthorizedInstantiationException(component.getClass());
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:5,代码来源:StandardUnauthorizedComponentInstantiationListener.java


示例12: onException

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public IRequestHandler onException(final RequestCycle cycle,
        final Exception e) {

    LOG.error("Exception found", e);

    final Page errorPage;
    PageParameters errorParameters = new PageParameters();
    errorParameters.add("errorTitle",
            new StringResourceModel("alert", null).getString());

    if (e instanceof UnauthorizedInstantiationException) {
        errorParameters.add("errorMessage", new StringResourceModel(
                "unauthorizedInstantiationException", null).getString());

        errorPage = new ErrorPage(errorParameters);
    } else if (e instanceof HttpClientErrorException) {
        errorParameters.add("errorMessage",
                new StringResourceModel("httpClientException", null).
                getString());

        errorPage = new ErrorPage(errorParameters);
    } else if (e instanceof PageExpiredException
            || !(SyncopeSession.get()).isAuthenticated()) {

        errorParameters.add("errorMessage",
                new StringResourceModel("pageExpiredException", null).
                getString());

        errorPage = new ErrorPage(errorParameters);
    } else if (e.getCause() != null && e.getCause().getCause() != null
            && e.getCause().getCause() instanceof RestClientException) {

        errorParameters.add("errorMessage",
                new StringResourceModel("restClientException", null).
                getString());

        errorPage = new ErrorPage(errorParameters);
    } else {
        // redirect to default Wicket error page
        errorPage = new ExceptionErrorPage(e, null);
    }

    return new ComponentRenderingRequestHandler(errorPage);
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:49,代码来源:SyncopeRequestCycleListener.java


示例13: checkAuthorization

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
private void checkAuthorization() {
    if (!authorizationService.canDeployToLocalRepository()) {
        throw new UnauthorizedInstantiationException(DeployArtifactPage.class);
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:6,代码来源:DeployArtifactPage.java


示例14: onException

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
@Override
public IRequestHandler onException(final RequestCycle cycle, final Exception e) {
    LOG.error("Exception found", e);

    PageParameters errorParameters = new PageParameters();

    IRequestablePage errorPage = null;
    if (instanceOf(e, UnauthorizedInstantiationException.class) != null) {
        errorParameters.add("errorMessage", MISSING_AUTHORIZATION);
        errorPage = new Login(errorParameters);
    } else if (instanceOf(e, AccessControlException.class) != null) {
        if (instanceOf(e, AccessControlException.class).getMessage().contains("expired")) {
            errorParameters.add("errorMessage", PAGE_EXPIRED);
        } else {
            errorParameters.add("errorMessage", MISSING_AUTHORIZATION_CORE);
        }
        errorPage = new Login(errorParameters);
    } else if (instanceOf(e, PageExpiredException.class) != null || !SyncopeConsoleSession.get().isSignedIn()) {
        errorParameters.add("errorMessage", PAGE_EXPIRED);
        errorPage = new Login(errorParameters);
    } else if (instanceOf(e, BadRequestException.class) != null
            || instanceOf(e, WebServiceException.class) != null
            || instanceOf(e, SyncopeClientException.class) != null) {

        errorParameters.add("errorMessage", REST);
        errorPage = new Login(errorParameters);
    } else {
        Throwable cause = instanceOf(e, ForbiddenException.class);
        if (cause == null) {
            // redirect to default Wicket error page
            errorPage = new ExceptionErrorPage(e, null);
        } else {
            errorParameters.add("errorMessage", cause.getMessage());
            errorPage = new Login(errorParameters);
        }
    }

    if (errorPage instanceof Login) {
        try {
            SyncopeConsoleSession.get().cleanup();
            SyncopeConsoleSession.get().invalidateNow();
        } catch (Throwable t) {
            // ignore
            LOG.debug("Unexpected error while forcing logout after error", t);
        }
    }

    return new RenderPageRequestHandler(new PageProvider(errorPage));
}
 
开发者ID:apache,项目名称:syncope,代码行数:50,代码来源:SyncopeConsoleRequestCycleListener.java


示例15: ExceptionErrorPage

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
/**
 * Constructor.
 * 
 * @param throwable
 *            The exception to show
 * @param page
 *            The page being rendered when the exception was thrown
 */
public ExceptionErrorPage(final Throwable throwable, final Page page) {
    ErrorLayout layout = new ErrorLayout("layout");
    add(layout);

    this.throwable = throwable;

    WebMarkupContainer accessDeniedException = new WebMarkupContainer("accessDeniedException");
    layout.add(accessDeniedException);

    WebMarkupContainer unknownException = new WebMarkupContainer("unknownException");
    layout.add(unknownException);

    BookmarkablePageLink<Void> loginLink = null;

    AbstractWebApplication authenticatedWebApplication = (AbstractWebApplication) getApplication();
    loginLink = new BookmarkablePageLink<Void>("loginLink", authenticatedWebApplication.getSignInPageClass());

    accessDeniedException.add(loginLink);

    Label message = new Label("message", throwable.getMessage());
    accessDeniedException.add(message);

    if (throwable instanceof UnauthorizedInstantiationException) {
        accessDeniedException.setVisible(true);
        unknownException.setVisible(false);
    } else {
        accessDeniedException.setVisible(false);
        unknownException.setVisible(true);
    }

    // Add exception label
    unknownException.add(new MultiLineLabel("exception", getErrorMessage(throwable)));
    unknownException.add(new BookmarkablePageLink<Void>("homePageLink", getApplication().getHomePage()));

    // Get values
    String resource = "";
    String markup = "";
    MarkupStream markupStream = null;

    if (throwable instanceof MarkupException) {
        markupStream = ((MarkupException) throwable).getMarkupStream();

        if (markupStream != null) {
            markup = markupStream.toHtmlDebugString();
            resource = markupStream.getResource().toString();
        }
    }

    // Create markup label
    MultiLineLabel markupLabel = new MultiLineLabel("markup", markup);

    markupLabel.setEscapeModelStrings(false);

    // Add container with markup highlighted
    WebMarkupContainer markupHighlight = new WebMarkupContainer("markupHighlight");

    markupHighlight.add(markupLabel);
    markupHighlight.add(new Label("resource", resource));
    layout.add(markupHighlight);

    // Show container if markup stream is available
    markupHighlight.setVisible(markupStream != null);

    layout.add(new MultiLineLabel("stacktrace", getStackTrace(throwable)));
}
 
开发者ID:PkayJava,项目名称:pluggable,代码行数:74,代码来源:ExceptionErrorPage.java


示例16: onUnauthorizedPage

import org.apache.wicket.authorization.UnauthorizedInstantiationException; //导入依赖的package包/类
/**
 * Called when an AUTHENTICATED user tries to navigate to a page that they
 * are not authorized to access. You might want to override this to navigate
 * to some explanatory page or to the application's home page.
 * 
 * @param page
 *            The page
 */
protected void onUnauthorizedPage(final Page page) {
    // The component was not a page, so throw an exception
    throw new UnauthorizedInstantiationException(page.getClass());
}
 
开发者ID:PkayJava,项目名称:pluggable,代码行数:13,代码来源:AuthenticatedWebApplication.java



注:本文中的org.apache.wicket.authorization.UnauthorizedInstantiationException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InvalidationClientCore类代码示例发布时间:2022-05-23
下一篇:
Java ComputeEngineCredentials类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap