org.mortbay.http
Class SecurityConstraint
java.lang.Object
org.mortbay.http.SecurityConstraint
- Cloneable, Serializable
public class SecurityConstraint
extends java.lang.Object
implements Cloneable, Serializable
Describe an auth and/or data constraint.
ANY_ROLE
public static final String ANY_ROLE
DC_CONFIDENTIAL
public static final int DC_CONFIDENTIAL
DC_INTEGRAL
public static final int DC_INTEGRAL
DC_NONE
public static final int DC_NONE
DC_UNSET
public static final int DC_UNSET
NONE
public static final String NONE
__BASIC_AUTH
public static final String __BASIC_AUTH
__CERT_AUTH
public static final String __CERT_AUTH
__CERT_AUTH2
public static final String __CERT_AUTH2
__DIGEST_AUTH
public static final String __DIGEST_AUTH
__FORM_AUTH
public static final String __FORM_AUTH
SecurityConstraint
public SecurityConstraint()
Constructor.
SecurityConstraint
public SecurityConstraint(String name,
String role)
Conveniance Constructor.
addMethod
public void addMethod(String method)
addRole
public void addRole(String role)
role
- The rolename. If the rolename is '*' all other
roles are removed and anyRole is set true and subsequent
addRole calls are ignored.
Authenticate is forced true by this call.
check
public static boolean check(List constraints,
Authenticator authenticator,
UserRealm realm,
String pathInContext,
HttpRequest request,
HttpResponse response)
throws HttpException,
IOException
Check security contraints
constraints
- authenticator
- realm
- pathInContext
- request
- response
-
- false if the request has failed a security constraint or the authenticator has already sent a response.
clone
public Object clone()
throws CloneNotSupportedException
forMethod
public boolean forMethod(String method)
- True if this constraint applies to the method. If no
method has been set, then the constraint applies to all methods.
getAuthenticate
public boolean getAuthenticate()
- True if the constraint requires request authentication
getDataConstraint
public int getDataConstraint()
- Data constrain indicator: 0=DC+NONE, 1=DC_INTEGRAL & 2=DC_CONFIDENTIAL
getMethods
public List getMethods()
getRoles
public List getRoles()
- List of roles for this constraint.
hasDataConstraint
public boolean hasDataConstraint()
- True if a data constraint has been set.
hasRole
public boolean hasRole(String role)
- True if the constraint contains the role.
isAnyRole
public boolean isAnyRole()
- True if any user role is permitted.
isForbidden
public boolean isForbidden()
- True if authentication required but no roles set
setAuthenticate
public void setAuthenticate(boolean authenticate)
authenticate
- True if users must be authenticated
setDataConstraint
public void setDataConstraint(int c)
setName
public void setName(String name)
toString
public String toString()
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.