One question about shiro annotations with spring

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

One question about shiro annotations with spring

yuwei

Hi guys,

Should shiro annotations work with spring controller or spring services?

When I configured filters in applicationContext.xml as below, everything works well.

<property name="filters">
            <util:map>
                <entry key="authc">
                    <bean class="org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter"/>
                </entry>
            </util:map>
        </property>
        <property name="filterChainDefinitions">
            <value>
                /school/** = authc
                /user/** = authc, roles[888888]
                /role/** = authc, roles[888888]
                /permission/** = authc, roles[888888]
                /** = anon
            </value>
        </property>


However, when I use the annotations in java code, it doesn't work.


Do I missed anything? Any advice?



Thanks,

Jared, (韦煜)
Software developer
Interested in open source software, big data, Linux

Reply | Threaded
Open this post in threaded view
|

Re: One question about shiro annotations with spring

Brian Demers
What do your annotations look like ?

On Tue, Jun 27, 2017 at 3:33 AM, Yu Wei <[hidden email]> wrote:

Hi guys,

Should shiro annotations work with spring controller or spring services?

When I configured filters in applicationContext.xml as below, everything works well.

<property name="filters">
            <util:map>
                <entry key="authc">
                    <bean class="org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter"/>
                </entry>
            </util:map>
        </property>
        <property name="filterChainDefinitions">
            <value>
                /school/** = authc
                /user/** = authc, roles[888888]
                /role/** = authc, roles[888888]
                /permission/** = authc, roles[888888]
                /** = anon
            </value>
        </property>


However, when I use the annotations in java code, it doesn't work.


Do I missed anything? Any advice?



Thanks,

Jared, (韦煜)
Software developer
Interested in open source software, big data, Linux


Reply | Threaded
Open this post in threaded view
|

Re: One question about shiro annotations with spring

yuwei

Hi Brian,

I used @RequiresAuthentication in java source code.


From shiro document I found content as below,

This requires Shiro’s Spring AOP integration to scan for the appropriate annotated classes and perform security logic as necessary.


But I don't know how to enable "shiro's spring AOP integration". Is there any procedure about this?


Thanks,

Jared, (韦煜)
Software developer
Interested in open source software, big data, Linux


From: Brian Demers <[hidden email]>
Sent: Wednesday, July 5, 2017 11:22:01 PM
To: [hidden email]
Subject: Re: One question about shiro annotations with spring
 
What do your annotations look like ?

On Tue, Jun 27, 2017 at 3:33 AM, Yu Wei <[hidden email]> wrote:

Hi guys,

Should shiro annotations work with spring controller or spring services?

When I configured filters in applicationContext.xml as below, everything works well.

<property name="filters">
            <util:map>
                <entry key="authc">
                    <bean class="org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter"/>
                </entry>
            </util:map>
        </property>
        <property name="filterChainDefinitions">
            <value>
                /school/** = authc
                /user/** = authc, roles[888888]
                /role/** = authc, roles[888888]
                /permission/** = authc, roles[888888]
                /** = anon
            </value>
        </property>


However, when I use the annotations in java code, it doesn't work.


Do I missed anything? Any advice?



Thanks,

Jared, (韦煜)
Software developer
Interested in open source software, big data, Linux


Reply | Threaded
Open this post in threaded view
|

Re: One question about shiro annotations with spring

Brian Demers

On Sat, Jul 8, 2017 at 11:00 AM, Yu Wei <[hidden email]> wrote:

Hi Brian,

I used @RequiresAuthentication in java source code.


From shiro document I found content as below,

This requires Shiro’s Spring AOP integration to scan for the appropriate annotated classes and perform security logic as necessary.


But I don't know how to enable "shiro's spring AOP integration". Is there any procedure about this?


Thanks,

Jared, (韦煜)
Software developer
Interested in open source software, big data, Linux


From: Brian Demers <[hidden email]>
Sent: Wednesday, July 5, 2017 11:22:01 PM
To: [hidden email]
Subject: Re: One question about shiro annotations with spring
 
What do your annotations look like ?

On Tue, Jun 27, 2017 at 3:33 AM, Yu Wei <[hidden email]> wrote:

Hi guys,

Should shiro annotations work with spring controller or spring services?

When I configured filters in applicationContext.xml as below, everything works well.

<property name="filters">
            <util:map>
                <entry key="authc">
                    <bean class="org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter"/>
                </entry>
            </util:map>
        </property>
        <property name="filterChainDefinitions">
            <value>
                /school/** = authc
                /user/** = authc, roles[888888]
                /role/** = authc, roles[888888]
                /permission/** = authc, roles[888888]
                /** = anon
            </value>
        </property>


However, when I use the annotations in java code, it doesn't work.


Do I missed anything? Any advice?



Thanks,

Jared, (韦煜)
Software developer
Interested in open source software, big data, Linux