@@ -1139,13 +1139,60 @@ def test_signExpired(self):
11391139 self .failUnless (sresponse .fields .getArg (OPENID_NS , 'sig' ))
11401140
11411141 # make sure the expired association is gone
1142- self .failIf (self .store .getAssociation (self ._normal_key , assoc_handle ))
1142+ self .failIf (self .store .getAssociation (self ._normal_key , assoc_handle ),
1143+ "expired association is still retrievable." )
11431144
11441145 # make sure the new key is a dumb mode association
11451146 self .failUnless (self .store .getAssociation (self ._dumb_key , new_assoc_handle ))
11461147 self .failIf (self .store .getAssociation (self ._normal_key , new_assoc_handle ))
11471148 self .failUnless (self .messages )
11481149
1150+ def test_signExpiredSignAll (self ):
1151+ request = server .OpenIDRequest ()
1152+ request .namespace = OPENID2_NS
1153+ assoc_handle = '{assoc}{lookatme}'
1154+
1155+ expired_assoc = association .Association .fromExpiresIn (
1156+ - 10 , assoc_handle , 'sekrit' , 'HMAC-SHA1-SIGNALL' )
1157+
1158+ self .failUnless (expired_assoc .sign_all )
1159+ self .store .storeAssociation (self ._normal_key , expired_assoc )
1160+ self .failUnless (self .store .getAssociation (self ._normal_key , assoc_handle ))
1161+
1162+ request .assoc_handle = assoc_handle
1163+ response = server .OpenIDResponse (request )
1164+ response .fields = Message .fromOpenIDArgs ({
1165+ 'foo' : 'amsigned' ,
1166+ 'bar' : 'notsigned' ,
1167+ 'azu' : 'alsosigned' ,
1168+ })
1169+ sresponse = self .signatory .sign (response )
1170+
1171+ new_assoc_handle = sresponse .fields .getArg (OPENID_NS , 'assoc_handle' )
1172+ self .failUnless (new_assoc_handle )
1173+ self .failIfEqual (new_assoc_handle , assoc_handle )
1174+
1175+ self .failUnlessEqual (
1176+ sresponse .fields .getArg (OPENID_NS , 'invalidate_handle' ),
1177+ assoc_handle )
1178+
1179+ # make sure the new key is a dumb mode association
1180+ new_assoc = self .store .getAssociation (self ._dumb_key , new_assoc_handle )
1181+ self .failUnless (new_assoc )
1182+ self .failIf (self .store .getAssociation (self ._normal_key ,
1183+ new_assoc_handle ))
1184+ # and the new key is a sign-all key like the old one was.
1185+ self .failUnless (new_assoc .sign_all )
1186+
1187+ # make sure the expired association is gone
1188+ self .failIf (self .store .getAssociation (self ._normal_key , assoc_handle ))
1189+
1190+
1191+ self .failUnlessEqual (sresponse .fields .getArg (OPENID_NS , 'signed' , None ),
1192+ None )
1193+ self .failUnless (sresponse .fields .getArg (OPENID_NS , 'sig' ))
1194+
1195+
11491196 def test_signInvalidHandle (self ):
11501197 request = server .OpenIDRequest ()
11511198 request .namespace = OPENID2_NS
0 commit comments