public class JaccWebAuthorizationManager extends Object
All the authorization decisions required to allow access to a resource in the web container should happen via this class.
Note that according to the JACC specification, for the actual authorization decision we delegate our queries
to a JACC aware Policy
, which is pluggable (can be replaced by the user).
Modifier and Type | Field and Description |
---|---|
protected CodeSource |
codesource |
static String |
CONSTRAINT_URI
Request path.
|
protected Policy |
policy |
protected javax.security.jacc.PolicyConfiguration |
policyConfiguration |
protected javax.security.jacc.PolicyConfigurationFactory |
policyConfigurationFactory |
Constructor and Description |
---|
JaccWebAuthorizationManager(WebBundleDescriptor webBundleDescriptor,
ServerContext serverContext,
WebSecurityManagerFactory webSecurityManagerFactory,
boolean register) |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
static String |
getContextID(WebBundleDescriptor webBundleDescriptor) |
boolean |
hasNoConstrainedResources()
This method returns true to indicate that a policy check was made and there were no constrained resources.
|
boolean |
hasResourcePermission(javax.servlet.http.HttpServletRequest servletRequest)
Perform access control based on the
HttpServletRequest . |
boolean |
hasRoleRefPermission(String servletName,
String role,
Principal principal)
Return
true if the specified servletName has the specified security role, within the context of the
WebRoleRefPermission ; otherwise return false . |
int |
hasUserDataPermission(javax.servlet.http.HttpServletRequest servletRequest,
String uri,
String httpMethod)
Checks if for the given request and the given request URI and method are the target of any user-data-constraint with a
and whether any such constraint is already satisfied.
|
boolean |
isPermitAll(javax.servlet.http.HttpServletRequest request) |
void |
release()
Analogous to destroy, except does not remove links from Policy Context, and does not remove context_id from role
mapper factory.
|
public static final String CONSTRAINT_URI
protected Policy policy
protected javax.security.jacc.PolicyConfigurationFactory policyConfigurationFactory
protected javax.security.jacc.PolicyConfiguration policyConfiguration
protected CodeSource codesource
public JaccWebAuthorizationManager(WebBundleDescriptor webBundleDescriptor, ServerContext serverContext, WebSecurityManagerFactory webSecurityManagerFactory, boolean register) throws javax.security.jacc.PolicyContextException
javax.security.jacc.PolicyContextException
public static String getContextID(WebBundleDescriptor webBundleDescriptor)
public boolean hasNoConstrainedResources()
When caching is disabled must always return false, which will ensure that policy is consulted to authorize each request.
public int hasUserDataPermission(javax.servlet.http.HttpServletRequest servletRequest, String uri, String httpMethod)
if uri == null, determine if the connection characteristics of the request satisfy the applicable policy. If the uri is not null, determine if the uri and Http method require a CONFIDENTIAL transport. The uri value does not include the context path, and any colons occurring in the uri must be escaped.
Note: this method is not intended to be called if the request is secure. It checks whether the resource can be accessed over the current connection type (which is presumed to be insecure), and if an insecure connection type is not permitted it checks if the resource can be accessed via a confidential transport.
If the request is secure, the second check is skipped, and the proper result is returned (but that is not the intended use model).
servletRequest
- the request that may be redirecteduri
- the request URI (minus the context path) to checkmethod
- the request method to checkpublic boolean isPermitAll(javax.servlet.http.HttpServletRequest request)
public boolean hasResourcePermission(javax.servlet.http.HttpServletRequest servletRequest)
HttpServletRequest
. Return true
if this constraint is
satisfied and processing should continue, or false
otherwise.public boolean hasRoleRefPermission(String servletName, String role, Principal principal)
true
if the specified servletName has the specified security role, within the context of the
WebRoleRefPermission
; otherwise return false
.servletName
- the resource's namerole
- Security role to be checkedprincipal
- Principal for whom the role is to be checkedpublic void release() throws javax.security.jacc.PolicyContextException
javax.security.jacc.PolicyContextException
public void destroy() throws javax.security.jacc.PolicyContextException
javax.security.jacc.PolicyContextException
Copyright © 2019. All rights reserved.