org.apache.lenya.ac.impl
Class URLPolicy

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

public class URLPolicy
extends java.lang.Object
implements org.apache.lenya.ac.Policy

A policy at a certain URL. The final policy is computed by merging the subtree policies of all ancestor-or-self directories with the URL policy of the actual URL.


Field Summary
 
Fields inherited from interface org.apache.lenya.ac.Policy
RESULT_DENIED, RESULT_GRANTED, RESULT_NOT_MATCHED
 
Constructor Summary
URLPolicy(org.apache.lenya.ac.AccreditableManager controller, java.lang.String _url, org.apache.lenya.ac.InheritingPolicyManager manager)
          Returns the resulting policy for a certain URL.
 
Method Summary
 int check(org.apache.lenya.ac.Identity identity, org.apache.lenya.ac.Role role)
           
 org.apache.lenya.ac.AccreditableManager getAccreditableManager()
          Returns the access controller.
static org.apache.lenya.ac.Role getAdministratorRole(org.apache.lenya.ac.AccreditableManager manager)
          Returns the administrator role.
static org.apache.lenya.ac.Role getAuthorRole(org.apache.lenya.ac.AccreditableManager manager)
          Returns the author role.
 org.apache.lenya.ac.Credential[] getCredentials()
           
 org.apache.lenya.ac.Credential[] getCredentials(org.apache.lenya.ac.Identity identity)
           
 org.apache.lenya.ac.InheritingPolicyManager getPolicyManager()
          Returns the policy builder.
 java.lang.String getUrl()
          Returns the URL of this policy.
static org.apache.lenya.ac.Role getVisitorRole(org.apache.lenya.ac.AccreditableManager manager)
          Returns the visitor role.
 boolean isEmpty()
           
 boolean isSSLProtected()
          The URL policy requires SSL protection if one of its member policies requires SSL protection.
protected  void obtainCredentials()
          Obtains the credentials from the policy manager.
protected  void obtainPolicies()
          Obtains the policies from the policy manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLPolicy

public URLPolicy(org.apache.lenya.ac.AccreditableManager controller,
                 java.lang.String _url,
                 org.apache.lenya.ac.InheritingPolicyManager manager)
Returns the resulting policy for a certain URL.

Parameters:
controller - The acccess controller.
_url - The URL.
manager - The policy manager.
Method Detail

obtainPolicies

protected void obtainPolicies()
                       throws org.apache.lenya.ac.AccessControlException
Obtains the policies from the policy manager. This method is expensive and therefore only called when needed.

Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

obtainCredentials

protected void obtainCredentials()
                          throws org.apache.lenya.ac.AccessControlException
Obtains the credentials from the policy manager. This method is expensive and therefore only called when needed.

Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

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
See Also:
Iterate the policy tree bottom-up.

getVisitorRole

public static org.apache.lenya.ac.Role getVisitorRole(org.apache.lenya.ac.AccreditableManager manager)
                                               throws org.apache.lenya.ac.AccessControlException
Returns the visitor role.

Parameters:
manager - The accreditable manager.
Returns:
A role.
Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

getAdministratorRole

public static org.apache.lenya.ac.Role getAdministratorRole(org.apache.lenya.ac.AccreditableManager manager)
                                                     throws org.apache.lenya.ac.AccessControlException
Returns the administrator role.

Parameters:
manager - The accreditable manager.
Returns:
A role.
Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

getAuthorRole

public static org.apache.lenya.ac.Role getAuthorRole(org.apache.lenya.ac.AccreditableManager manager)
                                              throws org.apache.lenya.ac.AccessControlException
Returns the author role.

Parameters:
manager - The accreditable manager.
Returns:
A role.
Throws:
org.apache.lenya.ac.AccessControlException - when something went wrong.

getUrl

public java.lang.String getUrl()
Returns the URL of this policy.

Returns:
The URL of this policy.

getPolicyManager

public org.apache.lenya.ac.InheritingPolicyManager getPolicyManager()
Returns the policy builder.

Returns:
A policy builder.

getAccreditableManager

public org.apache.lenya.ac.AccreditableManager getAccreditableManager()
Returns the access controller.

Returns:
An access controller.

isSSLProtected

public boolean isSSLProtected()
                       throws org.apache.lenya.ac.AccessControlException
The URL policy requires SSL protection if one of its member policies requires SSL protection.

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

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()

getCredentials

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

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


Copyright © $ Apache Software Foundation. All Rights Reserved.