You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ne...@apache.org on 2007/08/05 14:59:07 UTC
svn commit: r562864 -
/lenya/trunk/src/modules-core/ac/java/src/org/apache/lenya/ac/impl/PolicyAuthorizer.java
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;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org