Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mortbay.http
Class SecurityConstraint  view SecurityConstraint download SecurityConstraint.java

java.lang.Object
  extended byorg.mortbay.http.SecurityConstraint
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class SecurityConstraint
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Describe an auth and/or data constraint.

Version:
$Revision: 1.37 $

Nested Class Summary
static class SecurityConstraint.Nobody
          Nobody user.
 
Field Summary
static java.lang.String __BASIC_AUTH
           
static java.lang.String __CERT_AUTH
           
static java.lang.String __CERT_AUTH2
           
static java.lang.String __DIGEST_AUTH
           
static java.lang.String __FORM_AUTH
           
static SecurityConstraint.Nobody __NOBODY
           
private  boolean _anyRole
           
private  boolean _authenticate
           
private  int _dataConstraint
           
private  java.lang.Object _methods
           
private  java.lang.String _name
           
private  java.lang.Object _roles
           
private  java.util.List _umMethods
           
private  java.util.List _umRoles
           
static java.lang.String ANY_ROLE
           
static int DC_CONFIDENTIAL
           
static int DC_INTEGRAL
           
static int DC_NONE
           
static int DC_UNSET
           
private static org.apache.commons.logging.Log log
           
static java.lang.String NONE
           
 
Constructor Summary
SecurityConstraint()
          Constructor.
SecurityConstraint(java.lang.String name, java.lang.String role)
          Conveniance Constructor.
 
Method Summary
 void addMethod(java.lang.String method)
           
 void addRole(java.lang.String role)
           
static boolean check(java.util.List constraints, Authenticator authenticator, UserRealm realm, java.lang.String pathInContext, HttpRequest request, HttpResponse response)
          Check security contraints
 java.lang.Object clone()
          This method may be called to create a new copy of the Object.
 boolean forMethod(java.lang.String method)
           
 boolean getAuthenticate()
           
 int getDataConstraint()
           
 java.util.List getMethods()
           
 java.util.List getRoles()
           
 boolean hasDataConstraint()
           
 boolean hasRole(java.lang.String role)
           
 boolean isAnyRole()
           
 boolean isForbidden()
           
 void setAuthenticate(boolean authenticate)
           
 void setDataConstraint(int c)
           
 void setName(java.lang.String name)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

__BASIC_AUTH

public static final java.lang.String __BASIC_AUTH
See Also:
Constant Field Values

__FORM_AUTH

public static final java.lang.String __FORM_AUTH
See Also:
Constant Field Values

__DIGEST_AUTH

public static final java.lang.String __DIGEST_AUTH
See Also:
Constant Field Values

__CERT_AUTH

public static final java.lang.String __CERT_AUTH
See Also:
Constant Field Values

__CERT_AUTH2

public static final java.lang.String __CERT_AUTH2
See Also:
Constant Field Values

DC_UNSET

public static final int DC_UNSET
See Also:
Constant Field Values

DC_NONE

public static final int DC_NONE
See Also:
Constant Field Values

DC_INTEGRAL

public static final int DC_INTEGRAL
See Also:
Constant Field Values

DC_CONFIDENTIAL

public static final int DC_CONFIDENTIAL
See Also:
Constant Field Values

NONE

public static final java.lang.String NONE
See Also:
Constant Field Values

ANY_ROLE

public static final java.lang.String ANY_ROLE
See Also:
Constant Field Values

__NOBODY

public static final SecurityConstraint.Nobody __NOBODY

_name

private java.lang.String _name

_methods

private java.lang.Object _methods

_umMethods

private java.util.List _umMethods

_roles

private java.lang.Object _roles

_umRoles

private java.util.List _umRoles

_dataConstraint

private int _dataConstraint

_anyRole

private boolean _anyRole

_authenticate

private boolean _authenticate
Constructor Detail

SecurityConstraint

public SecurityConstraint()
Constructor.


SecurityConstraint

public SecurityConstraint(java.lang.String name,
                          java.lang.String role)
Conveniance Constructor.

Method Detail

setName

public void setName(java.lang.String name)

addMethod

public void addMethod(java.lang.String method)

getMethods

public java.util.List getMethods()

forMethod

public boolean forMethod(java.lang.String method)

addRole

public void addRole(java.lang.String role)

isAnyRole

public boolean isAnyRole()

getRoles

public java.util.List getRoles()

hasRole

public boolean hasRole(java.lang.String role)

setAuthenticate

public void setAuthenticate(boolean authenticate)

getAuthenticate

public boolean getAuthenticate()

isForbidden

public boolean isForbidden()

setDataConstraint

public void setDataConstraint(int c)

getDataConstraint

public int getDataConstraint()

hasDataConstraint

public boolean hasDataConstraint()

clone

public java.lang.Object clone()
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }
 


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


check

public static boolean check(java.util.List constraints,
                            Authenticator authenticator,
                            UserRealm realm,
                            java.lang.String pathInContext,
                            HttpRequest request,
                            HttpResponse response)
                     throws HttpException,
                            java.io.IOException
Check security contraints