Commits

Anonymous committed 12111ca

Do the Django settings handling right

Comments (0)

Files changed (2)

 * A Django ``User`` object. In this case, the OpenID claim was successfully authenticated, and the backend found a user in the database with this claim attached. The object as additional attributes:
 	
 	* ``openid_claim``: The claim that was finally authenticated. Depending on the OpenID provider, this might or might not be the original method input. In a later call to ``linkOpenID``, use only this one.
-	* ``openid_ax``: A dictionary of received AX values.
+	* ``openid_ax``: A dictionary of received AX values. The ``django.contrib.auth.AX`` dictionary contains a list of standardized key names. Check the openid2rp documentation for more information.
 	* ``openid_sreg``: A dictionary of received SREG values.	
 		
 * A Django ``AnonymousUser`` object. In this case, the claim could not be related to any user in the database, but the OpenID authentication was ok. The object has the same additional attributes as above. In this situation, you should normally proceed with some new user registration functionality. You can use the AX / SREG data to pre-fill some registration form. 

openid2rp/django/auth.py

 
 # we need to accept some difference between provider time and our time, for nonce and session checking
 # Martin says: Use the Kerberos default
-maxTimeShift=datetime.timedelta(minutes=5)
-if settings.OPENID2RP_MAXTIMESHIFT:
-	maxTimeShift=datetime.timedelta(minutes=int(settings.OPENID2RP_MAXTIMESHIFT))
-maxLoginDelay=datetime.timedelta(minutes=5)
-if settings.OPENID2RP_MAXLOGINDELAY:
-	maxLoginDelay=datetime.timedelta(minutes=int(settings.OPENID2RP_MAXLOGINDELAY))
+shiftVal = int(getattr(settings, 'OPENID2RP_MAXTIMESHIFT', '5'))
+maxTimeShift=datetime.timedelta(minutes=shiftVal)
+delayVal = int(getattr(settings, 'OPENID2RP_MAXLOGINDELAY', '5'))
+maxLoginDelay=datetime.timedelta(minutes=delayVal)
 
+# mirror the AX key name dict, so that the app does not need openid2rp at all
 AX = openid2rp.AX
 
 class IncorrectURIError(Exception):
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.