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

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

Introduction

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

Prototype

public static String[] split(String aLine, char delimiter, char beginQuoteChar, char endQuoteChar,
        boolean retainQuotes, boolean trimTokens) 

Source Link

Document

Splits the specified delimited String into tokens, supporting quoted tokens so that quoted strings themselves won't be tokenized.

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 ww w.  j  a v  a 2s .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);/* www . j a v  a  2s .c o m*/

        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);
}