Examples of UrlMatcher


Examples of org.expressme.webwind.UrlMatcher

        assertNull(m.getMatchedParameters("/abc//---/xyz"));
    }

    @Test
    public void testMatch2Parameters() {
        UrlMatcher m = new UrlMatcher("/abc/$1/$2/xyz");
        assertEquals(2, m.orders.length);
        assertEquals(0, m.orders[0]);
        assertEquals(1, m.orders[1]);
        // matched url:
        assertArrayEquals(toArray("123", "456"), m.getMatchedParameters("/abc/123/456/xyz"));
        assertArrayEquals(toArray("QQQ", "VVV"), m.getMatchedParameters("/abc/QQQ/VVV/xyz"));
        assertArrayEquals(toArray("---", ""), m.getMatchedParameters("/abc/---//xyz"));
        assertArrayEquals(toArray("", "---"), m.getMatchedParameters("/abc//---/xyz"));
        assertArrayEquals(toArray("", ""), m.getMatchedParameters("/abc///xyz"));
        // not matched url:
        assertNull(m.getMatchedParameters("/"));
        assertNull(m.getMatchedParameters("/abc//xyz"));
        assertNull(m.getMatchedParameters("/abc//---//xyz"));
        assertNull(m.getMatchedParameters("/abc////xyz"));
        assertNull(m.getMatchedParameters("/abc/123/xyz/"));
        assertNull(m.getMatchedParameters("/123/xyz"));
        assertNull(m.getMatchedParameters("/abc/123/456/xyz/"));
    }
View Full Code Here

Examples of org.expressme.webwind.UrlMatcher

        assertNull(m.getMatchedParameters("/abc/123/456/xyz/"));
    }

    @Test
    public void testMatch2ParametersDesc() {
        UrlMatcher m = new UrlMatcher("/abc/$2/$1/xyz");
        assertEquals(2, m.orders.length);
        assertEquals(1, m.orders[0]);
        assertEquals(0, m.orders[1]);
        // matched url:
        assertArrayEquals(toArray("456", "123"), m.getMatchedParameters("/abc/123/456/xyz"));
        assertArrayEquals(toArray("VVV", "QQQ"), m.getMatchedParameters("/abc/QQQ/VVV/xyz"));
        assertArrayEquals(toArray("", "---"), m.getMatchedParameters("/abc/---//xyz"));
        assertArrayEquals(toArray("---", ""), m.getMatchedParameters("/abc//---/xyz"));
        assertArrayEquals(toArray("", ""), m.getMatchedParameters("/abc///xyz"));
        // not matched url:
        assertNull(m.getMatchedParameters("/"));
        assertNull(m.getMatchedParameters("/abc/xyz"));
        assertNull(m.getMatchedParameters("/abc//123/"));
        assertNull(m.getMatchedParameters("/123/--/xyz"));
        assertNull(m.getMatchedParameters("/123////xyz"));
        assertNull(m.getMatchedParameters("/abc/123/456/xyz/"));
    }
View Full Code Here

Examples of org.expressme.webwind.UrlMatcher

        assertNull(m.getMatchedParameters("/abc/123/456/xyz/"));
    }

    @Test
    public void testMatchFirst() {
        UrlMatcher m = new UrlMatcher("$1/xyz");
        assertEquals(1, m.orders.length);
        assertEquals(0, m.orders[0]);
        // matched url:
        assertArrayEquals(toArray("123"), m.getMatchedParameters("123/xyz"));
        assertArrayEquals(toArray("123456"), m.getMatchedParameters("123456/xyz"));
        assertArrayEquals(toArray("123"), m.getMatchedParameters("123/xyz"));
        assertArrayEquals(toArray("---"), m.getMatchedParameters("---/xyz"));
        assertArrayEquals(toArray(""), m.getMatchedParameters("/xyz"));
        // not matched url:
        assertNull(m.getMatchedParameters("/"));
        assertNull(m.getMatchedParameters("abc/u/xyz"));
        assertNull(m.getMatchedParameters("abc/xyz/"));
        assertNull(m.getMatchedParameters("/abc/xyz/"));
    }
View Full Code Here

Examples of org.expressme.webwind.UrlMatcher

        assertNull(m.getMatchedParameters("/abc/xyz/"));
    }

    @Test
    public void testMatchLast() {
        UrlMatcher m = new UrlMatcher("/xyz/$1");
        assertEquals(1, m.orders.length);
        assertEquals(0, m.orders[0]);
        // matched url:
        assertArrayEquals(toArray("123"), m.getMatchedParameters("/xyz/123"));
        assertArrayEquals(toArray("123456"), m.getMatchedParameters("/xyz/123456"));
        assertArrayEquals(toArray("---"), m.getMatchedParameters("/xyz/---"));
        assertArrayEquals(toArray(""), m.getMatchedParameters("/xyz/"));
        // not matched url:
        assertNull(m.getMatchedParameters("/"));
        assertNull(m.getMatchedParameters("/xyz"));
        assertNull(m.getMatchedParameters("xyz/"));
        assertNull(m.getMatchedParameters("/xyz/123/"));
    }
View Full Code Here

Examples of org.expressme.webwind.UrlMatcher

        assertNull(m.getMatchedParameters("/xyz/123/"));
    }

    @Test
    public void testMatchEncoded() {
        UrlMatcher m = new UrlMatcher("/xyz/$1");
        assertEquals(1, m.orders.length);
        assertEquals(0, m.orders[0]);
        // matched url:
        assertArrayEquals(toArray("abc%20abc"), m.getMatchedParameters("/xyz/abc%20abc"));
        assertArrayEquals(toArray("abc abc"), m.getMatchedParameters("/xyz/abc abc"));
        // not matched url:
        assertNull(m.getMatchedParameters("/xyz/abc/abc"));
    }
View Full Code Here

Examples of org.springframework.security.web.util.UrlMatcher

    String uri = request.getRequestURI();
    if (uri == null) {
      return null;
    }
    if (this.defaultFilterInvocationSecurityMetadataSource == null) {
      UrlMatcher matcher = new AntUrlPathMatcher();
      LinkedHashMap<RequestKey, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<RequestKey, Collection<ConfigAttribute>>();
      for (String key : this.getUrlPatterns().keySet()) {
        String value = this.getUrlPatterns().get(key);
        Collection<ConfigAttribute> elements = new ArrayList<ConfigAttribute>();
        elements.add(new SecurityConfig(value));
View Full Code Here

Examples of org.springframework.security.web.util.UrlMatcher

            new CompositeComponentDefinition(element.getTagName(), pc.extractSource(element));
        pc.pushContainingComponent(compositeDef);
        final Object source = pc.extractSource(element);

        final String portMapperName = createPortMapper(element, pc);
        final UrlMatcher matcher = createUrlMatcher(element);

        HttpConfigurationBuilder httpBldr = new HttpConfigurationBuilder(element, pc, matcher, portMapperName);

        httpBldr.parseInterceptUrlsForEmptyFilterChains();
        httpBldr.createSecurityContextPersistenceFilter();
        httpBldr.createSessionManagementFilters();

        ManagedList<BeanReference> authenticationProviders = new ManagedList<BeanReference>();
        BeanReference authenticationManager = createAuthenticationManager(element, pc, authenticationProviders, null);

        httpBldr.createServletApiFilter();
        httpBldr.createChannelProcessingFilter();
        httpBldr.createFilterSecurityInterceptor(authenticationManager);

        AuthenticationConfigBuilder authBldr = new AuthenticationConfigBuilder(element, pc,
                httpBldr.isAllowSessionCreation(), portMapperName);

        authBldr.createAnonymousFilter();
        authBldr.createRememberMeFilter(authenticationManager);
        authBldr.createRequestCache();
        authBldr.createBasicFilter(authenticationManager);
        authBldr.createFormLoginFilter(httpBldr.getSessionStrategy(), authenticationManager);
        authBldr.createOpenIDLoginFilter(httpBldr.getSessionStrategy(), authenticationManager);
        authBldr.createX509Filter(authenticationManager);
        authBldr.createLogoutFilter();
        authBldr.createLoginPageFilterIfNeeded();
        authBldr.createUserServiceInjector();
        authBldr.createExceptionTranslationFilter();

        List<OrderDecorator> unorderedFilterChain = new ArrayList<OrderDecorator>();

        unorderedFilterChain.addAll(httpBldr.getFilters());
        unorderedFilterChain.addAll(authBldr.getFilters());

        authenticationProviders.addAll(authBldr.getProviders());

        BeanDefinition requestCacheAwareFilter = new RootBeanDefinition(RequestCacheAwareFilter.class);
        requestCacheAwareFilter.getPropertyValues().addPropertyValue("requestCache", authBldr.getRequestCache());
        unorderedFilterChain.add(new OrderDecorator(requestCacheAwareFilter, REQUEST_CACHE_FILTER));

        unorderedFilterChain.addAll(buildCustomFilterList(element, pc));

        Collections.sort(unorderedFilterChain, new OrderComparator());
        checkFilterChainOrder(unorderedFilterChain, pc, source);

        List<BeanMetadataElement> filterChain = new ManagedList<BeanMetadataElement>();

        for (OrderDecorator od : unorderedFilterChain) {
            filterChain.add(od.bean);
        }

        ManagedMap<BeanDefinition, List<BeanMetadataElement>> filterChainMap = httpBldr.getFilterChainMap();
        BeanDefinition universalMatch = new RootBeanDefinition(String.class);
        universalMatch.getConstructorArgumentValues().addGenericArgumentValue(matcher.getUniversalMatchPattern());
        filterChainMap.put(universalMatch, filterChain);

        registerFilterChainProxy(pc, filterChainMap, matcher, source);

        pc.popAndRegisterContainingComponent();
View Full Code Here

Examples of org.springframework.security.web.util.UrlMatcher

            patternType = DEF_PATH_TYPE_ANT;
        }

        boolean useRegex = patternType.equals(OPT_PATH_TYPE_REGEX);

        UrlMatcher matcher = new AntUrlPathMatcher();

        if (useRegex) {
            matcher = new RegexUrlPathMatcher();
        }
View Full Code Here

Examples of org.springframework.security.web.util.UrlMatcher

        return mds;
    }

    static BeanDefinition createSecurityMetadataSource(List<Element> interceptUrls, Element elt, ParserContext pc) {
        UrlMatcher matcher = HttpSecurityBeanDefinitionParser.createUrlMatcher(elt);
        boolean useExpressions = isUseExpressions(elt);

        ManagedMap<BeanDefinition, BeanDefinition> requestToAttributesMap = parseInterceptUrlsForFilterInvocationRequestMap(
                interceptUrls, useExpressions, pc);
        BeanDefinitionBuilder fidsBuilder;
View Full Code Here

Examples of org.springframework.security.web.util.UrlMatcher

            new CompositeComponentDefinition(element.getTagName(), pc.extractSource(element));
        pc.pushContainingComponent(compositeDef);
        final Object source = pc.extractSource(element);

        final String portMapperName = createPortMapper(element, pc);
        final UrlMatcher matcher = createUrlMatcher(element);

        HttpConfigurationBuilder httpBldr = new HttpConfigurationBuilder(element, pc, matcher, portMapperName);

        httpBldr.parseInterceptUrlsForEmptyFilterChains();
        httpBldr.createSecurityContextPersistenceFilter();
        httpBldr.createSessionManagementFilters();

        ManagedList<BeanReference> authenticationProviders = new ManagedList<BeanReference>();
        BeanReference authenticationManager = createAuthenticationManager(element, pc, authenticationProviders, null);

        httpBldr.createServletApiFilter();
        httpBldr.createChannelProcessingFilter();
        httpBldr.createFilterSecurityInterceptor(authenticationManager);

        AuthenticationConfigBuilder authBldr = new AuthenticationConfigBuilder(element, pc,
                httpBldr.isAllowSessionCreation(), portMapperName);

        authBldr.createAnonymousFilter();
        authBldr.createRememberMeFilter(authenticationManager);
        authBldr.createRequestCache();
        authBldr.createBasicFilter(authenticationManager);
        authBldr.createFormLoginFilter(httpBldr.getSessionStrategy(), authenticationManager);
        authBldr.createOpenIDLoginFilter(httpBldr.getSessionStrategy(), authenticationManager);
        authBldr.createX509Filter(authenticationManager);
        authBldr.createLogoutFilter();
        authBldr.createLoginPageFilterIfNeeded();
        authBldr.createUserServiceInjector();
        authBldr.createExceptionTranslationFilter();

        List<OrderDecorator> unorderedFilterChain = new ArrayList<OrderDecorator>();

        unorderedFilterChain.addAll(httpBldr.getFilters());
        unorderedFilterChain.addAll(authBldr.getFilters());

        authenticationProviders.addAll(authBldr.getProviders());

        BeanDefinition requestCacheAwareFilter = new RootBeanDefinition(RequestCacheAwareFilter.class);
        requestCacheAwareFilter.getPropertyValues().addPropertyValue("requestCache", authBldr.getRequestCache());
        unorderedFilterChain.add(new OrderDecorator(requestCacheAwareFilter, REQUEST_CACHE_FILTER));

        unorderedFilterChain.addAll(buildCustomFilterList(element, pc));

        Collections.sort(unorderedFilterChain, new OrderComparator());
        checkFilterChainOrder(unorderedFilterChain, pc, source);

        List<BeanMetadataElement> filterChain = new ManagedList<BeanMetadataElement>();

        for (OrderDecorator od : unorderedFilterChain) {
            filterChain.add(od.bean);
        }

        ManagedMap<Object, List<BeanMetadataElement>> filterChainMap = httpBldr.getFilterChainMap();
        filterChainMap.put(matcher.getUniversalMatchPattern(), filterChain);

        registerFilterChainProxy(pc, filterChainMap, matcher, source);

        pc.popAndRegisterContainingComponent();
        return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.