Example usage for org.apache.shiro.util StringUtils DEFAULT_DELIMITER_CHAR

List of usage examples for org.apache.shiro.util StringUtils DEFAULT_DELIMITER_CHAR

Introduction

In this page you can find the example usage for org.apache.shiro.util StringUtils DEFAULT_DELIMITER_CHAR.

Prototype

char DEFAULT_DELIMITER_CHAR

To view the source code for org.apache.shiro.util StringUtils DEFAULT_DELIMITER_CHAR.

Click Source Link

Document

Constant representing the default delimiter character (comma), equal to ','

Usage

From source file:org.seedstack.seed.web.internal.security.SecurityWebModule.java

License:Open Source License

@Override
protected void configureShiroWeb() {
    PropsEntries propsEntries = props.entries().activeProfiles().section(PROPERTIES_PREFIX);
    Iterator<PropsEntry> entries = propsEntries.iterator();
    while (entries.hasNext()) {
        LOGGER.info("Binding urls to filters...");
        PropsEntry entry = entries.next();
        String url = org.apache.commons.lang.StringUtils.removeStart(entry.getKey(), PROPERTIES_PREFIX + ".");
        String[] filters = StringUtils.split(entry.getValue(), StringUtils.DEFAULT_DELIMITER_CHAR, '[', ']',
                true, true);/*from w  ww. ja  v  a2  s.  co m*/
        addFilterChain(url, getFilterKeys(filters));
    }
    if (applicationName != null) {
        bindConstant().annotatedWith(Names.named("shiro.applicationName")).to(applicationName);
    }
}

From source file:org.seedstack.seed.web.security.internal.WebSecurityModule.java

License:Mozilla Public License

@Override
protected void configureShiroWeb() {
    // Register all filter chains
    PropsEntries propsEntries = props.entries().activeProfiles().section(PROPERTIES_PREFIX);
    Iterator<PropsEntry> entries = propsEntries.iterator();
    int entryCount = 0;
    while (entries.hasNext()) {
        PropsEntry entry = entries.next();
        String url = org.apache.commons.lang.StringUtils.removeStart(entry.getKey(), PROPERTIES_PREFIX + ".");
        String[] filters = StringUtils.split(entry.getValue(), StringUtils.DEFAULT_DELIMITER_CHAR, '[', ']',
                true, true);/* w w  w  .j  av a 2  s  .  c om*/

        LOGGER.trace("Binding {} to security filter chain {}", url, Arrays.toString(filters));
        addFilterChain(url, getFilterKeys(filters));
        entryCount++;
    }
    LOGGER.debug("{} URL(s) bound to security filters", entryCount);

    // Bind Seed filters
    bind(AntiXsrfFilter.class);
    bind(X509CertificateFilter.class);

    // Bind custom filters not extending PathMatchingFilter as Shiro doesn't do it
    for (Class<? extends Filter> customFilter : customFilters) {
        if (!PathMatchingFilter.class.isAssignableFrom(customFilter)) {
            bind(customFilter);
        }
    }

    // Additional web security bindings
    bind(AntiXsrfService.class).to(StatelessAntiXsrfService.class);
    bindConstant().annotatedWith(Names.named("shiro.applicationName")).to(applicationName);

    // Shiro global configuration
    securityGuiceConfigurer.configure(binder());

    // Exposed binding
    expose(AntiXsrfService.class);
}