Hi,
I have a problem with users being able to access pages that they shouldn't
Example mapping that should only be accessed by editors:
in case groupType equals "page" only an editor can access this page. When it's "other", all users can access it.PHP Code:@Controller
@RequestMapping("/*/??_??/account/{groupType}")
public class GroupController{
@RequestMapping(method = RequestMethod.GET, value = "/add")
public String addGroup(
ModelMap model,
NativeWebRequest request){
[...]
(in my case myAuthenticationProcessingFilterEntryPoint extends LoginUrlAuthenticationEntryPointPHP Code:<http use-expressions="true" entry-point-ref="myAuthenticationProcessingFilterEntryPoint" >
<intercept-url pattern="/*/*/account/page/add/" access="hasRole('ROLE_EDITOR')" />
<intercept-url pattern="/*/*/account/**" access="isAuthenticated()" />
[...]
I have a few examples here with 3 urls that should all be denied access.
urls
* /xyz/NL_nl/account/page/add/ => access denied to non-editors OK
* /xyz/NL_nl/account/page/add => access approved to non-editors FAIL
* /xyz/NL_nl/account/page/add.html => access approved to non-editors FAIL
urlsPHP Code:<http use-expressions="true" entry-point-ref="myAuthenticationProcessingFilterEntryPoint" >
<intercept-url pattern="/*/*/account/page/add*" access="hasRole('ROLE_EDITOR')" />
<intercept-url pattern="/*/*/account/**" access="isAuthenticated()" />
[...]
* /xyz/NL_nl/account/page/add/ => access approved to non-editors FAIL
* /xyz/NL_nl/account/page/add => access denied to non-editors OK
* /xyz/NL_nl/account/page/add.html => access denied to non-editors OK
urlsPHP Code:<http use-expressions="true" entry-point-ref="myAuthenticationProcessingFilterEntryPoint" >
<intercept-url pattern="/*/*/account/page/add**" access="hasRole('ROLE_EDITOR')" />
<intercept-url pattern="/*/*/account/**" access="isAuthenticated()" />
[...]
* /xyz/NL_nl/account/page/add/ => access approved to non-editors FAIL
* /xyz/NL_nl/account/page/add => access denied to non-editors OK
* /xyz/NL_nl/account/page/add.html => access denied to non-editors OK
I have two questions:
* How can I implement the pattern in such a way that all 3 url options deny access.
* why doesn't spring security handle the issue of trailing slash/*.html by default? It seems very easy to make a dangerous mistake here. Spring automatically processes *.html extension and your webserver may automatically add a trailing slash, or not.


Reply With Quote