python-webid is an early-alpha implementation of the WebID Identification and Discovery protocol.
Currently it consists only of a validator and a (very simple, really) client.
git clone git://github.com/bennomadic/python-webid.git
TBD (setup install, pypi...)
The validator, besides checking if a given client WebID certificate matches the conditions for allowing a WebID authentication, returns a set of result objects that can be used to generate a spec-compliance report.
For now, the validator parses the earl vocabulary for the WebID authentication and uses some of the extracted information to structure the series of checks that lead to the WebID validation.
Read more about the WebID Test Suite
To use the validator, you have to initialize it passing a base64 encoded certificate:
from webid.validator import WebIDValidator certstr = """ -----BEGIN CERTIFICATE----- MIIDGjCCAoOgAwIBAgIBaDANBgkqhkiG9w0BAQUFADBjMSYwJAYDVQQDEx1Ob3Qg YSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTERMA8GA1UEChMIRk9BRitTU0wxJjAk ... kgBsn3XOUUqKQXMe+uH2Q5fCYKRqYCBCC1qpLy3x -----END CERTIFICATE----- """ webidval = WebIDValidator(certstr=certstr) validated, data = validator.validate()
where validated is a bool indicating whether the authentication was successful or not.
Not very polished yet... but you can inspect the results for the passed checks (by execution order) in:
TBD: django app for webid auth