| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 |
|
|
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
package net.sourceforge.pebble.security; |
| 33 |
|
|
| 34 |
|
import org.acegisecurity.intercept.AbstractSecurityInterceptor; |
| 35 |
|
import org.acegisecurity.intercept.InterceptorStatusToken; |
| 36 |
|
import org.acegisecurity.intercept.ObjectDefinitionSource; |
| 37 |
|
import org.acegisecurity.intercept.web.FilterInvocation; |
| 38 |
|
import org.acegisecurity.intercept.web.FilterInvocationDefinitionSource; |
| 39 |
|
|
| 40 |
|
import javax.servlet.*; |
| 41 |
|
import java.io.IOException; |
| 42 |
|
|
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
@author |
| 49 |
|
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 13 |
Complexity Density: 0,87 |
|
| 50 |
|
public class PrivateBlogSecurityInterceptor extends AbstractSecurityInterceptor implements Filter { |
| 51 |
|
|
| 52 |
|
private static final String FILTER_APPLIED = "__acegi_privateBlogSecurityInterceptor_filterApplied"; |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
| 56 |
|
private boolean observeOncePerRequest = true; |
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 63 |
0
|
public void destroy() {}... |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
@link |
| 67 |
|
|
| 68 |
|
|
| 69 |
|
@param |
| 70 |
|
@param |
| 71 |
|
@param |
| 72 |
|
|
| 73 |
|
@throws |
| 74 |
|
@throws |
| 75 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 76 |
0
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)... |
| 77 |
|
throws IOException, ServletException { |
| 78 |
0
|
FilterInvocation fi = new FilterInvocation(request, response, chain); |
| 79 |
0
|
invoke(fi); |
| 80 |
|
} |
| 81 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 82 |
0
|
public Class getSecureObjectClass() {... |
| 83 |
0
|
return FilterInvocation.class; |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
@param |
| 90 |
|
|
| 91 |
|
@throws |
| 92 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 93 |
0
|
public void init(FilterConfig arg0) throws ServletException {}... |
| 94 |
|
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 5 |
Complexity Density: 0,62 |
|
| 95 |
0
|
public void invoke(FilterInvocation fi) throws IOException, ServletException {... |
| 96 |
0
|
if ((fi.getRequest() != null) && (fi.getRequest().getAttribute(FILTER_APPLIED) != null) |
| 97 |
|
&& observeOncePerRequest) { |
| 98 |
|
|
| 99 |
|
|
| 100 |
0
|
fi.getChain().doFilter(fi.getRequest(), fi.getResponse()); |
| 101 |
|
} else { |
| 102 |
|
|
| 103 |
0
|
if (fi.getRequest() != null) { |
| 104 |
0
|
fi.getRequest().setAttribute(FILTER_APPLIED, Boolean.TRUE); |
| 105 |
|
} |
| 106 |
|
|
| 107 |
0
|
InterceptorStatusToken token = super.beforeInvocation(fi); |
| 108 |
|
|
| 109 |
0
|
try { |
| 110 |
0
|
fi.getChain().doFilter(fi.getRequest(), fi.getResponse()); |
| 111 |
|
} finally { |
| 112 |
0
|
super.afterInvocation(token, null); |
| 113 |
|
} |
| 114 |
|
} |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
| 121 |
|
|
| 122 |
|
|
| 123 |
|
@return |
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 127 |
0
|
public boolean isObserveOncePerRequest() {... |
| 128 |
0
|
return observeOncePerRequest; |
| 129 |
|
} |
| 130 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 131 |
0
|
public void setObserveOncePerRequest(boolean observeOncePerRequest) {... |
| 132 |
0
|
this.observeOncePerRequest = observeOncePerRequest; |
| 133 |
|
} |
| 134 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 135 |
0
|
public FilterInvocationDefinitionSource getObjectDefinitionSource() {... |
| 136 |
0
|
return new PrivateBlogFilterInvocationDefinitionSource(); |
| 137 |
|
} |
| 138 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 139 |
0
|
public ObjectDefinitionSource obtainObjectDefinitionSource() {... |
| 140 |
0
|
return new PrivateBlogFilterInvocationDefinitionSource(); |
| 141 |
|
} |
| 142 |
|
|
| 143 |
|
} |