One-To-One relationship for Access and Refresh Tokens

This changes the relationship in our access and refresh token table
from a many-to-many to a one-to-one. This is for two reasons:
Firstly, a many-to-many means it's possible to have a refresh token
issued that can refresh multiple access tokens, which actually
doesn't make a lot of sense, since our logic _also_ deletes all
access tokens associated with a used refresh token.

Secondly, many-to-many relationships do not support cascading updates
in SQLAlchemy, so our goal to manage all of our foreign relationships
in SQLA is not achievable if we maintain these kinds of relationships.

Change-Id: Iab3c65ac403961fccf7db15ef930f9d896626108
This commit is contained in:
Michael Krotscheck
2015-04-13 17:43:58 -07:00
parent 27bf9e5fd9
commit e42c6e38bf
10 changed files with 94 additions and 71 deletions

View File

@@ -431,8 +431,8 @@ class AccessToken(base.APIBase):
expires_in = int
"""The number of seconds after creation when this token expires."""
refresh_tokens = wtypes.ArrayType(RefreshToken)
"""Array of corresponding refresh tokens."""
refresh_token = RefreshToken
"""The associated refresh token."""
@classmethod
def sample(cls):