Skip to content

Commit b5e42d8

Browse files
author
Kevin Turner
committed
[project @ store.interface.OpenIDStore: document interface changes introduced by one-way nonces.]
storeNonce is gone.
1 parent b47d75c commit b5e42d8

1 file changed

Lines changed: 17 additions & 29 deletions

File tree

‎openid/store/interface.py‎

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ class OpenIDStore(object):
1010
mechanisms that the OpenID library needs, for both servers and
1111
consumers.
1212
13+
@change: Version 2.0 removed the C{storeNonce} and C{getAuthKey} methods,
14+
and changed the behavior of the C{L{useNonce}} method to support
15+
one-way nonces.
16+
1317
@sort: storeAssociation, getAssociation, removeAssociation,
14-
storeNonce, useNonce, isDumb
18+
useNonce, isDumb
1519
"""
1620

1721
def storeAssociation(self, server_url, association):
@@ -120,36 +124,20 @@ def removeAssociation(self, server_url, handle):
120124
"""
121125
raise NotImplementedError
122126

123-
124-
def storeNonce(self, nonce):
125-
"""
126-
Stores a nonce. This is used by the consumer to prevent
127-
replay attacks.
128-
129-
130-
@param nonce: The nonce to store.
131-
132-
@type nonce: C{str}
133-
134-
135-
@return: C{None}
136-
137-
@rtype: C{NoneType}
138-
"""
139-
raise NotImplementedError
140-
141127
def useNonce(self, nonce):
142-
"""
143-
This method is called when the library is attempting to use a
144-
nonce. If the nonce is in the store, this method removes it
145-
and returns a value which evaluates as true. Otherwise it
146-
returns a value which evaluates as false.
128+
"""Called when using a nonce.
147129
148-
This method is allowed and encouraged to treat nonces older
149-
than some period (a very conservative window would be 6 hours,
150-
for example) as no longer existing, and return False and
151-
remove them.
130+
This method should return C{True} if the nonce has not been
131+
used before, and store it for a while to make sure nobody
132+
tries to use the same value again. If the nonce has already
133+
been used, return C{False}.
152134
135+
@change: In earlier versions, round-trip nonces were used and
136+
a nonce was only valid if it had been previously stored
137+
with C{storeNonce}. Version 2.0 uses one-way nonces,
138+
requiring a different implementation here that does not
139+
depend on a C{storeNonce} call. (C{storeNonce} is no
140+
longer part of the interface.
153141
154142
@param nonce: The nonce to use.
155143
@@ -158,7 +146,7 @@ def useNonce(self, nonce):
158146
159147
@return: Whether or not the nonce was valid.
160148
161-
@rtype: C{bool} or C{int}
149+
@rtype: C{bool}
162150
"""
163151
raise NotImplementedError
164152

0 commit comments

Comments
 (0)