Examples of matches()


Examples of org.springframework.security.crypto.password.PasswordEncoder.matches()

    }

    private boolean verifyPassword(String username, String presentedPassword,
            String encodedPassword) {
        PasswordEncoder passwordEncoder = new StandardPasswordEncoder(username);
        if (passwordEncoder.matches(presentedPassword, encodedPassword)) {
            return true;
        } else {
            return false;
        }
    }

Examples of org.springframework.security.crypto.password.StandardPasswordEncoder.matches()

  }

  public boolean checkPassword(final String rawPassword,
      final String encodedPassword) {
    final StandardPasswordEncoder encoder = new StandardPasswordEncoder();
    return encoder.matches(rawPassword, encodedPassword);
  }

  public void registerPayer(final PayerDTO payer) {
    try {
      LOGGER.info("Payer registration process start");

Examples of org.springframework.security.web.util.AntPathRequestMatcher.matches()

    @Override
    public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Map<String, String> urlPatternDispatchMap = (Map<String, String>) getApplicationContext().getBean("blResourceUrlPatternRequestDispatchMap");
        for (Map.Entry<String, String> entry : urlPatternDispatchMap.entrySet()) {
            RequestMatcher matcher = new AntPathRequestMatcher(entry.getKey());
            if (matcher.matches(request)){
                request.getRequestDispatcher(entry.getValue()).forward(request, response);
                return;
            }
        }
        super.handleRequest(request, response);

Examples of org.springframework.security.web.util.RequestMatcher.matches()

    @Override
    public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Map<String, String> urlPatternDispatchMap = (Map<String, String>) getApplicationContext().getBean("blResourceUrlPatternRequestDispatchMap");
        for (Map.Entry<String, String> entry : urlPatternDispatchMap.entrySet()) {
            RequestMatcher matcher = new AntPathRequestMatcher(entry.getKey());
            if (matcher.matches(request)){
                request.getRequestDispatcher(entry.getValue()).forward(request, response);
                return;
            }
        }
        super.handleRequest(request, response);

Examples of org.springframework.security.web.util.matcher.AntPathRequestMatcher.matches()

    @Test
    public void singleWildcardMatchesAnyPath() {
        AntPathRequestMatcher matcher = new AntPathRequestMatcher("/**");
        assertEquals("/**", matcher.getPattern());

        assertTrue(matcher.matches(createRequest("/blah")));

        matcher = new AntPathRequestMatcher("**");
        assertTrue(matcher.matches(createRequest("/blah")));
        assertTrue(matcher.matches(createRequest("")));
    }

Examples of org.springframework.security.web.util.matcher.ELRequestMatcher.matches()

    public void testHasIpAddressTrue() throws Exception {
        ELRequestMatcher requestMatcher = new ELRequestMatcher("hasIpAddress('1.1.1.1')");
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setRemoteAddr("1.1.1.1");

        assertTrue(requestMatcher.matches(request));
    }

    @Test
    public void testHasIpAddressFalse() throws Exception {
        ELRequestMatcher requestMatcher = new ELRequestMatcher("hasIpAddress('1.1.1.1')");

Examples of org.springframework.security.web.util.matcher.IpAddressMatcher.matches()

    }

    @Test
    public void ipv4SubnetMatchesCorrectly() throws Exception {
        IpAddressMatcher matcher = new IpAddressMatcher("192.168.1.0/24");
        assertTrue(matcher.matches(ipv4Request));
        matcher = new IpAddressMatcher("192.168.1.128/25");
        assertFalse(matcher.matches(ipv4Request));
        ipv4Request.setRemoteAddr("192.168.1.159"); // 159 = 0x9f
        assertTrue(matcher.matches(ipv4Request));
    }

Examples of org.springframework.security.web.util.matcher.MediaTypeRequestMatcher.matches()

    @Test
    public void javadocJsonJson() {
        request.addHeader("Accept", MediaType.APPLICATION_JSON_VALUE);
        MediaTypeRequestMatcher matcher = new MediaTypeRequestMatcher(negotiationStrategy, MediaType.APPLICATION_JSON);

        assertThat(matcher.matches(request)).isTrue();
    }


    @Test
    public void javadocAllJson() {

Examples of org.springframework.security.web.util.matcher.RegexRequestMatcher.matches()

    @Test
    public void requestHasNullMethodAndNullMatcherNoMatch() {
        RegexRequestMatcher matcher = new RegexRequestMatcher("/something/.*", null);
        HttpServletRequest request = createRequestWithNullMethod("/nomatch");
        assertFalse(matcher.matches(request));
    }

    private HttpServletRequest createRequestWithNullMethod(String path) {
        when(request.getQueryString()).thenReturn("doesntMatter");
        when(request.getServletPath()).thenReturn(path);

Examples of org.springframework.security.web.util.matcher.RequestMatcher.matches()

    @Test
    public void testDefaultEntryPoint() throws Exception {
        AuthenticationEntryPoint firstAEP = mock(AuthenticationEntryPoint.class);
        RequestMatcher firstRM = mock(RequestMatcher.class);
        when(firstRM.matches(request)).thenReturn(false);
        entryPoints.put(firstRM, firstAEP);

        daep.commence(request, null, null);

        verify(defaultEntryPoint).commence(request, null, null);
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.