if (currentUser == null) {
</BUG>
return null;
}
<BUG>return currentUser.getName();
</BUG>
}
@Override
public Result onUnauthorized(Context ctx) {
return redirect(controllers.routes.SessionsController.index());

import play.mvc.Security.Authenticator;
public class RedirectAuthenticator extends Authenticator {
private static final Logger log = LoggerFactory.getLogger(RedirectAuthenticator.class);
@Override
public String getUsername(Context ctx) {
final User sessionUser = User.authenticateSessionUser();
if (sessionUser == null) {
return null;
}
return sessionUser.getName();
}
@Override
public Result onUnauthorized(Context ctx) {
return redirect(controllers.routes.SessionsController.index());
