001: /*
002: * ====================================================================
003: * JAFFA - Java Application Framework For All
004: *
005: * Copyright (C) 2002 JAFFA Development Group
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: * Redistribution and use of this software and associated documentation ("Software"),
022: * with or without modification, are permitted provided that the following conditions are met:
023: * 1. Redistributions of source code must retain copyright statements and notices.
024: * Redistributions must also contain a copy of this document.
025: * 2. Redistributions in binary form must reproduce the above copyright notice,
026: * this list of conditions and the following disclaimer in the documentation
027: * and/or other materials provided with the distribution.
028: * 3. The name "JAFFA" must not be used to endorse or promote products derived from
029: * this Software without prior written permission. For written permission,
030: * please contact mail to: jaffagroup@yahoo.com.
031: * 4. Products derived from this Software may not be called "JAFFA" nor may "JAFFA"
032: * appear in their names without prior written permission.
033: * 5. Due credit should be given to the JAFFA Project (http://jaffa.sourceforge.net).
034: *
035: * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
036: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
037: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
038: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
039: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
040: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
041: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
042: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
043: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
044: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
045: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
046: * SUCH DAMAGE.
047: * ====================================================================
048: */
049:
050: /*
051: * FakeRequest.java
052: *
053: * Created on April 8, 2002, 4:31 PM
054: */
055:
056: package org.jaffa.security;
057:
058: /**
059: *
060: * @author paule
061: * @version
062: */
063: public class FakeRequest implements
064: javax.servlet.http.HttpServletRequest {
065:
066: String m_name = null;
067:
068: /** Creates new FakeRequest */
069: public FakeRequest(String name) {
070: m_name = name;
071: }
072:
073: public java.lang.String getContextPath() {
074: return null;
075: }
076:
077: /** @deprecated */
078: public java.lang.String getRealPath(java.lang.String str) {
079: return null;
080: }
081:
082: public java.lang.String getRequestedSessionId() {
083: return null;
084: }
085:
086: public java.io.BufferedReader getReader()
087: throws java.io.IOException {
088: return null;
089: }
090:
091: public java.lang.String getAuthType() {
092: return null;
093: }
094:
095: public java.util.Enumeration getHeaders(java.lang.String str) {
096: return null;
097: }
098:
099: public long getDateHeader(java.lang.String str) {
100: return 0;
101: }
102:
103: public javax.servlet.ServletInputStream getInputStream()
104: throws java.io.IOException {
105: return null;
106: }
107:
108: public boolean isRequestedSessionIdValid() {
109: return false;
110: }
111:
112: public java.security.Principal getUserPrincipal() {
113: return new FakePrincipal(m_name);
114: }
115:
116: public void setAttribute(java.lang.String str, java.lang.Object obj) {
117: }
118:
119: public java.lang.String getPathInfo() {
120: return null;
121: }
122:
123: public java.lang.String getRemoteUser() {
124: return null;
125: }
126:
127: public java.lang.String getHeader(java.lang.String str) {
128: return null;
129: }
130:
131: public java.lang.String getCharacterEncoding() {
132: return null;
133: }
134:
135: public java.lang.String getServerName() {
136: return null;
137: }
138:
139: public java.util.Enumeration getLocales() {
140: return null;
141: }
142:
143: public javax.servlet.http.HttpSession getSession() {
144: return null;
145: }
146:
147: public void removeAttribute(java.lang.String str) {
148: return;
149: }
150:
151: public java.lang.String getContentType() {
152: return null;
153: }
154:
155: public java.lang.String getScheme() {
156: return null;
157: }
158:
159: public boolean isRequestedSessionIdFromCookie() {
160: return false;
161: }
162:
163: public int getServerPort() {
164: return 0;
165: }
166:
167: public javax.servlet.http.Cookie[] getCookies() {
168: return null;
169: }
170:
171: public boolean isRequestedSessionIdFromURL() {
172: return false;
173: }
174:
175: /** @deprecated */
176: public boolean isRequestedSessionIdFromUrl() {
177: return false;
178: }
179:
180: public java.lang.String getMethod() {
181: return null;
182: }
183:
184: public java.lang.String getParameter(java.lang.String str) {
185: return null;
186: }
187:
188: /** PAUL has Roles CLERK and MANAGER
189: * MAHESH has Role CLERK
190: */
191: public boolean isUserInRole(java.lang.String str) {
192: if (m_name.equals("PAUL")) {
193: return (str != null && (str.equals("CLERK")
194: || str.equals("SUPERVISOR") || str
195: .equals("MANAGER")));
196: } else if (m_name.equals("MAHESH")) {
197: return (str != null && (str.equals("CLERK") || str
198: .equals("SUPERVISOR")));
199: } else
200: return false;
201: }
202:
203: public java.util.Enumeration getParameterNames() {
204: return null;
205: }
206:
207: public java.lang.String getServletPath() {
208: return null;
209: }
210:
211: public java.lang.String getRequestURI() {
212: return null;
213: }
214:
215: public java.lang.String getPathTranslated() {
216: return null;
217: }
218:
219: public java.lang.String[] getParameterValues(java.lang.String str) {
220: return null;
221: }
222:
223: public java.util.Locale getLocale() {
224: return null;
225: }
226:
227: public java.lang.String getProtocol() {
228: return null;
229: }
230:
231: public java.lang.String getRemoteAddr() {
232: return null;
233: }
234:
235: public int getContentLength() {
236: return 0;
237: }
238:
239: public javax.servlet.http.HttpSession getSession(boolean param) {
240: return null;
241: }
242:
243: public java.util.Enumeration getHeaderNames() {
244: return null;
245: }
246:
247: public javax.servlet.RequestDispatcher getRequestDispatcher(
248: java.lang.String str) {
249: return null;
250: }
251:
252: public java.lang.String getRemoteHost() {
253: return null;
254: }
255:
256: public java.lang.String getQueryString() {
257: return null;
258: }
259:
260: public int getIntHeader(java.lang.String str) {
261: return 0;
262: }
263:
264: public java.lang.Object getAttribute(java.lang.String str) {
265: return null;
266: }
267:
268: public java.util.Enumeration getAttributeNames() {
269: return null;
270: }
271:
272: public boolean isSecure() {
273: return false;
274: }
275:
276: public java.util.Map getParameterMap() {
277: return null;
278: }
279:
280: public StringBuffer getRequestURL() {
281: return null;
282: }
283:
284: public void setCharacterEncoding(String str)
285: throws java.io.UnsupportedEncodingException {
286: }
287:
288: }
|