- String user = SecurityContext.getCurrentUser();
- if (user != null)
- {
- LOG.debug("found user \"{}\" in the security-context", user);
- }
- else
- {
- LOG.info("found no user in the security-context, using \"anonymous\"");
- user = "anonymous";
- }
- return user;
+ Assert.state(SecurityContext.userSignedIn(), "No user signed in!");
+ return SecurityContext.getCurrentUser();