File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -257,3 +257,9 @@ of ``mozilla-django-oidc``.
257257 :default: False
258258
259259 Use HTTP Basic Authentication instead of sending the client secret in token request POST body.
260+
261+ .. py :attribute :: ALLOW_LOGOUT_GET_METHOD
262+
263+ :default: False
264+
265+ Allow using GET method to logout user
Original file line number Diff line number Diff line change 22
33from django .contrib import auth
44from django .core .exceptions import SuspiciousOperation
5- from django .http import HttpResponseRedirect
5+ from django .http import HttpResponseRedirect , HttpResponseNotAllowed
66from django .urls import reverse
77from django .utils .crypto import get_random_string
88
@@ -202,7 +202,7 @@ def redirect_url(self):
202202 """Return the logout url defined in settings."""
203203 return self .get_settings ('LOGOUT_REDIRECT_URL' , '/' )
204204
205- def get (self , request ):
205+ def post (self , request ):
206206 """Log out the user."""
207207 logout_url = self .redirect_url
208208
@@ -218,6 +218,8 @@ def get(self, request):
218218
219219 return HttpResponseRedirect (logout_url )
220220
221- def post (self , request ):
221+ def get (self , request ):
222222 """Log out the user."""
223- return self .get (request )
223+ if self .get_settings ("ALLOW_LOGOUT_GET_METHOD" , False ):
224+ return self .post (request )
225+ return HttpResponseNotAllowed (["POST" ])
You can’t perform that action at this time.
0 commit comments