Results 1 to 2 of 2

Thread: RegExpBasedFilterInvocationDefinitionMap & Wildcards

  1. #1

    Default RegExpBasedFilterInvocationDefinitionMap & Wildcards

    In the method public ConfigAttributeDefinition lookupAttributes(String url), Acegi looks the ConfigAttributeDefinition using Perl5Matcher:

    boolean matched = matcher.matches(url, entryHolder.getCompiledPattern());

    But the method 'matches' in Perl5Matcher 'determines if a string exactly matches a given pattern', so no wildcards can be used.

    Shouldn't be better to use the method 'contains' instead?

    Anyway, how can be wildcards defined?

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Quoting the Contacts Sample Application's applicationContext-acegi-security.xml:

    <!-- BASIC Regular Expression Syntax (for beginners):

    \A means the start of the string (ie the beginning of the URL)
    \Z means the end of the string (ie the end of the URL)
    . means any single character
    * means null or any number of repetitions of the last expression (so .* means zero or more characters)

    Some examples:

    Expression: \A/my/directory/.*\Z
    Would match: /my/directory/
    /my/directory/hello.html

    Expression: \A/.*\Z
    Would match: /hello.html
    /

    Expression: \A/.*/secret.html\Z
    Would match: /some/directory/secret.html
    /another/secret.html
    Not match: /anothersecret.html (missing required /)
    -->
    As such .* will match any character.

    Most people prefer to use the Ant Path syntax. See http://acegisecurity.sourceforge.net...lterinvocation for more info.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •