openedx.core.djangoapps.oauth_dispatch.dot_overrides package#

Submodules#

openedx.core.djangoapps.oauth_dispatch.dot_overrides.validators module#

Classes that override default django-oauth-toolkit behavior

class openedx.core.djangoapps.oauth_dispatch.dot_overrides.validators.EdxOAuth2Validator#

Bases: OAuth2Validator

Validator class that implements edX-specific custom behavior:

  • It allows users to log in with their email or username.

  • It does not require users to be active before logging in.

get_default_scopes(client_id, request, *args, **kwargs)#

Returns the default scopes.

If the request payload does not have scopes attribute for a grant_type of client credentials, add user_id as a default scope if it is an allowed scope.

save_bearer_token(token, request, *args, **kwargs)#

Ensure that access tokens issued via client credentials grant are associated with the owner of the Application.

Also, update the expires_in value in the token response for RestrictedApplications.

validate_scopes(client_id, scopes, client, request, *args, **kwargs)#

Ensure required scopes are permitted (as specified in the settings file)

validate_user(username, password, client, request, *args, **kwargs)#

Authenticate users, but allow inactive users (with u.is_active == False) to authenticate.

openedx.core.djangoapps.oauth_dispatch.dot_overrides.validators.on_access_token_presave(sender, instance, *args, **kwargs)#

Mark AccessTokens as expired for ‘restricted applications’ if required.

openedx.core.djangoapps.oauth_dispatch.dot_overrides.views module#

Classes that override default django-oauth-toolkit behavior

class openedx.core.djangoapps.oauth_dispatch.dot_overrides.views.EdxOAuth2AuthorizationView(**kwargs)#

Bases: AuthorizationView

Override the AuthorizationView’s GET method so the user isn’t prompted to approve the application if they have already in the past, even if their access token is expired.

This is override of the base implementation accommodates our Restricted Applications support and custom filters.

get(request, *args, **kwargs)#

Handle GET requests: instantiate a blank version of the form.

Module contents#