1
2
3
4
5
6
7
8
9
10
11
12
13
14 package waffle.servlet;
15
16 import javax.servlet.http.HttpSessionBindingEvent;
17 import javax.servlet.http.HttpSessionBindingListener;
18
19 import waffle.windows.auth.IWindowsIdentity;
20 import waffle.windows.auth.PrincipalFormat;
21
22
23
24
25 public class AutoDisposableWindowsPrincipal extends WindowsPrincipal implements HttpSessionBindingListener {
26
27
28 private static final long serialVersionUID = 1L;
29
30
31
32
33
34
35
36 public AutoDisposableWindowsPrincipal(final IWindowsIdentity windowsIdentity) {
37 super(windowsIdentity);
38 }
39
40
41
42
43
44
45
46
47
48
49
50 public AutoDisposableWindowsPrincipal(final IWindowsIdentity windowsIdentity,
51 final PrincipalFormat principalFormat, final PrincipalFormat roleFormat) {
52 super(windowsIdentity, principalFormat, roleFormat);
53 }
54
55
56
57
58 @Override
59 public void valueBound(final HttpSessionBindingEvent evt) {
60
61 }
62
63
64
65
66 @Override
67 public void valueUnbound(final HttpSessionBindingEvent evt) {
68 if (this.getIdentity() != null) {
69 this.getIdentity().dispose();
70 }
71 }
72
73 }