Hi Alex,
Yes indeed, when i install the alfresco share 4.0.d application those files mentioned in the given link by you were already present in the bundle i.e the "SSOAuthentication filter" was already added in the share/…/web.xml file.
The only file i think missing was the "org.alfresco.web.site.servlet.SlingshotAlfrescoConnector", which extracts the userName from the header proxied by CAS.
I added this class whithin "alfresco-share-4.0.d.jar" along with some modification to SSOAuthenticationFilter to extract the userName and deployed in ../share/WEB-INF/lib folder.
Rest all the configuration was done according to the given link by you.
Now what i have done is that since the response from this line Response response = conn.call("/api/admin/restrictions?guest=true"); was a login page instaed of a json object, i commented out this line and manually added the json object which consists of userName {taken from header}, edition{hardcoded : Edition } and the document {null}.
With this i am able to login to share with CAS, but i am not sure as to at what level this modification will work