You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Paulo Pires <pj...@ubiwhere.com> on 2012/07/09 15:42:04 UTC

Dealing with @RequiresAuthentication exceptions

Hi list,

Using annotations is really cool, but unfortunately, one seems unable to
deal with exceptions thrown when using it. Am I right?

Now, I know I can drop annotations use and do the logic myself - and
therefore control all exceptions -, but I'd like to continue to use the
cleaner approach, annotations.

Any hint on how one can achieve this without hacking Shiro's source?

Cheers,

-- 
Paulo Pires


Re: Dealing with @RequiresAuthentication exceptions

Posted by Paulo Pires <pj...@ubiwhere.com>.
Yes, I'm in a web container. I believe Jared's answer is what I'm
looking for. I'm eager to look, if possible, to his solution.

Tks,
PP

On 09/07/12 17:26, Kalle Korhonen wrote:
> On Mon, Jul 9, 2012 at 9:17 AM, Paulo Pires <pj...@ubiwhere.com> wrote:
>> Ah, that's it. So you implement your own servlet filters by extending
>> Shiro one(s)?
> Extend only if there's functionality you need. If you are in a web
> container or IoC container environment, you typically have some type
> of configurable exception handler mechanism (Spring, Tapestry-IoC has
> one, pretty sure Guice has something like that as well). Not sure
> whether you even have a webapp, but for some ideas you could check out
> http://tynamo.org/tapestry-exceptionpage+guide and implement a
> configurable exception handler mechanism in your own environment.
>
> Kalle
>
>
>> On Mon Jul  9 15:03:42 2012, Jared Bunting wrote:
>>> What sort of thing are you trying to do?  Typically, I do my annotation
>>> handling at the level where I can do something about it.  For instance,
>>> using Shiro in a webapp, I'll do handling of exceptions thrown from the
>>> annotations in servet filters.  This allows me to form a web response
>>> based on the exception.
>>>
>>> -Jared
>>>
>>> On Mon 09 Jul 2012 08:42:04 AM CDT, Paulo Pires wrote:
>>>> Hi list,
>>>>
>>>> Using annotations is really cool, but unfortunately, one seems unable to
>>>> deal with exceptions thrown when using it. Am I right?
>>>>
>>>> Now, I know I can drop annotations use and do the logic myself - and
>>>> therefore control all exceptions -, but I'd like to continue to use the
>>>> cleaner approach, annotations.
>>>>
>>>> Any hint on how one can achieve this without hacking Shiro's source?
>>>>
>>>> Cheers,
>>>>
>>>
>> --
>> Paulo Pires

-- 
Paulo Pires




Re: Dealing with @RequiresAuthentication exceptions

Posted by Kalle Korhonen <ka...@gmail.com>.
On Mon, Jul 9, 2012 at 9:17 AM, Paulo Pires <pj...@ubiwhere.com> wrote:
> Ah, that's it. So you implement your own servlet filters by extending
> Shiro one(s)?

Extend only if there's functionality you need. If you are in a web
container or IoC container environment, you typically have some type
of configurable exception handler mechanism (Spring, Tapestry-IoC has
one, pretty sure Guice has something like that as well). Not sure
whether you even have a webapp, but for some ideas you could check out
http://tynamo.org/tapestry-exceptionpage+guide and implement a
configurable exception handler mechanism in your own environment.

Kalle


> On Mon Jul  9 15:03:42 2012, Jared Bunting wrote:
>> What sort of thing are you trying to do?  Typically, I do my annotation
>> handling at the level where I can do something about it.  For instance,
>> using Shiro in a webapp, I'll do handling of exceptions thrown from the
>> annotations in servet filters.  This allows me to form a web response
>> based on the exception.
>>
>> -Jared
>>
>> On Mon 09 Jul 2012 08:42:04 AM CDT, Paulo Pires wrote:
>>> Hi list,
>>>
>>> Using annotations is really cool, but unfortunately, one seems unable to
>>> deal with exceptions thrown when using it. Am I right?
>>>
>>> Now, I know I can drop annotations use and do the logic myself - and
>>> therefore control all exceptions -, but I'd like to continue to use the
>>> cleaner approach, annotations.
>>>
>>> Any hint on how one can achieve this without hacking Shiro's source?
>>>
>>> Cheers,
>>>
>>
>>
>
> --
> Paulo Pires

Re: Dealing with @RequiresAuthentication exceptions

Posted by Paulo Pires <pj...@ubiwhere.com>.
Ah, that's it. So you implement your own servlet filters by extending 
Shiro one(s)?

PP

On Mon Jul  9 15:03:42 2012, Jared Bunting wrote:
> What sort of thing are you trying to do?  Typically, I do my annotation
> handling at the level where I can do something about it.  For instance,
> using Shiro in a webapp, I'll do handling of exceptions thrown from the
> annotations in servet filters.  This allows me to form a web response
> based on the exception.
>
> -Jared
>
> On Mon 09 Jul 2012 08:42:04 AM CDT, Paulo Pires wrote:
>> Hi list,
>>
>> Using annotations is really cool, but unfortunately, one seems unable to
>> deal with exceptions thrown when using it. Am I right?
>>
>> Now, I know I can drop annotations use and do the logic myself - and
>> therefore control all exceptions -, but I'd like to continue to use the
>> cleaner approach, annotations.
>>
>> Any hint on how one can achieve this without hacking Shiro's source?
>>
>> Cheers,
>>
>
>

--
Paulo Pires

Re: Dealing with @RequiresAuthentication exceptions

Posted by Jared Bunting <ja...@peachjean.com>.
What sort of thing are you trying to do?  Typically, I do my annotation 
handling at the level where I can do something about it.  For instance, 
using Shiro in a webapp, I'll do handling of exceptions thrown from the 
annotations in servet filters.  This allows me to form a web response 
based on the exception.

-Jared

On Mon 09 Jul 2012 08:42:04 AM CDT, Paulo Pires wrote:
> Hi list,
>
> Using annotations is really cool, but unfortunately, one seems unable to
> deal with exceptions thrown when using it. Am I right?
>
> Now, I know I can drop annotations use and do the logic myself - and
> therefore control all exceptions -, but I'd like to continue to use the
> cleaner approach, annotations.
>
> Any hint on how one can achieve this without hacking Shiro's source?
>
> Cheers,
>