1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.shiro.web.tags;
20
21 import javax.servlet.jsp.JspException;
22 import javax.servlet.jsp.tagext.TagSupport;
23
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 import org.apache.shiro.SecurityUtils;
28 import org.apache.shiro.subject.Subject;
29
30
31
32
33 public abstract class SecureTag extends TagSupport {
34
35
36
37 private static final Logger log = LoggerFactory.getLogger(SecureTag.class);
38
39 public SecureTag() {
40 }
41
42 protected Subject getSubject() {
43 return SecurityUtils.getSubject();
44 }
45
46 protected void verifyAttributes() throws JspException {
47 }
48
49 public int doStartTag() throws JspException {
50
51 verifyAttributes();
52
53 return onDoStartTag();
54 }
55
56 public abstract int onDoStartTag() throws JspException;
57 }