Skip to content

Commit

Permalink
Reformatted authorize.py with black
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibling committed May 7, 2022
1 parent 5522f41 commit df2ebed
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions authentik/providers/oauth2/views/authorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def from_request(request: HttpRequest) -> "OAuthAuthorizationParams":

# Validate and check the response_mode against the predefined dict
# Set to Query or Fragment if not defined in request
response_mode = query_dict.get('response_mode', False)
response_mode = query_dict.get("response_mode", False)

if response_mode not in ResponseMode.values:
response_mode = ResponseMode.QUERY
Expand Down Expand Up @@ -252,6 +252,7 @@ def create_code(self, request: HttpRequest) -> AuthorizationCode:

return code


class OAuthFulfillmentStage(StageView):
"""Final stage, restores params from Flow."""

Expand All @@ -271,7 +272,7 @@ def redirect(self, uri: str) -> HttpResponse:
"component": "ak-stage-autosubmit",
"title": "Redirecting back to application...",
"url": self.params.redirect_uri,
"attrs": query_params
"attrs": query_params,
}
)

Expand Down Expand Up @@ -353,17 +354,13 @@ def create_response_uri(self) -> str:

return urlunsplit(uri)


if self.params.response_mode == ResponseMode.FORM_POST:
post_params = self.create_implicit_response(code)

uri = uri._replace(
query=urlencode(post_params, doseq=True)
)
uri = uri._replace(query=urlencode(post_params, doseq=True))

return urlunsplit(uri)


raise OAuth2Error()
except OAuth2Error as error:
LOGGER.warning("Error when trying to create response uri", error=error)
Expand Down

0 comments on commit df2ebed

Please sign in to comment.