providers/oauth2: use in for prompt check

This commit is contained in:
Jens Langhammer 2020-12-26 18:53:47 +01:00
parent 3759e96e7d
commit a20ca9136b
2 changed files with 4 additions and 7 deletions

View File

@ -29,6 +29,7 @@ class RequestValidationError(SentryIgnoredException):
if response:
self.response = response
class BaseMixin:
"""Base Mixin class, used to annotate View Member variables"""

View File

@ -341,21 +341,17 @@ class AuthorizationFlowInitView(PolicyAccessView):
self.params = OAuthAuthorizationParams.from_request(self.request)
except OAuth2Error as error:
raise RequestValidationError(
bad_request_message(
self.request, error.description, title=error.error
)
bad_request_message(self.request, error.description, title=error.error)
)
except OAuth2Provider.DoesNotExist:
raise Http404
if self.params.prompt == PROMPT_NONE and not self.request.user.is_authenticated:
if PROMPT_NONE in self.params.prompt and not self.request.user.is_authenticated:
# When "prompt" is set to "none" but the user is not logged in, show an error message
error = AuthorizeError(
self.params.redirect_uri, "interaction_required", self.params.grant_type
)
raise RequestValidationError(
bad_request_message(
self.request, error.description, title=error.error
)
bad_request_message(self.request, error.description, title=error.error)
)
def resolve_provider_application(self):