Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ Rustem Saiargaliev
Jadiel Teófilo
pySilver
Łukasz Skarżyński
Shaheed Haque
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
-->

## [1.5.0] 2021-03-18
## [unreleased]

### Added
* #915 Add optional OpenID Connect support.
* #712, #636, #808. Calls to `django.contrib.auth.authenticate()` now pass a `request`
to provide compatibility with backends that need one.

### Fixed
* #524 Restrict usage of timezone aware expire dates to Django projects with USE_TZ set to True.

## [1.5.0] 2021-03-18

### Added
* #915 Add optional OpenID Connect support.

### Changed
* #942 Help via defunct Google group replaced with using GitHub issues

Expand Down
11 changes: 10 additions & 1 deletion oauth2_provider/oauth2_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from django.db.models import Q
from django.http import HttpRequest
from django.utils import dateformat, timezone
from django.utils.timezone import make_aware
from django.utils.translation import gettext_lazy as _
Expand Down Expand Up @@ -664,7 +665,15 @@ def validate_user(self, username, password, client, request, *args, **kwargs):
"""
Check username and password correspond to a valid and active User
"""
u = authenticate(username=username, password=password)
# Passing the optional HttpRequest adds compatibility for backends
# which depend on its presence. Create one with attributes likely
# to be used.
http_request = HttpRequest()
http_request.path = request.uri
http_request.method = request.http_method
getattr(http_request, request.http_method).update(dict(request.decoded_body))
http_request.META = request.headers
u = authenticate(http_request, username=username, password=password)
if u is not None and u.is_active:
request.user = u
return True
Expand Down