01: package com.opensymphony.webwork.interceptor;
02:
03: import javax.servlet.http.HttpServletRequest;
04: import java.security.Principal;
05:
06: /**
07: * Proxy class used together with PrincipalAware interface. It allows to get indirect access to
08: * HttpServletRequest Principal related methods.
09: *
10: * @author Remigijus Bauzys
11: * @version $Revision: 577 $
12: */
13: public class PrincipalProxy {
14: private HttpServletRequest request;
15:
16: public PrincipalProxy(HttpServletRequest request) {
17: this .request = request;
18: }
19:
20: public boolean isUserInRole(String role) {
21: return request.isUserInRole(role);
22: }
23:
24: public Principal getUserPrincipal() {
25: return request.getUserPrincipal();
26: }
27:
28: public String getRemoteUser() {
29: return request.getRemoteUser();
30: }
31:
32: public boolean isRequestSecure() {
33: return request.isSecure();
34: }
35:
36: public HttpServletRequest getRequest() {
37: return request;
38: }
39: }
|