Hi Richard

If you make the object a LinkedHashMap the order should be preserved.

LinkedHashMap<String,String> linkedHashMap = new LinkedHashMap<>();
linkedHashMap.put("/manage/health/", "anon");
linkedHashMap.put("/manage/**, "authc");
ShiroFilterFactoryBean factory =  new ShiroFilterFactoryBean ();
actory.setFilterChainDefinitions(linkedHashMap);

-d

On 23 October 2014 08:53, Richard Adams <[email protected]> wrote:

> Hi,
>  I’ve been using Shiro quite happlly for some years now in an existing
> project. Recently I started a new project using Spring Boot, and wanted to
> use Shiro rather than learn Spring Security, which is the ‘default’
> security option in Spring Boot..
>
>  The configuration is pure Java and it took a little while to get set up,
> but I’ve documented my experiences in a blog post in case it’s useful to
> others:
>
>
> http://richardadams606blog.blogspot.co.uk/2014/10/apache-shiro-and-spring-boot.html
>
> One problem I’ve not been able to fix is the ordering of filter chain
> definitions.
> public ShiroFilterFactoryBean shiroFilter (){
> ShiroFilterFactoryBean factory =  new ShiroFilterFactoryBean ();
>  ……..
> factory.setFilterChainDefinitions(
>                          "/manage/health/=anon\n” +
>                          "/manage/**=authc\n”
>                            );
> …..
> }
>
> For example, I’d like to make /manage/health to allow anonymous access,
> but all other URLS under manage/ to require authentication.
>  This type of approach works fine using XML configuration in my old
> project, but in the new Spring Boot project the '/manage/health‘ URL
> triggers the authentication filter. I’ve tried to swap them but no success.
> Does anyone have any suggestions on how to configure the ordering properly
> using Java rather than .ini or XML config?
>
> Thanks
>   Richard
>
>
> Richard Adams
> [email protected]
>
>
>
>
>

Reply via email to