protected Model buildModel(Model model) {

        Subject subject = SecurityUtils.getSubject();
        boolean hasRole1 = subject.hasRole("role1");
        boolean hasRole2 = subject.hasRole("role2");

        model.addAttribute("hasRole1", hasRole1);
        model.addAttribute("hasRole2", hasRole2);

        Session session = subject.getSession();
        Map<Object, Object> sessionAttributes = new LinkedHashMap<Object, Object>();
        for (Object key : session.getAttributeKeys()) {
            sessionAttributes.put(key, session.getAttribute(key));
        }
        model.addAttribute("sessionAttributes", sessionAttributes);

        model.addAttribute("subjectSession", subject.getSession());
        return model;
    }
Spring MVC controller responsible for rendering the Shiro Spring sample
application index page.

@since 0.1
samples/spring-mvc/src/main/java/org/apache/shiro/samples/spring/web/IndexController.java