[ 
https://issues.apache.org/jira/browse/SLING-4701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14987147#comment-14987147
 ] 

Konrad Windszus commented on SLING-4701:
----------------------------------------

I came to the conclusion that both the {{sling.auth.requirements}} 
(https://sling.apache.org/documentation/the-sling-engine/authentication/authentication-framework.html#anonymous-login)
 as well as the {{AuthenticationHandler}} path 
(https://sling.apache.org/documentation/the-sling-engine/authentication/authentication-authenticationhandler.html)
 are only used to be compared against the request path.

The request path for resource '/blubb' or subresources may look like any of the 
following:
* /blubb.html
* /blubb.selector.html
* /blubb.html/suffix

Both patches don't look correct to me (because some of the above mentioned 
cases are not covered).
I would therefore rather clarify in the documentation that there is a 
comparison if the request path starts with the given path and then leave it at 
that.

To cover the case from above where you want to allow anonymous access to 
'/blubb' but not '/blubb-blah' you would have to give the following 
{{sling.auth.requirements}}:
# /blubb/
# /blubb.html (if necessary)

> SlingAuthenticator.isAnonAllowed matches for all paths starting with the same 
> characters
> ----------------------------------------------------------------------------------------
>
>                 Key: SLING-4701
>                 URL: https://issues.apache.org/jira/browse/SLING-4701
>             Project: Sling
>          Issue Type: Bug
>          Components: Authentication
>    Affects Versions: Auth Core 1.3.6
>            Reporter: Lars Krapf
>              Labels: authentication
>         Attachments: SlingAuthenticator.patch
>
>
> The SlingAuthenticator check if anonymous access is allowed compares paths 
> with String.startsWith. If the holder.path does not end with a '/' it will 
> erroneously match a different path that starts with the same characters, even 
> if it is not a descendant of the first path. 
> Example:
> - Allow anonymous acces on '/'
> - Deny anonymous access on a path '/blubb'  
> -> Authentication is enforced on a request to '/blubb-blah' - which is wrong.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to