Author: nettings
Date: Sun Aug 5 05:59:06 2007
New Revision: 562864
URL: http://svn.apache.org/viewvc?view=rev&rev=562864
Log:
rearranged methods and properties. no functional change.
Modified:
lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyAuthorizer.java
Modified: lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyAuthorizer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyAuthorizer.java?view=diff&rev=562864&r1=562863&r2=562864
==============================================================================
--- lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyAuthorizer.java (original)
+++ lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyAuthorizer.java Sun Aug 5 05:59:06 2007
@@ -37,32 +37,50 @@
*/
public class PolicyAuthorizer extends AbstractLogEnabled implements Authorizer {
+ private PolicyManager policyManager;
+ private AccreditableManager accreditableManager;
+
/**
- * Returns the accreditable manager.
- * @return An accreditable manager.
+ * Creates a new policy authorizer.
*/
- public AccreditableManager getAccreditableManager() {
- return this.accreditableManager;
+ public PolicyAuthorizer() {
+ // do nothing
}
/**
- * Returns the policy manager.
- * @return A policy manager.
+ * @see org.apache.lenya.ac.Authorizer#authorize(org.apache.cocoon.environment.Request)
*/
- public PolicyManager getPolicyManager() {
- return this.policyManager;
+ public boolean authorize(Request request)
+ throws AccessControlException {
+ return authorize(request, ServletHelper.getWebappURI(request));
}
- /**
- * Creates a new policy authorizer.
- */
- public PolicyAuthorizer() {
- // do nothing
+ protected boolean authorize(Request request, String webappUrl) throws AccessControlException {
+ Session session = request.getSession(true);
+ Identity identity = (Identity) session.getAttribute(Identity.class.getName());
+
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Trying to authorize identity: " + identity);
+ }
+
+ boolean authorized;
+
+ if (identity.belongsTo(getAccreditableManager())) {
+ authorized = authorizePolicy(identity, request, webappUrl);
+ } else {
+ getLogger().debug(
+ "Identity ["
+ + identity
+ + "] not authorized - belongs to wrong accreditable manager.");
+ authorized = false;
+ }
+
+ getLogger().debug("Authorized: " + authorized);
+
+ return authorized;
}
-
- private PolicyManager policyManager;
-
- /**
+
+ /**
* Sets the policy manager.
* @param manager A policy manager.
*/
@@ -70,9 +88,15 @@
assert manager != null;
this.policyManager = manager;
}
-
- private AccreditableManager accreditableManager;
-
+
+ /**
+ * Returns the policy manager.
+ * @return A policy manager.
+ */
+ public PolicyManager getPolicyManager() {
+ return this.policyManager;
+ }
+
/**
* Sets the accreditable manager.
* @param manager An accreditable manager.
@@ -83,14 +107,14 @@
}
/**
- * @see org.apache.lenya.ac.Authorizer#authorize(org.apache.cocoon.environment.Request)
+ * Returns the accreditable manager.
+ * @return An accreditable manager.
*/
- public boolean authorize(Request request)
- throws AccessControlException {
- return authorize(request, ServletHelper.getWebappURI(request));
+ public AccreditableManager getAccreditableManager() {
+ return this.accreditableManager;
}
- /**
+ /**
* Authorizes an request for an identity depending on a policy.
* @param identity The identity to authorize.
* @param request The request to authorize.
@@ -121,31 +145,6 @@
}
getLogger().debug("Adding roles [" + rolesString + " ] to request [" + request + "]");
request.setAttribute(Role.class.getName(), Arrays.asList(roles));
- }
-
- protected boolean authorize(Request request, String webappUrl) throws AccessControlException {
- Session session = request.getSession(true);
- Identity identity = (Identity) session.getAttribute(Identity.class.getName());
-
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Trying to authorize identity: " + identity);
- }
-
- boolean authorized;
-
- if (identity.belongsTo(getAccreditableManager())) {
- authorized = authorizePolicy(identity, request, webappUrl);
- } else {
- getLogger().debug(
- "Identity ["
- + identity
- + "] not authorized - belongs to wrong accreditable manager.");
- authorized = false;
- }
-
- getLogger().debug("Authorized: " + authorized);
-
- return authorized;
}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.