title: Redirecting logged in and non logged in users
body: <p>I'm trying to redirect in different jsp page logged in user for example "Admin" and in a different view a non logged in user. Here is my method till now...</p>
  
  <pre><code>@RequestMapping(value = "/lidhOfruesKerkues", method = RequestMethod.POST)
      public ModelAndView lidhOfruesKerkues(@ModelAttribute("merrPersiperKerkues") Kerkues k, Ofrues ofrues,
              Authentication authResult) {
          ofruesService.addOfrues(ofrues);
          int kerkuesId = k.getKerkuesId();
          ofruesService.matchOfruesKerkues(kerkuesId);
          String role = authResult.getAuthorities().toString();
          if (role.contains("ROLE_ADMIN")) {
              return new ModelAndView("redirect:/adminHome");
          } 
          return new ModelAndView("redirect:/ofrojNdihmeView/getKerkuesAktiv");
      }
  </code></pre>
  
  <p>Error thrown is <code>java.lang.NullPointerException: null</code> that comes from "role" when I'm as a non logged in user. If I am logged in as ADMIN it works and redirects me as it should.
  Thanks in advance.</p>