Models
Memory objects used throughout the project.
AuthorizationCode
dataclass
Source code in aioauth/models.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
auth_time
instance-attribute
JSON Web Token Claim indicating the time when the authentication occurred.
client_id
instance-attribute
Public identifier for the client. It must also be unique across all clients that the authorization server handles.
code
instance-attribute
Authorization code that the client previously received from the authorization server.
code_challenge = None
class-attribute
instance-attribute
Only used when RFC 7636, Proof Key for Code Exchange, is used. PKCE works by having the app generate a random value at the beginning of the flow called a Code Verifier. The app hashes the Code Verifier and the result is called the Code Challenge. The app then kicks off the flow in the normal way, except that it includes the Code Challenge in the query string for the request to the Authorization Server.
code_challenge_method = None
class-attribute
instance-attribute
Only used when RFC 7636, Proof Key for Code Exchange, is used. Method used to transform the code verifier into the code challenge.
expires_in
instance-attribute
Time delta in which authorization_code will expire.
is_expired
property
Checks if the authorization_code has expired.
nonce = None
class-attribute
instance-attribute
Only used when RFC 7636, Proof Key for Code Exchange, is used. Random piece of data.
redirect_uri
instance-attribute
After a user successfully authorizes an application, the authorization server will redirect the user back to the application with either an authorization code or access token in the URL. Because the redirect URL will contain sensitive information, it is critical that the service doesn’t redirect the user to arbitrary locations.
response_type
instance-attribute
A string containing the type of the response expected.
scope
instance-attribute
Scope is a mechanism that limit an application's access to a user's account. An application can request one or more scopes, this information is then presented to the user in the consent screen, and the access token issued to the application will be limited to the scopes granted.
Client
dataclass
OAuth2.0 client model object.
Source code in aioauth/models.py
client_id
instance-attribute
Public identifier for the client. It must also be unique across all clients that the authorization server handles.
client_secret
instance-attribute
Client secret is a secret known only to the client and the authorization server. Used for secure communication between the client and authorization server.
grant_types
instance-attribute
The method(s) in which an application gets an access token from the provider. Each grant type is optimized for a particular use case, whether that’s a web app, a native app, a device without the ability to launch a web browser, or server-to-server applications.
redirect_uris
instance-attribute
After a user successfully authorizes an application, the authorization server will redirect the user back to the application with either an authorization code or access token in the URL. Because the redirect URL will contain sensitive information, it is critical that the service doesn’t redirect the user to arbitrary locations.
response_types
instance-attribute
A list containing the types of the response expected.
scope = ''
class-attribute
instance-attribute
Scope is a mechanism that limit an application's access to a user's account. An application can request one or more scopes, this information is then presented to the user in the consent screen, and the access token issued to the application will be limited to the scopes granted.
check_grant_type(grant_type)
Verifies passed grant_type
is part of the client's
grant_types
list.
check_redirect_uri(redirect_uri)
Verifies passed redirect_uri
is part of the Clients's
redirect_uris
list.
check_response_type(response_type)
Verifies passed response_type
is part of the client's
response_types
list.
Source code in aioauth/models.py
get_allowed_scope(scope)
Returns the allowed scope
given the passed scope
.
Note
Note that the passed scope
may contain multiple scopes
seperated by a space character.
Source code in aioauth/models.py
Token
dataclass
Source code in aioauth/models.py
access_token
instance-attribute
Token that clients use to make API requests on behalf of the resource owner.
client_id
instance-attribute
Public identifier for the client. It must also be unique across all clients that the authorization server handles.
expires_in
instance-attribute
Time delta in which token will expire.
is_expired
property
Checks if the token has expired.
issued_at
instance-attribute
Time date in which token was issued at.
refresh_token
instance-attribute
Token used by clients to exchange a refresh token for an access token when the access token has expired.
refresh_token_expired
property
Checks if refresh token has expired.
refresh_token_expires_in
instance-attribute
Time delta in which refresh token will expire.
revoked = False
class-attribute
instance-attribute
Flag that indicates whether or not the token has been revoked.
scope
instance-attribute
Scope is a mechanism that limit an application's access to a user's account. An application can request one or more scopes, this information is then presented to the user in the consent screen, and the access token issued to the application will be limited to the scopes granted.
token_type = 'Bearer'
class-attribute
instance-attribute
Type of token expected.