diff --git a/CHANGELOG.md b/CHANGELOG.md index 23035d0b2..c3b10068b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed * #1108 OIDC: Fix `validate_bearer_token()` to properly set `request.scopes` to the list of granted scopes. +### Removed +* #1124 (**Breaking**, **Security**) Removes support for insecure `urn:ietf:wg:oauth:2.0:oob` and `urn:ietf:wg:oauth:2.0:oob:auto` which are replaced + by [RFC 8252](https://datatracker.ietf.org/doc/html/rfc8252) "OAuth 2.0 for Native Apps" BCP. Google has + [deprecated use of oob](https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob) with + a final end date of 2022-10-03. If you still rely on oob support in django-oauth-toolkit, do not upgrade to this release. + ## [1.7.0] 2022-01-23 ### Added diff --git a/oauth2_provider/templates/oauth2_provider/authorized-oob.html b/oauth2_provider/templates/oauth2_provider/authorized-oob.html deleted file mode 100644 index 78399da7c..000000000 --- a/oauth2_provider/templates/oauth2_provider/authorized-oob.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends "oauth2_provider/base.html" %} - -{% load i18n %} - -{% block title %} -Success code={{code}} -{% endblock %} - -{% block content %} -
{% trans "Please return to your application and enter this code:" %}
- -{{ code }}
{{ error.description }}
- {% endif %} -([^<>]*)", content)
- self.assertIsNotNone(matches, msg="OOB response contains code inside tag")
- self.assertEqual(len(matches.groups()), 1, msg="OOB response contains multiple tags")
- authorization_code = matches.groups()[0]
-
- token_request_data = {
- "grant_type": "authorization_code",
- "code": authorization_code,
- "redirect_uri": URI_OOB,
- "client_id": self.application.client_id,
- "client_secret": CLEARTEXT_SECRET,
- }
-
- response = self.client.post(reverse("oauth2_provider:token"), data=token_request_data)
- self.assertEqual(response.status_code, 200)
-
- content = json.loads(response.content.decode("utf-8"))
- self.assertEqual(content["token_type"], "Bearer")
- self.assertEqual(content["scope"], "read write")
- self.assertEqual(content["expires_in"], self.oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS)
-
- def test_oob_as_json(self):
- """
- Test out-of-band authentication, with a JSON response.
- """
- self.client.login(username="test_user", password="123456")
-
- authcode_data = {
- "client_id": self.application.client_id,
- "state": "random_state_string",
- "scope": "read write",
- "redirect_uri": URI_OOB_AUTO,
- "response_type": "code",
- "allow": True,
- }
-
- response = self.client.post(reverse("oauth2_provider:authorize"), data=authcode_data)
- self.assertEqual(response.status_code, 200)
- self.assertRegex(response["Content-Type"], "^application/json")
-
- parsed_response = json.loads(response.content.decode("utf-8"))
-
- self.assertIn("access_token", parsed_response)
- authorization_code = parsed_response["access_token"]
-
- token_request_data = {
- "grant_type": "authorization_code",
- "code": authorization_code,
- "redirect_uri": URI_OOB_AUTO,
- "client_id": self.application.client_id,
- "client_secret": CLEARTEXT_SECRET,
- }
-
- response = self.client.post(reverse("oauth2_provider:token"), data=token_request_data)
- self.assertEqual(response.status_code, 200)
-
- content = json.loads(response.content.decode("utf-8"))
- self.assertEqual(content["token_type"], "Bearer")
- self.assertEqual(content["scope"], "read write")
- self.assertEqual(content["expires_in"], self.oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS)
-
@pytest.mark.oauth2_settings(presets.OIDC_SETTINGS_RW)
class TestOIDCAuthorizationCodeTokenView(BaseAuthorizationCodeTokenView):