You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Les Hazlewood <lh...@apache.org> on 2013/04/17 03:44:30 UTC
Re: AuthenticationException - cant login ... HELP
Hi Ken,
You want the AuthenticationInfo to represent what you have stored in
your data store.
By passing in token.getCredentials(), your login will always work!
(When the token's credentials are compared against the
AuthenticationInfo's credentials, they will always match since they
are the exact same!).
instead, your custom code should look something like this:
User myUser = queryForUser(token.getPrincipals());
return new SimpleAuthenticationInfo(myUser.getUsername(),
myUser.getPassword(), bs, getName());
The AuthenticationInfo now represents data that you have already
stored. The submitted token is then used to compare against this data
to see if there is a match.
HTH,
--
Les Hazlewood | @lhazlewood
CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282
On Tue, Mar 19, 2013 at 1:07 PM, Ken in Nashua <kc...@live.com> wrote:
> resolved...
>
> I use to do this
>
> return new SimpleAuthenticationInfo(username, token, bs, getName());
> }
>
> now I do this
>
> return new SimpleAuthenticationInfo(username,
> token.getCredentials(), bs, getName());
> }
>
> inside my realm authentication routine.
>
> and shiro works
>
> ???