org.apache.catalina.deploy

Class SecurityConstraint

public class SecurityConstraint extends Object implements Serializable

Representation of a security constraint element for a web application, as represented in a <security-constraint> element in the deployment descriptor.

WARNING: It is assumed that instances of this class will be created and modified only within the context of a single thread, before the instance is made visible to the remainder of the application. After that, only read access is expected. Therefore, none of the read and write access within this class is synchronized.

Version: $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $

Author: Craig R. McClanahan

Constructor Summary
SecurityConstraint()
Construct a new security constraint instance with default values.
Method Summary
voidaddAuthRole(String authRole)
Add an authorization role, which is a role name that will be permitted access to the resources protected by this security constraint.
voidaddCollection(SecurityCollection collection)
Add a new web resource collection to those protected by this security constraint.
booleanfindAuthRole(String role)
Return true if the specified role is permitted access to the resources protected by this security constraint.
String[]findAuthRoles()
Return the set of roles that are permitted access to the resources protected by this security constraint.
SecurityCollectionfindCollection(String name)
Return the web resource collection for the specified name, if any; otherwise, return null.
SecurityCollection[]findCollections()
Return all of the web resource collections protected by this security constraint.
booleangetAllRoles()
Was the "all roles" wildcard included in this authentication constraint?
booleangetAuthConstraint()
Return the authorization constraint present flag for this security constraint.
StringgetDisplayName()
Return the display name of this security constraint.
StringgetUserConstraint()
Return the user data constraint for this security constraint.
booleanincluded(String uri, String method)
Return true if the specified context-relative URI (and associated HTTP method) are protected by this security constraint.
voidremoveAuthRole(String authRole)
Remove the specified role from the set of roles permitted to access the resources protected by this security constraint.
voidremoveCollection(SecurityCollection collection)
Remove the specified web resource collection from those protected by this security constraint.
voidsetAuthConstraint(boolean authConstraint)
Set the authorization constraint present flag for this security constraint.
voidsetDisplayName(String displayName)
Set the display name of this security constraint.
voidsetUserConstraint(String userConstraint)
Set the user data constraint for this security constraint.
StringtoString()
Return a String representation of this security constraint.

Constructor Detail

SecurityConstraint

public SecurityConstraint()
Construct a new security constraint instance with default values.

Method Detail

addAuthRole

public void addAuthRole(String authRole)
Add an authorization role, which is a role name that will be permitted access to the resources protected by this security constraint.

Parameters: authRole Role name to be added

addCollection

public void addCollection(SecurityCollection collection)
Add a new web resource collection to those protected by this security constraint.

Parameters: collection The new web resource collection

findAuthRole

public boolean findAuthRole(String role)
Return true if the specified role is permitted access to the resources protected by this security constraint.

Parameters: role Role name to be checked

findAuthRoles

public String[] findAuthRoles()
Return the set of roles that are permitted access to the resources protected by this security constraint. If none have been defined, a zero-length array is returned (which implies that all authenticated users are permitted access).

findCollection

public SecurityCollection findCollection(String name)
Return the web resource collection for the specified name, if any; otherwise, return null.

Parameters: name Web resource collection name to return

findCollections

public SecurityCollection[] findCollections()
Return all of the web resource collections protected by this security constraint. If there are none, a zero-length array is returned.

getAllRoles

public boolean getAllRoles()
Was the "all roles" wildcard included in this authentication constraint?

getAuthConstraint

public boolean getAuthConstraint()
Return the authorization constraint present flag for this security constraint.

getDisplayName

public String getDisplayName()
Return the display name of this security constraint.

getUserConstraint

public String getUserConstraint()
Return the user data constraint for this security constraint.

included

public boolean included(String uri, String method)
Return true if the specified context-relative URI (and associated HTTP method) are protected by this security constraint.

Parameters: uri Context-relative URI to check method Request method being used

removeAuthRole

public void removeAuthRole(String authRole)
Remove the specified role from the set of roles permitted to access the resources protected by this security constraint.

Parameters: authRole Role name to be removed

removeCollection

public void removeCollection(SecurityCollection collection)
Remove the specified web resource collection from those protected by this security constraint.

Parameters: collection Web resource collection to be removed

setAuthConstraint

public void setAuthConstraint(boolean authConstraint)
Set the authorization constraint present flag for this security constraint.

setDisplayName

public void setDisplayName(String displayName)
Set the display name of this security constraint.

setUserConstraint

public void setUserConstraint(String userConstraint)
Set the user data constraint for this security constraint.

Parameters: userConstraint The new user data constraint

toString

public String toString()
Return a String representation of this security constraint.
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.