net.sf.jguard.filters
Class JGuardServletRequestWrapper

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by net.sf.jguard.filters.JGuardServletRequestWrapper
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class JGuardServletRequestWrapper
extends javax.servlet.http.HttpServletRequestWrapper

wrap the ServletRequest object to 'decorate' it to respect the JAAS mechanism present in j2se.

Author:
Charles Gay

Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
JGuardServletRequestWrapper(javax.servlet.http.HttpServletRequest req)
           
 
Method Summary
 java.lang.String getAuthType()
           
 java.lang.String getRemoteUser()
           
 java.security.Principal getUserPrincipal()
          return a SubjectAsPrincipal object which wrap the Subject in a Principal.
 boolean isUserInRole(java.lang.String role)
          wrap the isUserInRole method to check against all the principal's set of the Subject object.
static void setAuthType(java.lang.String authType)
           
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Constructor Detail

JGuardServletRequestWrapper

public JGuardServletRequestWrapper(javax.servlet.http.HttpServletRequest req)
Method Detail

isUserInRole

public boolean isUserInRole(java.lang.String role)
wrap the isUserInRole method to check against all the principal's set of the Subject object. in the j2ee specification, a principal is a user. in the j2se api, a Subject is a user.

Specified by:
isUserInRole in interface javax.servlet.http.HttpServletRequest
Overrides:
isUserInRole in class javax.servlet.http.HttpServletRequestWrapper
Parameters:
name - of the principal(role) we are looking for
Returns:
boolean :return 'true' if one of the principal the Subject owns has got the same name.return 'false' otherwise.

getUserPrincipal

public java.security.Principal getUserPrincipal()
return a SubjectAsPrincipal object which wrap the Subject in a Principal.

Specified by:
getUserPrincipal in interface javax.servlet.http.HttpServletRequest
Overrides:
getUserPrincipal in class javax.servlet.http.HttpServletRequestWrapper
Returns:
principal

getRemoteUser

public java.lang.String getRemoteUser()
Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest
Overrides:
getRemoteUser in class javax.servlet.http.HttpServletRequestWrapper
Returns:

getAuthType

public java.lang.String getAuthType()
Specified by:
getAuthType in interface javax.servlet.http.HttpServletRequest
Overrides:
getAuthType in class javax.servlet.http.HttpServletRequestWrapper

setAuthType

public static void setAuthType(java.lang.String authType)