You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Brian Demers <br...@gmail.com> on 2017/07/05 15:22:01 UTC
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 <yu...@hotmail.com> 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
>
Re: One question about shiro annotations with spring
Posted by Brian Demers <br...@gmail.com>.
I you are using Spring XML files you can take a look at this example:
https://github.com/apache/shiro/blob/master/samples/spring-xml/src/main/webapp/WEB-INF/applicationContext.xml#L101-L104
On Sat, Jul 8, 2017 at 11:00 AM, Yu Wei <yu...@hotmail.com> 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 <br...@gmail.com>
> *Sent:* Wednesday, July 5, 2017 11:22:01 PM
> *To:* user@shiro.apache.org
> *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 <yu...@hotmail.com> 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.fi
>> lter.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
>>
>
>
Re: One question about shiro annotations with spring
Posted by Yu Wei <yu...@hotmail.com>.
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 <br...@gmail.com>
Sent: Wednesday, July 5, 2017 11:22:01 PM
To: user@shiro.apache.org
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 <yu...@hotmail.com>> 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