donaldp 2002/09/21 18:07:35
Modified: loader/src/test/org/apache/excalibur/policy/reader/test
ReaderTestCase.java config1.xml
loader/src/java/org/apache/excalibur/policy/reader
PolicyReader.java policy.dtd
loader/src/java/org/apache/excalibur/policy/metadata
PermissionMetaData.java
Log:
Support the capability of Permissions being signed.
Revision Changes Path
1.2 +12 -0
jakarta-avalon-excalibur/loader/src/test/org/apache/excalibur/policy/reader/test/ReaderTestCase.java
Index: ReaderTestCase.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/loader/src/test/org/apache/excalibur/policy/reader/test/ReaderTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReaderTestCase.java 20 Sep 2002 16:38:14 -0000 1.1
+++ ReaderTestCase.java 22 Sep 2002 01:07:35 -0000 1.2
@@ -77,6 +77,12 @@
assertEquals( "permission1.getTarget()",
"${/}tmp${/}*",
permission1.getTarget() );
+ assertEquals( "permission1.getKeyStore()",
+ "myKeystore",
+ permission1.getKeyStore() );
+ assertEquals( "permission1.getSignedBy()",
+ "Bob",
+ permission1.getSignedBy() );
assertEquals( "grant2.getCodebase()",
"sar:/SAR-INF/lib/*",
@@ -102,6 +108,12 @@
assertEquals( "permission2.getTarget()",
null,
permission2.getTarget() );
+ assertEquals( "permission2.getKeyStore()",
+ null,
+ permission2.getKeyStore() );
+ assertEquals( "permission2.getSignedBy()",
+ null,
+ permission2.getSignedBy() );
}
public void testConfig2()
1.2 +2 -0
jakarta-avalon-excalibur/loader/src/test/org/apache/excalibur/policy/reader/test/config1.xml
Index: config1.xml
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/loader/src/test/org/apache/excalibur/policy/reader/test/config1.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- config1.xml 20 Sep 2002 16:38:14 -0000 1.1
+++ config1.xml 22 Sep 2002 01:07:35 -0000 1.2
@@ -6,6 +6,8 @@
<grant code-base="myCodeBase">
<permission class="java.io.FilePermission"
target="${/}tmp${/}*"
+ signed-by="Bob"
+ key-store="myKeystore"
action="read,write"/>
</grant>
1.3 +5 -2
jakarta-avalon-excalibur/loader/src/java/org/apache/excalibur/policy/reader/PolicyReader.java
Index: PolicyReader.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/loader/src/java/org/apache/excalibur/policy/reader/PolicyReader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PolicyReader.java 20 Sep 2002 16:37:58 -0000 1.2
+++ PolicyReader.java 22 Sep 2002 01:07:35 -0000 1.3
@@ -125,7 +125,10 @@
final String classname = getAttribute( element, "class" );
final String target = getAttribute( element, "target" );
final String action = getAttribute( element, "action" );
- return new PermissionMetaData( classname, target, action );
+ final String signedBy = getAttribute( element, "signed-by" );
+ final String keyStore = getAttribute( element, "key-store" );
+ return new PermissionMetaData( classname, target, action,
+ signedBy, keyStore );
}
/**
1.3 +3 -1
jakarta-avalon-excalibur/loader/src/java/org/apache/excalibur/policy/reader/policy.dtd
Index: policy.dtd
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/loader/src/java/org/apache/excalibur/policy/reader/policy.dtd,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- policy.dtd 20 Sep 2002 09:58:37 -0000 1.2
+++ policy.dtd 22 Sep 2002 01:07:35 -0000 1.3
@@ -65,4 +65,6 @@
<!ATTLIST permission
class CDATA #REQUIRED
target CDATA #IMPLIED
- action CDATA #IMPLIED >
+ action CDATA #IMPLIED
+ signed-by CDATA #IMPLIED
+ key-store CDATA #IMPLIED >
1.2 +38 -2
jakarta-avalon-excalibur/loader/src/java/org/apache/excalibur/policy/metadata/PermissionMetaData.java
Index: PermissionMetaData.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/loader/src/java/org/apache/excalibur/policy/metadata/PermissionMetaData.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PermissionMetaData.java 15 Sep 2002 21:13:08 -0000 1.1
+++ PermissionMetaData.java 22 Sep 2002 01:07:35 -0000 1.2
@@ -35,6 +35,18 @@
private final String m_action;
/**
+ * The signer of the permission.
+ * (ie who signed the permission class).
+ */
+ private final String m_signedBy;
+
+ /**
+ * The keyStore to load signer from. May be null but if
+ * null then signedBy must also be null.
+ */
+ private final String m_keyStore;
+
+ /**
* Construct the permission meta data.
*
* @param classname the name of permission class
@@ -43,7 +55,9 @@
*/
public PermissionMetaData( final String classname,
final String target,
- final String action )
+ final String action,
+ final String signedBy,
+ final String keyStore )
{
if( null == classname )
{
@@ -53,6 +67,8 @@
m_classname = classname;
m_target = target;
m_action = action;
+ m_signedBy = signedBy;
+ m_keyStore = keyStore;
}
/**
@@ -83,5 +99,25 @@
public String getAction()
{
return m_action;
+ }
+
+ /**
+ * Return the principle name who signed the permission.
+ *
+ * @return the the principle name who signed the permission.
+ */
+ public String getSignedBy()
+ {
+ return m_signedBy;
+ }
+
+ /**
+ * Return the key store to load signer from.
+ *
+ * @return the key store to load signer from.
+ */
+ public String getKeyStore()
+ {
+ return m_keyStore;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>