|
15 | 15 | fromoauth2_provider.modelsimportget_access_token_model, get_id_token_model, get_refresh_token_model |
16 | 16 | fromoauth2_provider.oauth2_validatorsimportOAuth2Validator |
17 | 17 | fromoauth2_provider.settingsimportoauth2_settings |
18 | | -fromoauth2_provider.views.oidcimport ( |
19 | | -RPInitiatedLogoutView, |
20 | | -_load_id_token, |
21 | | -_validate_claims, |
22 | | -validate_logout_request, |
23 | | -) |
| 18 | +fromoauth2_provider.views.oidcimportRPInitiatedLogoutView, _load_id_token, _validate_claims |
24 | 19 |
|
25 | 20 | from . importpresets |
26 | 21 |
|
@@ -225,104 +220,6 @@ def mock_request_for(user): |
225 | 220 | returnrequest |
226 | 221 |
|
227 | 222 |
|
228 | | -@pytest.mark.django_db |
229 | | -@pytest.mark.parametrize("ALWAYS_PROMPT", [True, False]) |
230 | | -deftest_deprecated_validate_logout_request( |
231 | | -oidc_tokens, public_application, other_user, rp_settings, ALWAYS_PROMPT |
232 | | -): |
233 | | -rp_settings.OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT=ALWAYS_PROMPT |
234 | | -oidc_tokens=oidc_tokens |
235 | | -application=oidc_tokens.application |
236 | | -client_id=application.client_id |
237 | | -id_token=oidc_tokens.id_token |
238 | | -assertvalidate_logout_request( |
239 | | -request=mock_request_for(oidc_tokens.user), |
240 | | -id_token_hint=None, |
241 | | -client_id=None, |
242 | | -post_logout_redirect_uri=None, |
243 | | - ) == (True, (None, None), None) |
244 | | -assertvalidate_logout_request( |
245 | | -request=mock_request_for(oidc_tokens.user), |
246 | | -id_token_hint=None, |
247 | | -client_id=client_id, |
248 | | -post_logout_redirect_uri=None, |
249 | | - ) == (True, (None, application), None) |
250 | | -assertvalidate_logout_request( |
251 | | -request=mock_request_for(oidc_tokens.user), |
252 | | -id_token_hint=None, |
253 | | -client_id=client_id, |
254 | | -post_logout_redirect_uri="http://example.org", |
255 | | - ) == (True, ("http://example.org", application), None) |
256 | | -assertvalidate_logout_request( |
257 | | -request=mock_request_for(oidc_tokens.user), |
258 | | -id_token_hint=id_token, |
259 | | -client_id=None, |
260 | | -post_logout_redirect_uri="http://example.org", |
261 | | - ) == (ALWAYS_PROMPT, ("http://example.org", application), oidc_tokens.user) |
262 | | -assertvalidate_logout_request( |
263 | | -request=mock_request_for(other_user), |
264 | | -id_token_hint=id_token, |
265 | | -client_id=None, |
266 | | -post_logout_redirect_uri="http://example.org", |
267 | | - ) == (True, ("http://example.org", application), oidc_tokens.user) |
268 | | -assertvalidate_logout_request( |
269 | | -request=mock_request_for(oidc_tokens.user), |
270 | | -id_token_hint=id_token, |
271 | | -client_id=client_id, |
272 | | -post_logout_redirect_uri="http://example.org", |
273 | | - ) == (ALWAYS_PROMPT, ("http://example.org", application), oidc_tokens.user) |
274 | | -withpytest.raises(InvalidIDTokenError): |
275 | | -validate_logout_request( |
276 | | -request=mock_request_for(oidc_tokens.user), |
277 | | -id_token_hint="111", |
278 | | -client_id=public_application.client_id, |
279 | | -post_logout_redirect_uri="http://other.org", |
280 | | - ) |
281 | | -withpytest.raises(ClientIdMissmatch): |
282 | | -validate_logout_request( |
283 | | -request=mock_request_for(oidc_tokens.user), |
284 | | -id_token_hint=id_token, |
285 | | -client_id=public_application.client_id, |
286 | | -post_logout_redirect_uri="http://other.org", |
287 | | - ) |
288 | | -withpytest.raises(InvalidOIDCClientError): |
289 | | -validate_logout_request( |
290 | | -request=mock_request_for(oidc_tokens.user), |
291 | | -id_token_hint=None, |
292 | | -client_id=None, |
293 | | -post_logout_redirect_uri="http://example.org", |
294 | | - ) |
295 | | -withpytest.raises(InvalidOIDCRedirectURIError): |
296 | | -validate_logout_request( |
297 | | -request=mock_request_for(oidc_tokens.user), |
298 | | -id_token_hint=None, |
299 | | -client_id=client_id, |
300 | | -post_logout_redirect_uri="example.org", |
301 | | - ) |
302 | | -withpytest.raises(InvalidOIDCRedirectURIError): |
303 | | -validate_logout_request( |
304 | | -request=mock_request_for(oidc_tokens.user), |
305 | | -id_token_hint=None, |
306 | | -client_id=client_id, |
307 | | -post_logout_redirect_uri="imap://example.org", |
308 | | - ) |
309 | | -withpytest.raises(InvalidOIDCRedirectURIError): |
310 | | -validate_logout_request( |
311 | | -request=mock_request_for(oidc_tokens.user), |
312 | | -id_token_hint=None, |
313 | | -client_id=client_id, |
314 | | -post_logout_redirect_uri="http://other.org", |
315 | | - ) |
316 | | -withpytest.raises(InvalidOIDCRedirectURIError): |
317 | | -rp_settings.OIDC_RP_INITIATED_LOGOUT_STRICT_REDIRECT_URIS=True |
318 | | -validate_logout_request( |
319 | | -request=mock_request_for(oidc_tokens.user), |
320 | | -id_token_hint=None, |
321 | | -client_id=public_application.client_id, |
322 | | -post_logout_redirect_uri="http://other.org", |
323 | | - ) |
324 | | - |
325 | | - |
326 | 223 | @pytest.mark.django_db |
327 | 224 | deftest_validate_logout_request(oidc_tokens, public_application, rp_settings): |
328 | 225 | oidc_tokens=oidc_tokens |
|
0 commit comments