Example usage for org.apache.wicket.authentication.strategy NoOpAuthenticationStrategy NoOpAuthenticationStrategy

List of usage examples for org.apache.wicket.authentication.strategy NoOpAuthenticationStrategy NoOpAuthenticationStrategy

Introduction

In this page you can find the example usage for org.apache.wicket.authentication.strategy NoOpAuthenticationStrategy NoOpAuthenticationStrategy.

Prototype

NoOpAuthenticationStrategy

Source Link

Usage

From source file:com.apachecon.memories.ScrapbookApplication.java

License:Apache License

/**
 * @see org.apache.wicket.Application#init()
 *//*  ww  w .j  ava  2  s . c  o m*/
@Override
public void init() {
    super.init();

    mountPage("/index.html", Index.class);
    mountPage("/signin.html", SignIn.class);
    mountPage("/logout.html", Logout.class);
    mountPage("/browse.html", Browse.class);
    mountPage("/approve.html", Approve.class);
    mountPage("/upload.html", Upload.class);

    mount(new BufferedResponseMapper() {
        protected String getSessionId() {
            return Session.get().getId();
        }
    });

    // disable cookie with user/pass, it's not safe
    getSecuritySettings().setAuthenticationStrategy(new NoOpAuthenticationStrategy());

    final Properties props = new Properties();
    try {
        props.load(getClass().getResourceAsStream("/deploy.properties"));
    } catch (IOException e) {

    }
    File rootDirectory = new File(props.getProperty("data.dir"));
    rootDirectory.mkdirs();

    imageService = new DefaultImageService();

    imageService.setArchiveDirectory(new File(rootDirectory, "archive"));
    imageService.setUploadDirectory(new File(rootDirectory, "upload"));
    imageService.setApproveDirectory(new File(rootDirectory, "approve"));
    imageService.setDeclineDirectory(new File(rootDirectory, "decline"));
}

From source file:name.martingeisse.admin.application.wicket.AdminWicketApplication.java

License:Open Source License

@Override
protected void init() {
    logger.debug("AdminWicketApplication.init(): begin");

    // register custom wicket:* tags
    logger.trace("registering custom tags...");
    WicketTagIdentifier.registerWellKnownTagName("json");
    getPageSettings().addComponentResolver(new JsonComponentResolver());
    logger.trace("custom tags registered");

    // The default encryption code in Wicket use a fixed key and a fixed salt!
    // We currently don't need encryption since we don't use "remember me"
    // cookies nor URL encryption. If encryption IS used in the future,
    // however, we should absolutely generate our own key and salt and
    // maybe even use per-session generated keys.
    logger.trace("registering Wicket encryption strategy...");
    getSecuritySettings().setCryptFactory(new BrokenCryptFactory());
    logger.trace("Wicket encryption strategy registered");

    // superclass initialization
    logger.trace("initializing base application class...");
    super.init();
    logger.trace("base application class initialized");

    // register type converters
    ConverterLocator converterLocator = (ConverterLocator) getConverterLocator();
    converterLocator.set(DateTime.class, new DateTimeConverter());
    converterLocator.set(LocalDateTime.class, new LocalDateTimeConverter());
    converterLocator.set(LocalDate.class, new LocalDateConverter());
    converterLocator.set(LocalTime.class, new LocalTimeConverter());

    // some more Wicket configuration
    getApplicationSettings().setPageExpiredErrorPage(HomePage.class);
    getMarkupSettings().setDefaultBeforeDisabledLink("<span class=\"disabled-link\">");
    getMarkupSettings().setDefaultAfterDisabledLink("</span>");
    getSecuritySettings().setAuthenticationStrategy(new NoOpAuthenticationStrategy());

    // mount resource URLs
    logger.trace("mounting resource URLs...");
    mountResources(AbstractAdminPage.class, "", "common.css", "common.js", "jquery.dataTables.css");
    mountResources(Dummy.class, "images/", "back_enabled.png", "forward_disabled.png",
            "forward_enabled_hover.png", "sort_asc_disabled.png", "sort_desc.png", "back_disabled.png",
            "back_enabled_hover.png", "forward_enabled.png", "sort_asc.png", "sort_both.png",
            "sort_desc_disabled.png");
    mountResources(Dummy.class, "images/", "ui-bg_diagonals-thick_18_b81900_40x40.png",
            "ui-bg_diagonals-thick_20_666666_40x40.png", "ui-bg_flat_10_000000_40x100.png",
            "ui-bg_glass_100_f6f6f6_1x400.png", "ui-bg_glass_100_fdf5ce_1x400.png",
            "ui-bg_glass_65_ffffff_1x400.png", "ui-bg_gloss-wave_35_f6a828_500x100.png",
            "ui-bg_highlight-soft_100_eeeeee_1x100.png", "ui-bg_highlight-soft_75_ffe45c_1x100.png",
            "ui-icons_222222_256x240.png", "ui-icons_228ef1_256x240.png", "ui-icons_ef8c08_256x240.png",
            "ui-icons_ffd27a_256x240.png", "ui-icons_ffffff_256x240.png");
    logger.trace("resource URLs mounted");

    // mount other URLs
    logger.trace("mounting misc URLs...");
    mountPage("/login",
            ReturnValueUtil.nullMeansMissing(SecurityConfiguration.getInstanceSafe().getLoginPageClass(),
                    "security configuration: login page class"));
    logger.trace("misc URLs mounted");

    // add fallback string loaders
    getResourceSettings().getStringResourceLoaders()
            .add(new PrefixedIdentityStringResourceLoader("schema.entity."));

    // redirect to the login page if not logged in
    getRequestCycleListeners().add(new LoginRequestCycleListener());

    logger.debug("AdminWicketApplication.init(): end");
}