plain.oauth 0.18.0__py3-none-any.whl → 0.19.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plain/oauth/providers.py +9 -7
- {plain_oauth-0.18.0.dist-info → plain_oauth-0.19.0.dist-info}/METADATA +1 -1
- {plain_oauth-0.18.0.dist-info → plain_oauth-0.19.0.dist-info}/RECORD +5 -5
- {plain_oauth-0.18.0.dist-info → plain_oauth-0.19.0.dist-info}/WHEEL +0 -0
- {plain_oauth-0.18.0.dist-info → plain_oauth-0.19.0.dist-info}/licenses/LICENSE +0 -0
plain/oauth/providers.py
CHANGED
@@ -102,10 +102,10 @@ class OAuthProvider:
|
|
102
102
|
return get_random_string(length=32)
|
103
103
|
|
104
104
|
def check_request_state(self, *, request: HttpRequest) -> None:
|
105
|
-
if error := request.
|
105
|
+
if error := request.query_params.get("error"):
|
106
106
|
raise OAuthError(error)
|
107
107
|
|
108
|
-
state = request.
|
108
|
+
state = request.query_params["state"]
|
109
109
|
expected_state = request.session.pop(SESSION_STATE_KEY)
|
110
110
|
request.session.save() # Make sure the pop is saved (won't save on an exception)
|
111
111
|
if not secrets.compare_digest(state, expected_state):
|
@@ -124,8 +124,8 @@ class OAuthProvider:
|
|
124
124
|
# Store next url in session so we can get it on the callback request
|
125
125
|
if redirect_to:
|
126
126
|
request.session[SESSION_NEXT_KEY] = redirect_to
|
127
|
-
elif "next" in request.
|
128
|
-
request.session[SESSION_NEXT_KEY] = request.
|
127
|
+
elif "next" in request.data:
|
128
|
+
request.session[SESSION_NEXT_KEY] = request.data["next"]
|
129
129
|
|
130
130
|
# Sort authorization params for consistency
|
131
131
|
sorted_authorization_params = sorted(authorization_params.items())
|
@@ -138,7 +138,7 @@ class OAuthProvider:
|
|
138
138
|
return self.handle_login_request(request=request, redirect_to=redirect_to)
|
139
139
|
|
140
140
|
def handle_disconnect_request(self, *, request: HttpRequest) -> Response:
|
141
|
-
provider_user_id = request.
|
141
|
+
provider_user_id = request.data["provider_user_id"]
|
142
142
|
connection = OAuthConnection.objects.get(
|
143
143
|
provider_key=self.provider_key, provider_user_id=provider_user_id
|
144
144
|
)
|
@@ -149,7 +149,9 @@ class OAuthProvider:
|
|
149
149
|
def handle_callback_request(self, *, request: HttpRequest) -> Response:
|
150
150
|
self.check_request_state(request=request)
|
151
151
|
|
152
|
-
oauth_token = self.get_oauth_token(
|
152
|
+
oauth_token = self.get_oauth_token(
|
153
|
+
code=request.query_params["code"], request=request
|
154
|
+
)
|
153
155
|
oauth_user = self.get_oauth_user(oauth_token=oauth_token)
|
154
156
|
|
155
157
|
if request.user:
|
@@ -181,7 +183,7 @@ class OAuthProvider:
|
|
181
183
|
return request.session.pop(SESSION_NEXT_KEY, "/")
|
182
184
|
|
183
185
|
def get_disconnect_redirect_url(self, *, request: HttpRequest) -> str:
|
184
|
-
return request.
|
186
|
+
return request.data.get("next", "/")
|
185
187
|
|
186
188
|
|
187
189
|
def get_oauth_provider_instance(*, provider_key: str) -> OAuthProvider:
|
@@ -5,7 +5,7 @@ plain/oauth/config.py,sha256=0Q4IILBKQbIaxqeL9WRTH5Cka-BO3c3SOj1AdQIAJgc,167
|
|
5
5
|
plain/oauth/default_settings.py,sha256=dlN1J9vSOjjxPNLp-0qe-cLTqwM4E69ZAx_8lpxMhaM,28
|
6
6
|
plain/oauth/exceptions.py,sha256=TMGtIGkK3_J4rsEy1oPCmia7BnRSK8N8RMZm4_pNelA,189
|
7
7
|
plain/oauth/models.py,sha256=ceSw9AKZMXffE4ZKZLxIbOlSyndTCHL22GCuSF3Hpmk,6880
|
8
|
-
plain/oauth/providers.py,sha256=
|
8
|
+
plain/oauth/providers.py,sha256=M8r_XkKgyCz8YkLyFyNOt35EHThDvwggcDlUoC7ZYwo,7187
|
9
9
|
plain/oauth/urls.py,sha256=FYzpQwhvZdcat8n3f7RyA-1Q21finKb8JEyakSOjXXg,696
|
10
10
|
plain/oauth/views.py,sha256=dVlFYGsEusD2lr24eVRLVfHfEEreg_1nByepiIOoWLk,3047
|
11
11
|
plain/oauth/migrations/0001_initial.py,sha256=B9Finbn7ijEIUbkDy_B7UsKQLfMWaXd0Kx3oZrUENWc,1753
|
@@ -17,7 +17,7 @@ plain/oauth/migrations/0006_remove_oauthconnection_unique_oauth_provider_user_id
|
|
17
17
|
plain/oauth/migrations/0007_alter_oauthconnection_provider_key_and_more.py,sha256=B_LW6xG1o_uA13tqUs0KniXl1JBNbQu4wMh2pW8rq5I,675
|
18
18
|
plain/oauth/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
plain/oauth/templates/oauth/error.html,sha256=xkkWw57sZ3fz4dDfH30SVtq3okJNnJmrSRPfGxrxjh8,108
|
20
|
-
plain_oauth-0.
|
21
|
-
plain_oauth-0.
|
22
|
-
plain_oauth-0.
|
23
|
-
plain_oauth-0.
|
20
|
+
plain_oauth-0.19.0.dist-info/METADATA,sha256=nX2C7XH2T6yiXmdkky5STCgWjEkFREIvYmUU-KqeQGU,10304
|
21
|
+
plain_oauth-0.19.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
22
|
+
plain_oauth-0.19.0.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
|
23
|
+
plain_oauth-0.19.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|