diff --git a/src/main/java/info/bukova/isspst/services/users/UserServiceImpl.java b/src/main/java/info/bukova/isspst/services/users/UserServiceImpl.java index e35dc814..925fe3cb 100644 --- a/src/main/java/info/bukova/isspst/services/users/UserServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/users/UserServiceImpl.java @@ -18,6 +18,7 @@ import org.exolab.castor.xml.Unmarshaller; import org.hibernate.LazyInitializationException; import org.hibernate.Query; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.encoding.PasswordEncoder; @@ -98,6 +99,8 @@ public class UserServiceImpl extends AbstractService implements UserServic return (User)loadUserByUsername(((UserDetails)auth.getPrincipal()).getUsername()); } catch(UsernameNotFoundException e) { return null; + } catch (ClassCastException e) { + throw new AccessDeniedException("Timed out"); } }