*/
@Override
public Subject login() throws LoginException
{
if (token == null)
throw new LoginException("Insufficient information to login");
// Attempt authentication.
try
{
AuthenticationManager authenticationManager =
((SpringSecureWicketApplication) Application.get()).getAuthenticationManager();
if (authenticationManager == null)
throw new LoginException(
"AuthenticationManager is not available, check if your spring config contains a property for the authenticationManager in your wicketApplication bean.");
Authentication authResult = authenticationManager.authenticate(token);
setAuthentication(authResult);
}
catch (RuntimeException e)
{
setAuthentication(null);
throw new LoginException(e);
}
// cleanup
token = null;
// return result
return new SpringSecureSubject();