[Checkins] SVN: keas.kmi/trunk/ Front page now shows the number of stored keys instead of a
Marius Gedminas
marius at pov.lt
Thu Sep 4 16:50:58 EDT 2008
Log message for revision 90838:
Front page now shows the number of stored keys instead of a
ComponentLookupError message.
Changed:
U keas.kmi/trunk/CHANGES.txt
U keas.kmi/trunk/src/keas/kmi/README.txt
U keas.kmi/trunk/src/keas/kmi/configure.zcml
U keas.kmi/trunk/src/keas/kmi/rest.py
U keas.kmi/trunk/src/keas/kmi/rest.zcml
-=-
Modified: keas.kmi/trunk/CHANGES.txt
===================================================================
--- keas.kmi/trunk/CHANGES.txt 2008-09-04 20:45:46 UTC (rev 90837)
+++ keas.kmi/trunk/CHANGES.txt 2008-09-04 20:50:58 UTC (rev 90838)
@@ -7,6 +7,9 @@
- Sample server shows how to enable SSL
+- Front page now shows the number of stored keys instead of a
+ ComponentLookupError message.
+
- Command-line client for testing a remote Key Management Server
- Bugfix: LocalKeyManagementFacility was broken (AttributeError: 'RESTClient'
Modified: keas.kmi/trunk/src/keas/kmi/README.txt
===================================================================
--- keas.kmi/trunk/src/keas/kmi/README.txt 2008-09-04 20:45:46 UTC (rev 90837)
+++ keas.kmi/trunk/src/keas/kmi/README.txt 2008-09-04 20:50:58 UTC (rev 90838)
@@ -205,7 +205,7 @@
with the local facility. When a new encryption key pair is created, we simply
make a `POST` call to the following URL::
- http://server:port/master/new
+ http://server:port/new
The request should have no body and the response is simply the key encrypting
key.
@@ -235,7 +235,7 @@
We can now fetch the encryption key pair using a `POST` call to this URL::
- http://server:port/master/key
+ http://server:port/key
The request sends the key encrypting key in its body. The response is the
encryption key string:
@@ -251,7 +251,16 @@
>>> len(encKey)
32
+A `GET` request to the root shows us a server status page
+ >>> request = TestRequest()
+ >>> request.method = 'GET'
+
+ >>> newCall = rest.StatusView(keys, request)
+ >>> print newCall()
+ KMS server holding 3 keys
+
+
The Testing Key Management Facility
-----------------------------------
Modified: keas.kmi/trunk/src/keas/kmi/configure.zcml
===================================================================
--- keas.kmi/trunk/src/keas/kmi/configure.zcml 2008-09-04 20:45:46 UTC (rev 90837)
+++ keas.kmi/trunk/src/keas/kmi/configure.zcml 2008-09-04 20:50:58 UTC (rev 90838)
@@ -17,7 +17,7 @@
/>
<require
permission="keas.kmi.AccessKey"
- attributes="getEncryptionKey"
+ attributes="getEncryptionKey __len__"
/>
</class>
Modified: keas.kmi/trunk/src/keas/kmi/rest.py
===================================================================
--- keas.kmi/trunk/src/keas/kmi/rest.py 2008-09-04 20:45:46 UTC (rev 90837)
+++ keas.kmi/trunk/src/keas/kmi/rest.py 2008-09-04 20:50:58 UTC (rev 90838)
@@ -26,6 +26,12 @@
return 'Method not allowed.'
return getattr(self, method)()
+class StatusView(RestView):
+
+ def GET(self):
+ self.request.response.setHeader('content-type', 'text/plain')
+ return 'KMS server holding %d keys' % len(self.context)
+
class NewView(RestView):
def POST(self):
Modified: keas.kmi/trunk/src/keas/kmi/rest.zcml
===================================================================
--- keas.kmi/trunk/src/keas/kmi/rest.zcml 2008-09-04 20:45:46 UTC (rev 90837)
+++ keas.kmi/trunk/src/keas/kmi/rest.zcml 2008-09-04 20:50:58 UTC (rev 90838)
@@ -1,8 +1,20 @@
<configure xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser">
+ <browser:defaultView
+ for=".interfaces.IKeyManagementFacility"
+ name="index.html"
+ />
+
<browser:page
for=".interfaces.IKeyManagementFacility"
+ name="index.html"
+ class=".rest.StatusView"
+ permission="zope.Public"
+ />
+
+ <browser:page
+ for=".interfaces.IKeyManagementFacility"
name="new"
class=".rest.NewView"
permission="zope.Public"
More information about the Checkins
mailing list