KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > interceptor > PrincipalProxy


1 package com.opensymphony.webwork.interceptor;
2
3 import javax.servlet.http.HttpServletRequest JavaDoc;
4 import java.security.Principal JavaDoc;
5
6 /**
7  * Proxy class used together with PrincipalAware interface. It allows to get indirect access to
8  * HttpServletRequest Principal related methods.
9  *
10  * @author Remigijus Bauzys
11  * @version $Revision: 1.1 $
12  */

13 public class PrincipalProxy {
14     private HttpServletRequest JavaDoc request;
15
16     public PrincipalProxy(HttpServletRequest JavaDoc request) {
17         this.request = request;
18     }
19
20     public boolean isUserInRole(String JavaDoc role) {
21         return request.isUserInRole(role);
22     }
23
24     public Principal JavaDoc getUserPrincipal() {
25         return request.getUserPrincipal();
26     }
27
28     public String JavaDoc getRemoteUser() {
29         return request.getRemoteUser();
30     }
31
32     public boolean isRequestSecure() {
33         return request.isSecure();
34     }
35
36     public HttpServletRequest JavaDoc getRequest() {
37         return request;
38     }
39 }
40
Popular Tags