juergen 01/02/26 04:45:15
Modified: src/share/org/apache/slide/security SecurityImpl.java
Log:
nothing changed
Revision Changes Path
1.19 +78 -78
jakarta-slide/src/share/org/apache/slide/security/SecurityImpl.java
Index: SecurityImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/share/org/apache/slide/security/SecurityImpl.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- SecurityImpl.java 2001/02/15 17:34:15 1.18
+++ SecurityImpl.java 2001/02/26 12:45:14 1.19
@@ -1,13 +1,13 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/security/SecurityImpl.java,v 1.18
2001/02/15 17:34:15 remm Exp $
- * $Revision: 1.18 $
- * $Date: 2001/02/15 17:34:15 $
+ * $Header:
/home/cvs/jakarta-slide/src/share/org/apache/slide/security/SecurityImpl.java,v 1.19
2001/02/26 12:45:14 juergen Exp $
+ * $Revision: 1.19 $
+ * $Date: 2001/02/26 12:45:14 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -23,15 +23,15 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
+ * from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
@@ -59,7 +59,7 @@
*
* [Additional notices, if required by prior licensing conditions]
*
- */
+ */
package org.apache.slide.security;
@@ -73,9 +73,9 @@
/**
* Security helper.
- *
+ *
* @author <a href="mailto:[EMAIL PROTECTED]">Remy Maucherat</a>
- * @version $Revision: 1.18 $
+ * @version $Revision: 1.19 $
*/
public final class SecurityImpl implements Security {
@@ -85,7 +85,7 @@
/**
* Constructor.
- *
+ *
* @param namespace Namespace
* @param namespaceConfig Namespace configuration
*/
@@ -123,20 +123,20 @@
/**
* Grants a new permission.
- *
+ *
* @param token Credentials token
* @param object Object on which permission is granted
* @param activity Activity which the actor can perform
- * @param collection Collection on which the actor can perform
+ * @param collection Collection on which the actor can perform
* the specified action
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
public void grantPermission(SlideToken token, ObjectNode object,
SubjectNode subject, ActionNode action)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
grantPermission(token, object, subject, action, true);
}
@@ -144,21 +144,21 @@
/**
* Grants a new permission.
- *
+ *
* @param token Credentials token
* @param object Object on which permission is granted
* @param subject Subject who can perform the action
* @param action Action which can be performed
* @param inheritable Create an inheritable permission
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
public void grantPermission(SlideToken token, ObjectNode object,
SubjectNode subject, ActionNode action,
boolean inheritable)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
NodePermission permission = new NodePermission(object, subject, action,
inheritable);
@@ -168,17 +168,17 @@
/**
* Grants a new permission.
- *
+ *
* @param token Credentials token
* @param permission New permission
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
- public void grantPermission(SlideToken token,
+ public void grantPermission(SlideToken token,
NodePermission permission)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
Uri objectUri = namespace.getUri(permission.getObjectUri());
ObjectNode object = objectUri.getStore()
@@ -194,7 +194,7 @@
}
if (!alreadyPresent) {
- checkCredentials(token, object,
+ checkCredentials(token, object,
namespaceConfig.getGrantPermissionAction());
objectUri.getStore().grantPermission(objectUri, permission);
}
@@ -203,20 +203,20 @@
/**
* Deny a new permission.
- *
+ *
* @param token Credentials token
* @param object Object on which permission is granted
* @param activity Activity which the actor can perform
- * @param collection Collection on which the actor can perform
+ * @param collection Collection on which the actor can perform
* the specified action
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
public void denyPermission(SlideToken token, ObjectNode object,
SubjectNode subject, ActionNode action)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
denyPermission(token, object, subject, action, true);
}
@@ -224,21 +224,21 @@
/**
* Deny a new permission.
- *
+ *
* @param token Credentials token
* @param object Object on which permission is granted
* @param subject Subject who can perform the action
* @param action Action which can be performed
* @param inheritable Create an inheritable permission
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
public void denyPermission(SlideToken token, ObjectNode object,
SubjectNode subject, ActionNode action,
boolean inheritable)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
NodePermission permission = new NodePermission(object, subject, action,
inheritable, true);
@@ -248,17 +248,17 @@
/**
* Deny a new permission.
- *
+ *
* @param token Credentials token
* @param permission New permission
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
- public void denyPermission(SlideToken token,
+ public void denyPermission(SlideToken token,
NodePermission permission)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
// Make sure the permission we're about to set is indeed a negative
// permission
@@ -266,28 +266,28 @@
permission.setNegative(true);
grantPermission(token, permission);
}
-
+
/**
* Revokes a permission.
- *
+ *
* @param token Credentials token
* @param object Object on which permission is revoked
* @param subject Subject who can perform the action
* @param action Action which can be performed
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
public void revokePermission(SlideToken token, ObjectNode object,
SubjectNode subject, ActionNode action)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
//Domain.info("Revoke permission on " + object.getUri());
checkCredentials(token, object, namespaceConfig
.getRevokePermissionAction());
- NodePermission permission = new NodePermission(object, subject,
+ NodePermission permission = new NodePermission(object, subject,
action);
Uri objectUri = namespace.getUri(object.getUri());
objectUri.getStore()
@@ -296,17 +296,17 @@
/**
- * Check if the credentials given grants permission to perform
+ * Check if the credentials given grants permission to perform
* the specified action on the specified subject.
- *
+ *
* @param token Credentials token
* @param object Object on which the action is performed
* @param action Action performed
* @exception ServiceAccessException DataSource access error
- * @exception AccessDeniedException The credentials does not grant
+ * @exception AccessDeniedException The credentials does not grant
* the permission to perform the specified action
*/
- public void checkCredentials(SlideToken token, ObjectNode object,
+ public void checkCredentials(SlideToken token, ObjectNode object,
ActionNode action)
throws ServiceAccessException, AccessDeniedException {
try {
@@ -319,7 +319,7 @@
}
} catch (ObjectNotFoundException e) {
throw new AccessDeniedException
- (object.getUri(),
+ (object.getUri(),
token.getCredentialsToken().getPublicCredentials(),
action.getUri());
}
@@ -327,20 +327,20 @@
/**
- * Check whether or not an actor can perform the specified activity
+ * Check whether or not an actor can perform the specified activity
* on a collection.
- *
+ *
* @param object Object on which access is tested
* @param subject Subject who seeks to perform the action
* @param action Action which is to be performed
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
public void checkPermission(ObjectNode object, SubjectNode subject,
ActionNode action)
- throws ServiceAccessException, AccessDeniedException,
+ throws ServiceAccessException, AccessDeniedException,
ObjectNotFoundException {
if (!hasPermission(object, subject, action)) {
@@ -352,18 +352,18 @@
/**
- * Check whether or not an actor can perform the specified activity
+ * Check whether or not an actor can perform the specified activity
* on a collection.
- *
+ *
* @param object Object on which access is tested
* @param subject Subject who seeks to perform the action
* @param action Action which is to be performed
* @return true if the action can be performed
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
*/
- public boolean hasPermission(ObjectNode object, SubjectNode subject,
+ public boolean hasPermission(ObjectNode object, SubjectNode subject,
ActionNode action)
throws ServiceAccessException, ObjectNotFoundException {
@@ -387,7 +387,7 @@
boolean oldGranted = granted;
boolean oldDenied = denied;
- NodePermission permission =
+ NodePermission permission =
(NodePermission) permissions.nextElement();
String permissionSubject = permission.getSubjectUri();
@@ -395,7 +395,7 @@
boolean check;
if (permission.isInheritable()) {
- check =
+ check =
object.getUri().startsWith(subjectUri.toString());
} else {
check = object.getUri().equals(subjectUri.toString());
@@ -411,7 +411,7 @@
&& (actionUri.toString()
.startsWith(permission.getActionUri()));
- } else if (permission.isInheritable()
+ } else if (permission.isInheritable()
|| permission.getObjectUri().equals(object.getUri())) {
if (permissionSubject.startsWith("/")) {
@@ -419,12 +419,12 @@
// Node permission
granted = (!permission.isNegative())
&& (subjectUri.toString()
- .startsWith(permission.getSubjectUri()))
+ .startsWith(permission.getSubjectUri()))
&& (actionUri.toString()
.startsWith(permission.getActionUri()));
denied = (permission.isNegative())
&& (subjectUri.toString()
- .startsWith(permission.getSubjectUri()))
+ .startsWith(permission.getSubjectUri()))
&& (actionUri.toString()
.startsWith(permission.getActionUri()));
@@ -432,11 +432,11 @@
// Role permission
granted = (!permission.isNegative())
- && (hasRole(subject, permissionSubject))
+ && (hasRole(subject, permissionSubject))
&& (actionUri.toString()
.startsWith(permission.getActionUri()));
denied = (permission.isNegative())
- && (hasRole(subject, permissionSubject))
+ && (hasRole(subject, permissionSubject))
&& (actionUri.toString()
.startsWith(permission.getActionUri()));
@@ -476,17 +476,17 @@
/**
* Enumerates permissions on an object.
- *
+ *
* @param token Credentials token
* @param object Object on which permission is granted
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
- public Enumeration enumeratePermissions(SlideToken token,
+ public Enumeration enumeratePermissions(SlideToken token,
ObjectNode object)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
return enumeratePermissions(token, object.getUri());
}
@@ -494,17 +494,17 @@
/**
* Enumerates permissions on an object.
- *
+ *
* @param token Credentials token
* @param object Object on which permission is granted
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
* @exception AccessDeniedException Insufficent credentials
*/
- public Enumeration enumeratePermissions(SlideToken token,
+ public Enumeration enumeratePermissions(SlideToken token,
String object)
- throws ServiceAccessException, ObjectNotFoundException,
+ throws ServiceAccessException, ObjectNotFoundException,
AccessDeniedException {
Uri objectUri = namespace.getUri(object);
return objectUri.getStore().enumeratePermissions(objectUri);
@@ -513,11 +513,11 @@
/**
* Check whether or not the current user has the specified role.
- *
+ *
* @param token Credentials token
* @param role Role
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
*/
public boolean hasRole(SlideToken token, String role)
@@ -532,11 +532,11 @@
/**
* Check whether or not the current user has the specified role.
- *
+ *
* @param object Object node
* @param role Role
* @exception ServiceAccessException DataSource access error
- * @exception ObjectNotFoundException Specified object was not found
+ * @exception ObjectNotFoundException Specified object was not found
* in the DataSource
*/
public boolean hasRole(ObjectNode object, String role)
@@ -545,7 +545,7 @@
if (role.equals(namespaceConfig.NOBODY))
return true;
String associatedRole = namespaceConfig.getRoleMapping(role);
- if ((associatedRole != null)
+ if ((associatedRole != null)
&& (associatedRole.equals(namespaceConfig.NOBODY)))
return true;
@@ -582,7 +582,7 @@
/**
* Return the list of roles the specified node has.
- *
+ *
* @param object Object node
*/
public Enumeration getRoles(ObjectNode object) {
@@ -597,7 +597,7 @@
Class[] interfaces = currentObjectClass.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
String className = interfaces[i].getName();
- String associatedName =
+ String associatedName =
namespaceConfig.getRoleMapping(className);
if (associatedName != null)
result.addElement(associatedName);
@@ -620,7 +620,7 @@
/**
* Return the list of roles the specified token has.
- *
+ *
* @param token Credentials token
*/
public Enumeration getRoles(SlideToken token)
@@ -631,13 +631,13 @@
/**
* Get the principal associated with the credentials token.
- *
+ *
* @param token Creadentials token
*/
public ObjectNode getPrincipal(SlideToken token)
throws ServiceAccessException, ObjectNotFoundException {
- String principalPath =
+ String principalPath =
token.getCredentialsToken().getPublicCredentials();
if ((principalPath == null) || (principalPath.equals(""))) {
principalPath = namespaceConfig.getGuestPath();