All,

 I just got finished reading the reference guide that Les posted. It's
awesome, thanks Les. Reading it reminded me of a problem I am having
with catching login exceptions. In my code I use the default quick-start
Authenticator which performs the login using
SecurityUtils.subject.login(authToken).  If I purposely use an account
that does not exists and break on 

 

catch ( UnknownAccountException uae ) 

 

It does not catch it. Instead it goes to 

 

catch (AuthenticationException ex)

 

and from there I parse the ex.getMessage() to determine the error type. 

 

In the reference guide in the Subject section there is an example login
that is executed by currentUser which is of type Subject. Could it be
that I am using the wrong class to do login and that is why my exception
isn't getting caught.

 

 

Code sample: 

 

Inside ShiroDbRealm....

 

        if (!user)

        {

            log.error "No such user in DB realm. Throwing Exception"

            throw new UnknownAccountException("No account found for user
[${username}]")

        }

 

Reply via email to