net.sourceforge.spnego
Class SpnegoHttpServletRequest

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by net.sourceforge.spnego.SpnegoHttpServletRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest, DelegateServletRequest

final class SpnegoHttpServletRequest
extends javax.servlet.http.HttpServletRequestWrapper
implements DelegateServletRequest

Wrap ServletRequest so we can do our own handling of the principal and auth types.

Also, see the documentation on the DelegateServletRequest class.

Finally, a credential delegation example can be found on http://spnego.sourceforge.net

Author:
Darwin V. Felix

Field Summary
private  SpnegoPrincipal principal
          Client Principal.
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
SpnegoHttpServletRequest(javax.servlet.http.HttpServletRequest request, SpnegoPrincipal spnegoPrincipal)
          Creates Servlet Request specifying KerberosPrincipal of user.
 
Method Summary
 String getAuthType()
          Returns "Negotiate" or "Basic" else default auth type.
 GSSCredential getDelegatedCredential()
          Return the client's/requester's delegated credential or null.
 String getRemoteUser()
          Returns authenticated username (sans domain/realm) else default username.
 Principal getUserPrincipal()
          Returns KerberosPrincipal of user.
 
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, isUserInRole
 
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
 

Field Detail

principal

private final transient SpnegoPrincipal principal
Client Principal.

Constructor Detail

SpnegoHttpServletRequest

SpnegoHttpServletRequest(javax.servlet.http.HttpServletRequest request,
                         SpnegoPrincipal spnegoPrincipal)
Creates Servlet Request specifying KerberosPrincipal of user.

Parameters:
request -
spnegoPrincipal -
Method Detail

getAuthType

public String getAuthType()
Returns "Negotiate" or "Basic" else default auth type.

Specified by:
getAuthType in interface javax.servlet.http.HttpServletRequest
Overrides:
getAuthType in class javax.servlet.http.HttpServletRequestWrapper
See Also:
HttpServletRequest.getAuthType()

getDelegatedCredential

public GSSCredential getDelegatedCredential()
Return the client's/requester's delegated credential or null.

Specified by:
getDelegatedCredential in interface DelegateServletRequest
Returns:
client's delegated credential or null.

getRemoteUser

public String getRemoteUser()
Returns authenticated username (sans domain/realm) else default username.

Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest
Overrides:
getRemoteUser in class javax.servlet.http.HttpServletRequestWrapper
See Also:
HttpServletRequest.getRemoteUser()

getUserPrincipal

public Principal getUserPrincipal()
Returns KerberosPrincipal of user.

Specified by:
getUserPrincipal in interface javax.servlet.http.HttpServletRequest
Overrides:
getUserPrincipal in class javax.servlet.http.HttpServletRequestWrapper
See Also:
HttpServletRequest.getUserPrincipal()