Models¶
Module Reference¶
OAuth 2.0 Django Models
- class oauth2app.models.AccessRange(*args, **kwargs)[source]¶
Stores access range data, also known as scope.
Args:
- key: A string representing the access range scope. Used in access token requests.
Kwargs:
- description: A string representing the access range description. Default None
- exception DoesNotExist¶
- exception AccessRange.MultipleObjectsReturned¶
- AccessRange.accesstoken_set¶
- AccessRange.code_set¶
- class oauth2app.models.AccessToken(*args, **kwargs)[source]¶
Stores access token data.
Args:
- client: A oauth2app.models.Client object
- user: A django.contrib.auth.models.User object
Kwargs:
- token: A string representing the access key token. Default 10 character random string
- refresh_token: A string representing the access key token. Default 10 character random string
- mac_key: A string representing the MAC key. Default None
- expire: A positive integer timestamp representing the access token’s expiration time.
- scope: A list of oauth2app.models.AccessRange objects. Default None
- refreshable: A boolean that indicates whether this access token is refreshable. Default False
- exception DoesNotExist¶
- exception AccessToken.MultipleObjectsReturned¶
- AccessToken.client¶
- AccessToken.macnonce_set¶
- AccessToken.scope¶
- AccessToken.user¶
- class oauth2app.models.Client(*args, **kwargs)[source]¶
Stores client authentication data.
Args:
name: A string representing the client name.
- user: A django.contrib.auth.models.User object representing the client
owner.
Kwargs:
- description: A string representing the client description. Default None
- key: A string representing the client key. Default 30 character random string
- secret: A string representing the client secret. Default 30 character random string
- redirect_uri: A string representing the client redirect_uri. Default None
- exception DoesNotExist¶
- exception Client.MultipleObjectsReturned¶
- Client.accesstoken_set¶
- Client.code_set¶
- Client.user¶
- class oauth2app.models.Code(*args, **kwargs)[source]¶
Stores authorization code data.
Args:
- client: A oauth2app.models.Client object
- user: A django.contrib.auth.models.User object
Kwargs:
- key: A string representing the authorization code. Default 30 character random string
- expire: A positive integer timestamp representing the access token’s expiration time.
- redirect_uri: A string representing the redirect_uri provided by the requesting client when the code was issued. Default None
- scope: A list of oauth2app.models.AccessRange objects. Default None
- exception DoesNotExist¶
- exception Code.MultipleObjectsReturned¶
- Code.client¶
- Code.scope¶
- Code.user¶
- class oauth2app.models.KeyGenerator(length)[source]¶
Callable Key Generator that returns a random keystring.
Args:
- length: A integer indicating how long the key should be.
Returns str