org.apache.lenya.ac.impl
Class DefaultPolicy

java.lang.Object
  extended by org.apache.lenya.ac.impl.DefaultPolicy
All Implemented Interfaces:
org.apache.lenya.ac.ModifiablePolicy, org.apache.lenya.ac.Policy

public class DefaultPolicy
extends java.lang.Object
implements org.apache.lenya.ac.ModifiablePolicy

A DefaultPolicy is the own policy of a certain URL (not merged).


Field Summary
 
Fields inherited from interface org.apache.lenya.ac.Policy
RESULT_DENIED, RESULT_GRANTED, RESULT_NOT_MATCHED
 
Constructor Summary
DefaultPolicy()
           
 
Method Summary
 void addCredential(org.apache.lenya.ac.Credential credential)
          Adds a credential to this policy.
 void addRole(org.apache.lenya.ac.Accreditable accreditable, org.apache.lenya.ac.Role role, java.lang.String method)
          Adds a role to this policy for a certain accreditable and a certain role.
 int check(org.apache.lenya.ac.Identity identity, org.apache.lenya.ac.Role role)
           
 org.apache.lenya.ac.Credential getCredential(org.apache.lenya.ac.Accreditable accreditable, org.apache.lenya.ac.Role role)
          Returns the credentials for a certain accreditable.
 org.apache.lenya.ac.Credential[] getCredentials()
          Returns the credentials of this policy in top-down order.
 org.apache.lenya.ac.Credential[] getCredentials(org.apache.lenya.ac.Identity identity)
           
 boolean isEmpty()
           
 boolean isSSLProtected()
           
protected  boolean matches(org.apache.lenya.ac.Identity identity, org.apache.lenya.ac.Accreditable accreditable)
           
 void moveRoleDown(org.apache.lenya.ac.Accreditable accreditable, org.apache.lenya.ac.Role role)
           
 void moveRoleUp(org.apache.lenya.ac.Accreditable accreditable, org.apache.lenya.ac.Role role)
           
protected  void removeCredential(org.apache.lenya.ac.Credential credential)
          Removes a credential.
 void removeRole(org.apache.lenya.ac.Accreditable accreditable, org.apache.lenya.ac.Role role)
          Removes a role from this policy for a certain accreditable and a certain role.
 void removeRoles(org.apache.lenya.ac.Accreditable accreditable)
          Removes all roles for a certain accreditable.
 void setSSL(boolean ssl)
          Sets if this policy requires SSL protection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPolicy

public DefaultPolicy()
Method Detail

addCredential

public void addCredential(org.apache.lenya.ac.Credential credential)
Adds a credential to this policy.

Parameters:
credential - A credential.

addRole

public void addRole(org.apache.lenya.ac.Accreditable accreditable,
                    org.apache.lenya.ac.Role role,
                    java.lang.String method)
Adds a role to this policy for a certain accreditable and a certain role.

Specified by:
addRole in interface org.apache.lenya.ac.ModifiablePolicy
Parameters:
accreditable - An accreditable.
role - A role.

removeRole

public void removeRole(org.apache.lenya.ac.Accreditable accreditable,
                       org.apache.lenya.ac.Role role)
                throws org.apache.lenya.ac.AccessControlException
Removes a role from this policy for a certain accreditable and a certain role.

Specified by:
removeRole in interface org.apache.lenya.ac.ModifiablePolicy
Parameters:
accreditable - An accreditable.
role - A role.
Throws:
org.apache.lenya.ac.AccessControlException - if the accreditable-role pair is not contained.

getCredentials

public org.apache.lenya.ac.Credential[] getCredentials()
Returns the credentials of this policy in top-down order.

Specified by:
getCredentials in interface org.apache.lenya.ac.Policy
Returns:
An array of credentials.

getCredential

public org.apache.lenya.ac.Credential getCredential(org.apache.lenya.ac.Accreditable accreditable,
                                                    org.apache.lenya.ac.Role role)
Returns the credentials for a certain accreditable.

Parameters:
accreditable - An accreditable.
role -
Returns:
A credential.

isSSLProtected

public boolean isSSLProtected()
                       throws org.apache.lenya.ac.AccessControlException
Specified by:
isSSLProtected in interface org.apache.lenya.ac.Policy
Throws:
org.apache.lenya.ac.AccessControlException
See Also:
Policy.isSSLProtected()

setSSL

public void setSSL(boolean ssl)
Sets if this policy requires SSL protection.

Specified by:
setSSL in interface org.apache.lenya.ac.ModifiablePolicy
Parameters:
ssl - A boolean value.

isEmpty

public boolean isEmpty()
                throws org.apache.lenya.ac.AccessControlException
Specified by:
isEmpty in interface org.apache.lenya.ac.Policy
Throws:
org.apache.lenya.ac.AccessControlException
See Also:
Policy.isEmpty()

removeCredential

protected void removeCredential(org.apache.lenya.ac.Credential credential)
                         throws org.apache.lenya.ac.AccessControlException
Removes a credential.

Parameters:
credential - The credential to remove.
Throws:
org.apache.lenya.ac.AccessControlException - If the credential does not exist.

removeRoles

public void removeRoles(org.apache.lenya.ac.Accreditable accreditable)
                 throws org.apache.lenya.ac.AccessControlException
Removes all roles for a certain accreditable.

Specified by:
removeRoles in interface org.apache.lenya.ac.ModifiablePolicy
Parameters:
accreditable - The accreditable to remove all roles for.
Throws:
org.apache.lenya.ac.AccessControlException - If no credential exists for this accreditable.

getCredentials

public org.apache.lenya.ac.Credential[] getCredentials(org.apache.lenya.ac.Identity identity)
                                                throws org.apache.lenya.ac.AccessControlException
Specified by:
getCredentials in interface org.apache.lenya.ac.Policy
Throws:
org.apache.lenya.ac.AccessControlException

moveRoleDown

public void moveRoleDown(org.apache.lenya.ac.Accreditable accreditable,
                         org.apache.lenya.ac.Role role)
                  throws org.apache.lenya.ac.AccessControlException
Specified by:
moveRoleDown in interface org.apache.lenya.ac.ModifiablePolicy
Throws:
org.apache.lenya.ac.AccessControlException

moveRoleUp

public void moveRoleUp(org.apache.lenya.ac.Accreditable accreditable,
                       org.apache.lenya.ac.Role role)
                throws org.apache.lenya.ac.AccessControlException
Specified by:
moveRoleUp in interface org.apache.lenya.ac.ModifiablePolicy
Throws:
org.apache.lenya.ac.AccessControlException

check

public int check(org.apache.lenya.ac.Identity identity,
                 org.apache.lenya.ac.Role role)
          throws org.apache.lenya.ac.AccessControlException
Specified by:
check in interface org.apache.lenya.ac.Policy
Throws:
org.apache.lenya.ac.AccessControlException

matches

protected boolean matches(org.apache.lenya.ac.Identity identity,
                          org.apache.lenya.ac.Accreditable accreditable)


Copyright $ Apache Software Foundation. All Rights Reserved.