final class SpnegoHttpServletRequest extends javax.servlet.http.HttpServletRequestWrapper implements DelegateServletRequest, SpnegoAccessControl
Also, see the documentation on the DelegateServletRequest class.
Finally, a credential delegation example can be found on http://spnego.sourceforge.net
| Modifier and Type | Field and Description |
|---|---|
private UserAccessControl |
accessControl
authZ framework interface.
|
private static String |
MESSAGE_UNSUPPORTED |
private SpnegoPrincipal |
principal
Client Principal.
|
| Constructor and Description |
|---|
SpnegoHttpServletRequest(javax.servlet.http.HttpServletRequest request,
SpnegoPrincipal spnegoPrincipal)
Creates Servlet Request specifying KerberosPrincipal of user.
|
SpnegoHttpServletRequest(javax.servlet.http.HttpServletRequest request,
SpnegoPrincipal spnegoPrincipal,
UserAccessControl userAccessControl)
Creates Servlet Request specifying KerberosPrincipal of user
and a specified User Access Control (authZ).
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
anyAccess(String... resources)
Checks to see if the user has at least one of the passed-in user-defined
resource labels
|
boolean |
anyRole(String... roles)
Checks to see if the user has at least one of the passed-in attributes.
|
String |
getAuthType()
Returns "Negotiate" or "Basic" else default auth type.
|
GSSCredential |
getDelegatedCredential()
Returns the requester's delegated credential.
|
String |
getRemoteUser()
Returns authenticated username (sans domain/realm) else default username.
|
UserInfo |
getUserInfo()
Returns the user's info object.
|
Principal |
getUserPrincipal()
Returns KerberosPrincipal of user.
|
boolean |
hasAccess(String resource)
Checks to see if the user has access to the user-defined resource label.
|
boolean |
hasAccess(String resourceX,
String... resourceYs)
Checks to see if the user has the first user-defined resource label
AND has at least one of the passed-in user-defined resource labels.
|
boolean |
hasRole(String role)
Checks to see if the user has the passed-in attribute.
|
boolean |
hasRole(String featureX,
String... featureYs)
Checks to see if the user has the first attribute
AND has at least one of the passed-in attributes.
|
boolean |
isUserInRole(String role) |
getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValidgetAttribute, 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, setRequestclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAttribute, 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, setCharacterEncodingprivate static final String MESSAGE_UNSUPPORTED
private final transient SpnegoPrincipal principal
private final transient UserAccessControl accessControl
SpnegoHttpServletRequest(javax.servlet.http.HttpServletRequest request, SpnegoPrincipal spnegoPrincipal)
request - spnegoPrincipal - SpnegoHttpServletRequest(javax.servlet.http.HttpServletRequest request, SpnegoPrincipal spnegoPrincipal, UserAccessControl userAccessControl)
request - spnegoPrincipal - userAccessControl - public String getAuthType()
getAuthType in interface javax.servlet.http.HttpServletRequestgetAuthType in class javax.servlet.http.HttpServletRequestWrapperHttpServletRequest.getAuthType()public GSSCredential getDelegatedCredential()
DelegateServletRequestReturns null if request has no delegated credential or if delegated credentials are not supported.
getDelegatedCredential in interface DelegateServletRequestpublic String getRemoteUser()
getRemoteUser in interface javax.servlet.http.HttpServletRequestgetRemoteUser in class javax.servlet.http.HttpServletRequestWrapperHttpServletRequest.getRemoteUser()public Principal getUserPrincipal()
getUserPrincipal in interface javax.servlet.http.HttpServletRequestgetUserPrincipal in class javax.servlet.http.HttpServletRequestWrapperHttpServletRequest.getUserPrincipal()public boolean anyRole(String... roles)
SpnegoAccessControl
String[] attributes = new String[] {"Developer", "Los Angeles", "Manager"};
if (accessControl.anyRole(attributes)) {
// will be in here if the user has at least one matching attribute
}
anyRole in interface SpnegoAccessControlroles - e.g. Team Lead, IT, Developerpublic boolean hasRole(String role)
SpnegoAccessControl
String attribute = "Developer";
if (accessControl.hasRole(attribute)) {
// will be in here if the user has the matching attribute
}
hasRole in interface SpnegoAccessControlrole - e.g. Team Lead, IT, Developerpublic boolean hasRole(String featureX, String... featureYs)
SpnegoAccessControl
String attributeX = "Los Angeles";
String[] attributeYs = new String[] {"Developer", "Manager"};
if (accessControl.hasRole(attributeX, attributeYs)) {
// will be in here if the user has attributeX
// AND has at least one of the attributeYs.
}
hasRole in interface SpnegoAccessControlfeatureX - e.g. Information TechnologyfeatureYs - e.g. Team Lead, IT-Architecture-DLpublic boolean anyAccess(String... resources)
SpnegoAccessControl
String[] resources = new String[] {"admin-links", "ops-buttons"};
if (accessControl.anyAccess(resources)) {
// will be in here if the user has at least one matching resource
}
anyAccess in interface SpnegoAccessControlresources - e.g. admin-links, ops-buttonspublic boolean hasAccess(String resource)
SpnegoAccessControl
boolean hasPermission = false;
if (request instanceof SpnegoAccessControl) {
SpnegoAccessControl accessControl = (SpnegoAccessControl) request;
hasPermission = accessControl.hasAccess("finance-links");
}
hasAccess in interface SpnegoAccessControlresource - e.g. admin-buttonspublic boolean hasAccess(String resourceX, String... resourceYs)
SpnegoAccessControl
String resourceX = "finance-links";
String[] resourceYs = new String[] {"admin-links", "accounting-buttons"};
if (accessControl.hasAccess(resourceX, resourceYs)) {
// will be in here if the user has resourceX
// AND has at least one of the resourceYs.
}
hasAccess in interface SpnegoAccessControlresourceX - e.g. finance-linksresourceYs - e.g. admin-links, accounting-buttonspublic UserInfo getUserInfo()
SpnegoAccessControlgetUserInfo in interface SpnegoAccessControlpublic boolean isUserInRole(String role)
isUserInRole in interface javax.servlet.http.HttpServletRequestisUserInRole in class javax.servlet.http.HttpServletRequestWrapper