only component subclasses are injected. in your sessions's constructor
do injectorholder.getinjector().inject(this) to inject the session
instance.

-igor

On Wed, Dec 17, 2008 at 10:18 AM, Curtis Cooley
<[email protected]> wrote:
> I'm still struggling with authentication, but I've figured out the
> 'basic' wicket way. I have a class that extends AuthenticatedWebSession
> and implements the authenticate(String user, String passwd) method. Now
> I'd like to use a @SpringBean to access the database to look up the
> user. The problem seems to be that when the AuthenticatedWebSession is
> created, Spring injection does not happen, so I get NullPointerExceptions.
>
> Is there an example I've overlooked that uses a database to lookup users
> during authentication. is it possible to use Spring and Hibernate to do
> this?
>
> The code:
>
> @SpringBean
> private DictionaryDao dictionaryDao;
>
> @Override
> public boolean authenticate(String username, String password) {
>        try {
>            // dictionaryDao is null when authentication is attempted
>            User user = dictionaryDao.userByName(username);
>            return user != null && password.equals(user.getPassword());
>        } catch (Exception e) {
>            e.printStackTrace();
>            return false;
>        }
> }
>
>
>
> Confidential/Privileged information may be contained in this email. If you 
> are not the intended recipient, please do not copy, distribute or use it for 
> any purpose, nor disclose its contents to any other person. Please notify the 
> sender immediately if you receive this in error.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to