Mikhail Korobov avatar Mikhail Korobov committed e7b1b95

p3p policy. Fix #4.

Comments (0)

Files changed (2)

 
         method=getProfiles&uids={viewer_id}&format=json&v=3.0&fields=uid,first_name,last_name,nickname,domain,sex,bdate,city,country,timezone,photo,photo_medium,photo_big,photo_rec,has_mobile,rate,contacts,education
 
-9. That's all. All your app's visitors are now registered and authenticated
+9. For IE: adjust P3P policy header value according to your site privacy policy
+   by providing VK_P3P_POLICY option in your settings.py::
+
+        VK_P3P_POLICY = 'IDC DSP COR IVAi IVDi OUR TST'
+
+   Default value is 'IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT'.
+   See http://www.p3pwriter.com/LRN_111.asp for the full set of tags.
+
+10. That's all. All your app's visitors are now registered and authenticated
    django users. Additional profile data is available as user.vk_profile.
 

vk_iframe/middleware.py

 from django.shortcuts import render_to_response
 from vk_iframe.forms import VkontakteIframeForm
 
+DEFAULT_P3P_POLICY = 'IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT'
+P3P_POLICY = getattr(settings, 'VK_P3P_POLICY', DEFAULT_P3P_POLICY)
+
 class AuthenticationMiddleware(object):
 
     def process_request(self, request):
         else:
             request.META['VKONTAKTE_LOGIN_ERRORS'] = vk_form.errors
 
+    def process_response(self, request, response):
+        response["P3P"] = 'CP="%s"' % P3P_POLICY
+        return response
+
 
 PUBLIC_URLS = [re.compile(url) for url in getattr(settings, 'PUBLIC_URLS', [])]
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.